dwf/rva: Suites now have beforeEach and AfterEach
This commit is contained in:
@@ -40,13 +40,19 @@ var actionCollection = function () {
|
||||
},
|
||||
|
||||
next: function() {
|
||||
if (that.index < that.actions.length) {
|
||||
var currentAction = that.getCurrentAction();
|
||||
currentAction.execute();
|
||||
that.waitForDone(currentAction);
|
||||
} else {
|
||||
if (that.index >= that.actions.length) {
|
||||
that.finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var currentAction = that.getCurrentAction();
|
||||
|
||||
if (that.beforeEach) {
|
||||
that.beforeEach.apply(currentAction);
|
||||
}
|
||||
|
||||
currentAction.execute();
|
||||
that.waitForDone(currentAction);
|
||||
},
|
||||
|
||||
waitForDone: function(action) {
|
||||
@@ -54,6 +60,11 @@ var actionCollection = function () {
|
||||
if (action.finished) {
|
||||
clearInterval(id);
|
||||
that.report(action.results);
|
||||
|
||||
if (that.afterEach) {
|
||||
that.afterEach.apply(action);
|
||||
}
|
||||
|
||||
that.index++;
|
||||
that.next();
|
||||
}
|
||||
@@ -217,11 +228,19 @@ var runs = function (func) {
|
||||
currentSpec.runs(func);
|
||||
}
|
||||
|
||||
var then = runs;
|
||||
|
||||
var waits = function (timeout) {
|
||||
currentSpec.waits(timeout);
|
||||
}
|
||||
|
||||
var then = runs;
|
||||
var beforeEach = function (beforeEach) {
|
||||
currentSuite.beforeEach = beforeEach;
|
||||
}
|
||||
|
||||
var afterEach = function (afterEach) {
|
||||
currentSuite.afterEach = afterEach;
|
||||
}
|
||||
|
||||
var describe = function (description, spec_definitions) {
|
||||
var that = actionCollection();
|
||||
|
||||
Reference in New Issue
Block a user