forked from jywarren/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ranged input for overlay module. (#1459)
* add ranged input for overlay module * fix bug * change input type to integer * Add tests * Add tests Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com> Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
- Loading branch information
1 parent
2736b48
commit b8c7df7
Showing
4 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = function OverlayModuleUi(step, ui) { | ||
|
||
function setup() { | ||
var steps = sequencer.getSteps(); | ||
steps.forEach(function (_step, index) { | ||
if(_step.options && step.options.number === _step.options.number) { | ||
if(index === 1){ | ||
step.ui.querySelector('input[type=range]').value = -1; | ||
step.ui.querySelector('input[type=range]').min = -1; | ||
}else | ||
step.ui.querySelector('input[type=range]').min = -index; | ||
} | ||
}); | ||
} | ||
|
||
return { | ||
setup: setup | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const timeout = process.env.SLOWMO ? 30000 : 10000; | ||
const fs = require('fs'); | ||
beforeAll(async () => { | ||
path = fs.realpathSync('file://../examples/index.html'); | ||
await page.goto('file://' + path, {waitUntil: 'domcontentloaded'}); | ||
}); | ||
|
||
describe('Overlay Ranged input', () => { | ||
test('Overlay Ranged input is working properly', async () => { | ||
// Wait for .step to load | ||
await page.waitForSelector('.step'); | ||
try { | ||
// Click and select step input field. | ||
await page.click('input[type=select-one]'); | ||
// Select Overlay module. | ||
await page.click('[data-value=\'overlay\']'); | ||
|
||
// Click the Add step button. | ||
await page.waitForSelector('#add-step-btn'); | ||
await page.click('#add-step-btn'); | ||
|
||
// Check to see if Overlay ranged input is present. | ||
await page.waitForSelector('input[type=range]'); | ||
|
||
// Get the value of ranged input of First Overlay Step. | ||
const rangeValue = await page.evaluate(() => document.querySelectorAll('input[type=range]')[0].value); | ||
expect(rangeValue).toEqual('-1'); | ||
|
||
// Again click #add-step to add second Overlay step. | ||
await page.click('[data-value=\'overlay\']'); | ||
await page.waitForSelector('#add-step-btn'); | ||
await page.click('#add-step-btn'); | ||
|
||
// Check to see if Second Overlay ranged input is present. | ||
await page.waitForSelector('input[type=range]'); | ||
// Get the value of ranged input of second Overlay Step. | ||
const rangeValueAfter = await page.evaluate(() => document.querySelectorAll('input[type=range]')[1].value); | ||
|
||
// Check if second Overlay ranged input has value -2. | ||
expect(rangeValueAfter).toEqual('-2'); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
|
||
}, timeout); | ||
}); |