entityjs 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -14
- data/entityjs.gemspec +1 -0
- data/lib/entityjs/assets.rb +13 -163
- data/lib/entityjs/command.rb +5 -2
- data/lib/entityjs/commands/build.rb +63 -23
- data/lib/entityjs/commands/eunit.rb +44 -0
- data/lib/entityjs/commands/release.rb +1 -1
- data/lib/entityjs/commands/server.rb +19 -4
- data/lib/entityjs/compile.rb +152 -0
- data/lib/entityjs/config.rb +8 -0
- data/lib/entityjs/dirc.rb +70 -17
- data/lib/entityjs/page.rb +106 -0
- data/lib/entityjs/parsers/parse_coffee.rb +12 -0
- data/lib/entityjs/version.rb +1 -1
- data/lib/entityjs.rb +18 -4
- data/public/qunit/qunit.css +9 -3
- data/public/qunit/qunit.entity.js +113 -31
- data/public/qunit/qunit.js +296 -235
- data/public/qunit/qunit.mock.js +54 -2
- data/public/tests.html +0 -15
- data/spec/javascripts/src/cycle/tween_spec.js +59 -0
- data/spec/javascripts/src/display/screen_spec.js +0 -15
- data/spec/javascripts/src/display/text_spec.js +4 -0
- data/spec/javascripts/src/input/mouse_spec.js +18 -18
- data/spec/javascripts/src/input/preventdefault_spec.js +14 -0
- data/spec/javascripts/src/math/drag_spec.js +2 -2
- data/spec/javascripts/src/math/hit_spec.js +24 -0
- data/spec/javascripts/src/math/point_spec.js +3 -3
- data/spec/javascripts/src/math/tile_spec.js +1 -1
- data/spec/javascripts/src/media/sound_spec.js +1 -1
- data/spec/javascripts/src/pattern/automap_spec.js +3 -3
- data/spec/javascripts/src/pattern/flicker_spec.js +2 -1
- data/spec/javascripts/src/util/random_spec.js +17 -0
- data/spec/javascripts/src/util/scene_spec.js +15 -0
- data/spec/lib/entityjs/assets_spec.rb +2 -201
- data/spec/lib/entityjs/commands/build_spec.rb +18 -5
- data/spec/lib/entityjs/commands/eunit_spec.rb +18 -0
- data/spec/lib/entityjs/commands/release_spec.rb +2 -0
- data/spec/lib/entityjs/compile_spec.rb +204 -0
- data/spec/lib/entityjs/dirc_spec.rb +8 -4
- data/spec/lib/entityjs/page_spec.rb +59 -0
- data/spec/support/factories.rb +0 -2
- data/src/core/entity.js +4 -18
- data/src/core/query.js +1 -1
- data/src/core/re.js +6 -6
- data/src/core/system.js +17 -12
- data/src/cycle/tween.js +93 -31
- data/src/display/align.js +11 -6
- data/src/display/circle.js +5 -4
- data/src/display/imgtext.js +33 -22
- data/src/display/screen.js +0 -8
- data/src/display/text.js +37 -4
- data/src/input/keyboard.js +15 -5
- data/src/input/mouse.js +15 -25
- data/src/input/preventdefault.js +11 -0
- data/src/math/body.js +35 -16
- data/src/math/drag.js +2 -2
- data/src/math/force.js +2 -2
- data/src/math/hit.js +15 -6
- data/src/math/hitmap.js +6 -6
- data/src/math/point.js +1 -1
- data/src/math/tile.js +22 -17
- data/src/media/sound.js +1 -1
- data/src/pattern/automap.js +16 -27
- data/src/pattern/flicker.js +9 -5
- data/src/util/random.js +4 -0
- data/src/util/scene.js +2 -6
- data/templates/arrow_keys/scripts/{display → displays}/arrow.js +0 -0
- data/templates/arrow_keys/scripts/{input → inputs}/controls.js +0 -0
- data/templates/arrow_keys/tests/{display → displays}/arrow_test.js +1 -1
- data/templates/arrow_keys/tests/{input → inputs}/controls_test.js +0 -0
- data/templates/arrow_keys/tests/scenes/load_test.js +2 -0
- data/templates/{blank → circle}/config.yml +0 -0
- data/templates/{blank → circle}/readme.txt +0 -0
- data/templates/circle/scripts/init.js +7 -0
- data/templates/circle/scripts/scenes/home.js +62 -0
- data/templates/circle/scripts/scenes/load.js +11 -0
- data/templates/circle/tests/scenes/home_test.js +29 -0
- data/templates/circle/tests/scenes/load_test.js +15 -0
- data/templates/platform/config.yml +2 -1
- data/templates/platform/readme.txt +15 -16
- data/templates/platform/scripts/{display → displays}/bit.js +0 -0
- data/templates/platform/scripts/{display → displays}/hero.js +0 -0
- data/templates/platform/scripts/{display → displays}/tile.js +0 -0
- data/templates/platform/scripts/{display → displays}/tsprite.js +0 -0
- data/templates/platform/{assets → scripts}/levels/level1.tmx +0 -0
- data/templates/platform/scripts/{util → utils}/counter.js +0 -0
- data/templates/platform/scripts/{util → utils}/level.js +0 -0
- data/templates/platform/tests/{display → displays}/bit_test.js +1 -1
- data/templates/platform/tests/displays/hero_test.js +73 -0
- data/templates/platform/tests/{display → displays}/tile_test.js +1 -1
- data/templates/platform/tests/displays/tsprite_test.js +8 -0
- data/templates/platform/tests/items/coin_test.js +10 -10
- data/templates/platform/tests/items/item_test.js +9 -9
- data/templates/platform/tests/items/spring_test.js +3 -3
- data/templates/platform/tests/scenes/load_test.js +2 -1
- data/templates/platform/tests/{util → utils}/counter_test.js +2 -2
- data/templates/platform/tests/{util → utils}/level_test.js +3 -0
- data/templates/pong/config.yml +22 -0
- data/templates/pong/readme.txt +3 -0
- data/templates/pong/scripts/controls/ai.js +30 -0
- data/templates/pong/scripts/controls/arena.js +33 -0
- data/templates/pong/scripts/controls/hitmap.js +54 -0
- data/templates/pong/scripts/controls/player.js +24 -0
- data/templates/pong/scripts/controls/twoarena.js +14 -0
- data/templates/pong/scripts/displays/ball.js +29 -0
- data/templates/pong/scripts/displays/counter.js +22 -0
- data/templates/pong/scripts/displays/paddle.js +22 -0
- data/templates/pong/scripts/init.js +9 -0
- data/templates/pong/scripts/scenes/game.js +61 -0
- data/templates/pong/scripts/scenes/home.js +55 -0
- data/templates/pong/scripts/scenes/over.js +29 -0
- data/templates/pong/tests/controls/ai_test.js +34 -0
- data/templates/pong/tests/controls/arena_test.js +20 -0
- data/templates/pong/tests/controls/hitmap_test.js +89 -0
- data/templates/pong/tests/controls/player_test.js +25 -0
- data/templates/pong/tests/controls/twoarena_test.js +7 -0
- data/templates/pong/tests/displays/ball_test.js +10 -0
- data/templates/pong/tests/displays/counter_test.js +13 -0
- data/templates/pong/tests/displays/paddle_test.js +17 -0
- data/templates/pong/tests/scenes/game_test.js +16 -0
- data/templates/pong/tests/scenes/home_test.js +30 -0
- data/templates/pong/tests/scenes/over_test.js +16 -0
- data/templates/tiltmaze/config.yml +25 -0
- data/templates/tiltmaze/readme.txt +79 -0
- data/templates/tiltmaze/scripts/displays/ball.js +78 -0
- data/templates/tiltmaze/scripts/displays/target.js +13 -0
- data/templates/tiltmaze/scripts/displays/tile.js +2 -0
- data/templates/tiltmaze/scripts/init.js +7 -0
- data/templates/tiltmaze/scripts/levels/level1.json +14 -0
- data/templates/tiltmaze/scripts/levels/level2.json +14 -0
- data/templates/tiltmaze/scripts/levels/level3.json +14 -0
- data/templates/tiltmaze/scripts/levels/level4.json +15 -0
- data/templates/tiltmaze/scripts/levels/level5.json +18 -0
- data/templates/tiltmaze/scripts/scenes/game.js +56 -0
- data/templates/tiltmaze/scripts/scenes/home.js +24 -0
- data/templates/tiltmaze/scripts/structs/level.js +82 -0
- data/templates/tiltmaze/scripts/tiles/walltile.js +147 -0
- data/templates/tiltmaze/tests/displays/ball_test.js +67 -0
- data/templates/tiltmaze/tests/displays/target_test.js +8 -0
- data/templates/tiltmaze/tests/factories.js +38 -0
- data/templates/tiltmaze/tests/scenes/game_test.js +59 -0
- data/templates/tiltmaze/tests/scenes/home_test.js +7 -0
- data/templates/tiltmaze/tests/structs/level_test.js +44 -0
- data/templates/tiltmaze/tests/tiles/walltile_test.js +36 -0
- metadata +106 -33
- data/templates/platform/tests/display/hero_test.js +0 -73
- data/templates/platform/tests/display/tsprite_test.js +0 -8
data/public/qunit/qunit.mock.js
CHANGED
@@ -1,15 +1,43 @@
|
|
1
|
+
//TODO: fix up
|
2
|
+
/*
|
3
|
+
|
4
|
+
Implements:
|
5
|
+
|
6
|
+
//expects the method to be called before the end of the test
|
7
|
+
expectCall(re, 'pressed')
|
8
|
+
|
9
|
+
//expects a method to be called with the given arguments
|
10
|
+
expectCall(re, 'pressed', ['a'])
|
11
|
+
|
12
|
+
//expects a method to be called a number of times
|
13
|
+
expectCall(re, 'pressed', null, 2)
|
14
|
+
|
15
|
+
//stubs a method with a custom method
|
16
|
+
stub(re, 'pressed', function(value){
|
17
|
+
return false;
|
18
|
+
});
|
19
|
+
|
20
|
+
//method does nothing
|
21
|
+
stub(re, 'pressed');
|
22
|
+
|
23
|
+
//method returns 10
|
24
|
+
stub(re, 'pressed', 10);
|
25
|
+
|
26
|
+
*/
|
1
27
|
(function() {
|
2
28
|
var expectCall, finishMock, mock, mocked, mocking, stack, stub, testExpectations;
|
3
29
|
var __slice = Array.prototype.slice;
|
4
30
|
mocking = null;
|
5
31
|
stack = [];
|
6
|
-
expectCall = function(object, method, calls) {
|
32
|
+
expectCall = function(object, method, args, calls) {
|
7
33
|
var expectation;
|
8
34
|
calls = (typeof calls !== "undefined" && calls !== null) ? calls : 1;
|
35
|
+
|
9
36
|
expectation = {
|
10
37
|
object: object,
|
11
38
|
method: method,
|
12
39
|
expectedCalls: calls,
|
40
|
+
expectedArgs: args,
|
13
41
|
originalMethod: object[method],
|
14
42
|
callCount: 0
|
15
43
|
};
|
@@ -17,12 +45,25 @@
|
|
17
45
|
var args;
|
18
46
|
args = __slice.call(arguments, 0);
|
19
47
|
expectation.originalMethod.apply(object, args);
|
48
|
+
|
49
|
+
expectation.args = args;
|
50
|
+
|
20
51
|
return expectation.callCount += 1;
|
21
52
|
};
|
22
53
|
return mocking.expectations.push(expectation);
|
23
54
|
};
|
24
55
|
stub = function(object, method, fn) {
|
25
56
|
var stb;
|
57
|
+
|
58
|
+
if(fn == null){
|
59
|
+
fn = function(){};
|
60
|
+
} else if(typeof fn != 'function'){
|
61
|
+
var value = fn;
|
62
|
+
fn = function(){
|
63
|
+
return value;
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
26
67
|
stb = {
|
27
68
|
object: object,
|
28
69
|
method: method,
|
@@ -56,7 +97,18 @@
|
|
56
97
|
var _a, expectation, stb;
|
57
98
|
while (mocking.expectations.length > 0) {
|
58
99
|
expectation = mocking.expectations.pop();
|
59
|
-
|
100
|
+
equal(expectation.callCount, expectation.expectedCalls, "method " + (expectation.method) + " should be called " + (expectation.expectedCalls) + " times");
|
101
|
+
|
102
|
+
if(expectation.expectedArgs){
|
103
|
+
//equal(expectation.expectedArgs.length, expectation.args.length, "method " + (expectation.method) + " should have " + (expectation.expectedArgs.length) + " arguments")
|
104
|
+
|
105
|
+
//check args
|
106
|
+
var eargs = expectation.expectedArgs;
|
107
|
+
var args = expectation.args;
|
108
|
+
ok(!(eargs>args || eargs<args), "method "+ expectation.method +" should have same arguments");
|
109
|
+
|
110
|
+
}
|
111
|
+
|
60
112
|
expectation.object[expectation.method] = expectation.originalMethod;
|
61
113
|
}
|
62
114
|
_a = [];
|
data/public/tests.html
CHANGED
@@ -14,23 +14,8 @@
|
|
14
14
|
}
|
15
15
|
</style>
|
16
16
|
|
17
|
-
<script type="text/javascript" src="qunit/qunit.js"></script>
|
18
|
-
<script type="text/javascript" src="qunit/qunit.mock.js"></script>
|
19
|
-
<script type="text/javascript" src="qunit/qunit.input.js"></script>
|
20
|
-
<script type="text/javascript" src="qunit/qunit.entity.js"></script>
|
21
|
-
|
22
17
|
$JS
|
23
18
|
|
24
|
-
<script type="text/javascript">
|
25
|
-
//disable re.ready to test functionality
|
26
|
-
re.ready.c = [];
|
27
|
-
|
28
|
-
window.onload = function(){
|
29
|
-
//auto start system for helpfulness
|
30
|
-
re.sys.init(re.canvas).start();
|
31
|
-
};
|
32
|
-
</script>
|
33
|
-
|
34
19
|
</head>
|
35
20
|
<body>
|
36
21
|
<h1 id="qunit-header">Game Test Suite</h1>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
describe('cycle/tween', function(){
|
2
|
+
|
3
|
+
var tween;
|
4
|
+
|
5
|
+
beforeEach(function(){
|
6
|
+
tween = re.e('tween');
|
7
|
+
tween.x = 0;
|
8
|
+
tween.y = 0;
|
9
|
+
});
|
10
|
+
|
11
|
+
it('should move object', function(){
|
12
|
+
var called = false, calledUpdate = false, calledFinish = false;
|
13
|
+
|
14
|
+
tween.on('tween:update', function(){
|
15
|
+
calledUpdate = true;
|
16
|
+
})
|
17
|
+
|
18
|
+
tween.on('tween:finish', function(){
|
19
|
+
calledFinish = true;
|
20
|
+
})
|
21
|
+
|
22
|
+
tween.on('tween:start', function(){
|
23
|
+
called = true;
|
24
|
+
})
|
25
|
+
|
26
|
+
tween.tween(0, {x:100});
|
27
|
+
|
28
|
+
for(var i=60; i--;)
|
29
|
+
tween.tween_update(re.sys.stepSize)
|
30
|
+
|
31
|
+
eq(tween.x, 100);
|
32
|
+
ok(called)
|
33
|
+
ok(calledUpdate)
|
34
|
+
ok(calledFinish)
|
35
|
+
});
|
36
|
+
|
37
|
+
it('should move object in 60ms', function(){
|
38
|
+
|
39
|
+
tween.comp('tile');
|
40
|
+
|
41
|
+
tween.x = -10;
|
42
|
+
tween.tween(1, {x:50, tileY:10});
|
43
|
+
|
44
|
+
var step = re.sys.stepSize;
|
45
|
+
|
46
|
+
tween.tween_time = tween.tween_t * 0.5;
|
47
|
+
|
48
|
+
tween.tween_update(step)
|
49
|
+
|
50
|
+
eq(tween.x, 23.240000000000002);
|
51
|
+
|
52
|
+
for(var i=60; i--;)
|
53
|
+
tween.tween_update(step);
|
54
|
+
|
55
|
+
eq(tween.x, 50);
|
56
|
+
eq(tween.tileY(), 10);
|
57
|
+
});
|
58
|
+
|
59
|
+
});
|
@@ -29,19 +29,4 @@ describe('screen', function(){
|
|
29
29
|
is(e.toScreenY(10))
|
30
30
|
});
|
31
31
|
|
32
|
-
it('toscreen', function(){
|
33
|
-
|
34
|
-
var k = e.toScreen(10, 2);
|
35
|
-
eq(k.x, 10)
|
36
|
-
eq(k.y, 2)
|
37
|
-
|
38
|
-
k = e.toScreen({posX:3, posY:1})
|
39
|
-
eq(k.x, 3)
|
40
|
-
eq(k.y, 1)
|
41
|
-
|
42
|
-
k = e.toScreen({x:6, y:5})
|
43
|
-
eq(k.x, 6)
|
44
|
-
eq(k.y, 5)
|
45
|
-
})
|
46
|
-
|
47
32
|
});
|
@@ -15,8 +15,8 @@ describe('mouse', function(){
|
|
15
15
|
is(m)
|
16
16
|
is(m.screenX)
|
17
17
|
is(m.screenY)
|
18
|
-
is(m.
|
19
|
-
is(m.
|
18
|
+
is(m.posX)
|
19
|
+
is(m.posY)
|
20
20
|
});
|
21
21
|
|
22
22
|
e.on(type+':middle', function(m, e){
|
@@ -24,7 +24,7 @@ describe('mouse', function(){
|
|
24
24
|
is(m)
|
25
25
|
})
|
26
26
|
|
27
|
-
re.c('mouse').event({type:type,
|
27
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0}, 'middle')
|
28
28
|
|
29
29
|
ok(called2)
|
30
30
|
ok(called)
|
@@ -39,8 +39,8 @@ describe('mouse', function(){
|
|
39
39
|
is(m)
|
40
40
|
is(m.screenX)
|
41
41
|
is(m.screenY)
|
42
|
-
is(m.
|
43
|
-
is(m.
|
42
|
+
is(m.posX)
|
43
|
+
is(m.posY)
|
44
44
|
});
|
45
45
|
|
46
46
|
e.on(type+':middle', function(m, e){
|
@@ -48,7 +48,7 @@ describe('mouse', function(){
|
|
48
48
|
is(m)
|
49
49
|
})
|
50
50
|
|
51
|
-
re.c('mouse').event({type:type,
|
51
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0}, 'middle')
|
52
52
|
|
53
53
|
ok(called2)
|
54
54
|
ok(called)
|
@@ -65,11 +65,11 @@ describe('mouse', function(){
|
|
65
65
|
is(m)
|
66
66
|
is(m.screenX)
|
67
67
|
is(m.screenY)
|
68
|
-
is(m.
|
69
|
-
is(m.
|
68
|
+
is(m.posX)
|
69
|
+
is(m.posY)
|
70
70
|
});
|
71
71
|
|
72
|
-
re.c('mouse').event({type:type,
|
72
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0})
|
73
73
|
|
74
74
|
ok(called)
|
75
75
|
});
|
@@ -84,11 +84,11 @@ describe('mouse', function(){
|
|
84
84
|
is(m)
|
85
85
|
is(m.screenX)
|
86
86
|
is(m.screenY)
|
87
|
-
is(m.
|
88
|
-
is(m.
|
87
|
+
is(m.posX)
|
88
|
+
is(m.posY)
|
89
89
|
});
|
90
90
|
|
91
|
-
re.c('mouse').event({type:type,
|
91
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0})
|
92
92
|
|
93
93
|
ok(called)
|
94
94
|
})
|
@@ -103,11 +103,11 @@ describe('mouse', function(){
|
|
103
103
|
is(m)
|
104
104
|
is(m.screenX)
|
105
105
|
is(m.screenY)
|
106
|
-
is(m.
|
107
|
-
is(m.
|
106
|
+
is(m.posX)
|
107
|
+
is(m.posY)
|
108
108
|
});
|
109
109
|
|
110
|
-
re.c('mouse').event({type:type,
|
110
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0})
|
111
111
|
|
112
112
|
ok(called)
|
113
113
|
})
|
@@ -122,11 +122,11 @@ describe('mouse', function(){
|
|
122
122
|
is(m)
|
123
123
|
is(m.screenX)
|
124
124
|
is(m.screenY)
|
125
|
-
is(m.
|
126
|
-
is(m.
|
125
|
+
is(m.posX)
|
126
|
+
is(m.posY)
|
127
127
|
});
|
128
128
|
|
129
|
-
re.c('mouse').event({type:type,
|
129
|
+
re.c('mouse').event({type:type, offsetX:0, offsetY:0})
|
130
130
|
|
131
131
|
ok(called)
|
132
132
|
})
|
@@ -16,7 +16,7 @@ describe('drag', function(){
|
|
16
16
|
.on('drag:update', function(){
|
17
17
|
called2 = true;
|
18
18
|
})
|
19
|
-
.on('drag:
|
19
|
+
.on('drag:finish', function(){
|
20
20
|
called3 = true;
|
21
21
|
})
|
22
22
|
|
@@ -29,7 +29,7 @@ describe('drag', function(){
|
|
29
29
|
|
30
30
|
ok(called2)
|
31
31
|
|
32
|
-
is(e.
|
32
|
+
is(e.dragFinish());
|
33
33
|
|
34
34
|
ok(called3)
|
35
35
|
|
@@ -25,4 +25,28 @@ describe('hit', function(){
|
|
25
25
|
not(e.hit({x:100, y:0, w:30, h:30}))
|
26
26
|
})
|
27
27
|
|
28
|
+
it('should hit object with reg', function(){
|
29
|
+
|
30
|
+
e.sizeX = 6;
|
31
|
+
e.sizeY = 6;
|
32
|
+
e.regX = 3;
|
33
|
+
e.regY = 3;
|
34
|
+
|
35
|
+
not(e.hit({x:-3.1, y:-3.1, w:6, h:6, regX:6, regY:6}));
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
it('should hit object with op reg', function(){
|
40
|
+
|
41
|
+
e.sizeX = 6;
|
42
|
+
e.sizeY = 6;
|
43
|
+
e.regX = 6;
|
44
|
+
e.regY = 6;
|
45
|
+
e.posX = -3.1;
|
46
|
+
e.posY = -3.1;
|
47
|
+
|
48
|
+
not(e.hit({x:0, y:0, w:6, h:6, regX:3, regY:3}));
|
49
|
+
|
50
|
+
});
|
51
|
+
|
28
52
|
});
|
@@ -36,7 +36,7 @@ describe('point', function(){
|
|
36
36
|
it('should be correct distance', function(){
|
37
37
|
e.posX = 12;
|
38
38
|
e.posY = 54;
|
39
|
-
eq(e.
|
39
|
+
eq(e.distance(23,74), 23)
|
40
40
|
})
|
41
41
|
|
42
42
|
it('should be correct distance with from', function(){
|
@@ -46,12 +46,12 @@ describe('point', function(){
|
|
46
46
|
|
47
47
|
var o = {x:23, y:74}
|
48
48
|
|
49
|
-
eq(e.
|
49
|
+
eq(e.distance(o), 23)
|
50
50
|
|
51
51
|
|
52
52
|
o = {posX:23, posY:74}
|
53
53
|
|
54
|
-
eq(e.
|
54
|
+
eq(e.distance(o), 23)
|
55
55
|
})
|
56
56
|
|
57
57
|
});
|
@@ -61,7 +61,7 @@ describe('automap', function(){
|
|
61
61
|
eq(e.automap(0, 0), 1)
|
62
62
|
eq(e.automap(0, 1), 6)
|
63
63
|
|
64
|
-
eq(e.
|
64
|
+
eq(e._automap, level)
|
65
65
|
})
|
66
66
|
|
67
67
|
it('should contain right length', function(){
|
@@ -85,8 +85,8 @@ describe('automap', function(){
|
|
85
85
|
|
86
86
|
eq(e.lenX, m[0].length)
|
87
87
|
eq(e.lenY, m.length)
|
88
|
-
eq(e.
|
89
|
-
eq(e.
|
88
|
+
eq(e._automap.length, m.length)
|
89
|
+
eq(e._automap[0].length, m[0].length)
|
90
90
|
|
91
91
|
});
|
92
92
|
|
@@ -19,6 +19,7 @@ describe('flicker', function(){
|
|
19
19
|
e.addFlicker('heal', 5, 200, [10])
|
20
20
|
|
21
21
|
is(e.flicker_reels['heal'])
|
22
|
+
|
22
23
|
});
|
23
24
|
|
24
25
|
it('removeFlicker', function(){
|
@@ -42,7 +43,7 @@ describe('flicker', function(){
|
|
42
43
|
e.on('flicker:start', function(){
|
43
44
|
called = true;
|
44
45
|
})
|
45
|
-
.on('flicker:
|
46
|
+
.on('flicker:finish', function(v){
|
46
47
|
called2 = true;
|
47
48
|
is(v, 'string')
|
48
49
|
})
|
@@ -20,6 +20,23 @@ describe('random', function(){
|
|
20
20
|
|
21
21
|
});
|
22
22
|
|
23
|
+
it('should get one or the other', function(){
|
24
|
+
|
25
|
+
var first = false;
|
26
|
+
var second = false;
|
27
|
+
|
28
|
+
for(var i = 100; i--;){
|
29
|
+
var n = re.random([-10, 10]);
|
30
|
+
if(n == 10) first = true;
|
31
|
+
if(n == -10) second = true;
|
32
|
+
ok(n == -10 || n == 10)
|
33
|
+
}
|
34
|
+
|
35
|
+
ok(first)
|
36
|
+
ok(second)
|
37
|
+
|
38
|
+
});
|
39
|
+
|
23
40
|
it('random -10 to 10', function(){
|
24
41
|
|
25
42
|
for(var i = 100; i--;){
|
@@ -49,4 +49,19 @@ describe('test', function(){
|
|
49
49
|
|
50
50
|
})
|
51
51
|
|
52
|
+
it('should exit once', function(){
|
53
|
+
|
54
|
+
var called = 0;
|
55
|
+
|
56
|
+
re.scene('bob')
|
57
|
+
.exit(function(){
|
58
|
+
called++;
|
59
|
+
}).enter();
|
60
|
+
|
61
|
+
re.scene('blah').enter(10);
|
62
|
+
|
63
|
+
eq(called, 1);
|
64
|
+
|
65
|
+
});
|
66
|
+
|
52
67
|
});
|