Skip to content

Commit

Permalink
Tests: Ensure Wheel3D tests validate completion
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Feb 27, 2019
1 parent 0ab6135 commit 05e7610
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions tests/wheel3D.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("Wheel3D", function(){
describe("When I create a new Wheel3D", function(){
describe("And I move the wheel backwards", function(){
it("Then the active sprite should be the previous one", function(){
it("Then the active sprite should be the previous one", function(done){
var menuList = [];
for (var i = 0; i < 4; i++) {
var dummySprite = game.add.sprite(0, 0, "dummySprite");
Expand All @@ -18,12 +18,23 @@ describe("Wheel3D", function(){
{"x":0, "y": -90, "z": 0}
);

var isDone = false;

wheel.onComplete.add(
function (wheel) {
chai.expect(wheel.active).to.equal(wheel.wheelItems[3]);
isDone = true;
});
wheel.activate();
wheel.moveBack();

setTimeout( function () {
try {
chai.expect(isDone).to.equal(true);
done();
} catch(err) {
done(err);
}
}, 500 );
});
});
describe("And I move the wheel forward", function(){
Expand All @@ -44,12 +55,24 @@ describe("Wheel3D", function(){
{"x":0, "y": -90, "z": 0}
);

var isDone = false;

wheel.onComplete.add(
function (wheel) {
chai.expect(wheel.active).to.equal(wheel.wheelItems[1]);
isDone = true;
});
wheel.activate();
wheel.moveForward();

setTimeout( function () {
try {
chai.expect(isDone).to.equal(true);
done();
} catch(err) {
done(err);
}
}, 500 );

});
});
});
Expand Down

0 comments on commit 05e7610

Please sign in to comment.