Skip to content

Commit 4c787b2

Browse files
Use closure actions for tests (#291)
1 parent 7440418 commit 4c787b2

File tree

2 files changed

+90
-69
lines changed

2 files changed

+90
-69
lines changed

tests/helpers/test-scenarios.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
PromiseArray
1212
} = DS;
1313

14-
export function testScenarios(description, scenarios, template, testFn, preRenderTestFn) {
14+
export function testScenarios(description, scenarios, template, testFn, preRenderTestFn, setValuesBeforeRender) {
1515
for (const scenarioName in scenarios) {
1616
const scenario = scenarios[scenarioName];
1717

@@ -21,11 +21,16 @@ export function testScenarios(description, scenarios, template, testFn, preRende
2121
this.set(key, value);
2222
}
2323

24+
// An extra function to set values before render. Mostly to set the closure actions
25+
if (setValuesBeforeRender) {
26+
await setValuesBeforeRender.call(this, assert);
27+
}
28+
2429
await this.render(template);
2530

2631
if (preRenderTestFn) {
2732
await preRenderTestFn.call(this, assert);
28-
} else {
33+
} else if(testFn) {
2934
await wait();
3035
await testFn.call(this, assert);
3136
}

0 commit comments

Comments
 (0)