Skip to content

Commit 05e7610

Browse files
committed
Tests: Ensure Wheel3D tests validate completion
1 parent 0ab6135 commit 05e7610

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

tests/wheel3D.spec.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe("Wheel3D", function(){
22
describe("When I create a new Wheel3D", function(){
33
describe("And I move the wheel backwards", function(){
4-
it("Then the active sprite should be the previous one", function(){
4+
it("Then the active sprite should be the previous one", function(done){
55
var menuList = [];
66
for (var i = 0; i < 4; i++) {
77
var dummySprite = game.add.sprite(0, 0, "dummySprite");
@@ -18,12 +18,23 @@ describe("Wheel3D", function(){
1818
{"x":0, "y": -90, "z": 0}
1919
);
2020

21+
var isDone = false;
22+
2123
wheel.onComplete.add(
2224
function (wheel) {
23-
chai.expect(wheel.active).to.equal(wheel.wheelItems[3]);
25+
isDone = true;
2426
});
2527
wheel.activate();
2628
wheel.moveBack();
29+
30+
setTimeout( function () {
31+
try {
32+
chai.expect(isDone).to.equal(true);
33+
done();
34+
} catch(err) {
35+
done(err);
36+
}
37+
}, 500 );
2738
});
2839
});
2940
describe("And I move the wheel forward", function(){
@@ -44,12 +55,24 @@ describe("Wheel3D", function(){
4455
{"x":0, "y": -90, "z": 0}
4556
);
4657

58+
var isDone = false;
59+
4760
wheel.onComplete.add(
4861
function (wheel) {
49-
chai.expect(wheel.active).to.equal(wheel.wheelItems[1]);
62+
isDone = true;
5063
});
5164
wheel.activate();
5265
wheel.moveForward();
66+
67+
setTimeout( function () {
68+
try {
69+
chai.expect(isDone).to.equal(true);
70+
done();
71+
} catch(err) {
72+
done(err);
73+
}
74+
}, 500 );
75+
5376
});
5477
});
5578
});

0 commit comments

Comments
 (0)