Skip to content

Commit 7954a86

Browse files
committed
Add more complicated fourth listener to AppDispatcher-test
1 parent a616742 commit 7954a86

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

examples/todomvc-flux/js/dispatcher/__tests__/AppDispatcher-test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ describe('AppDispatcher', function() {
2424

2525
var listener1Done = false;
2626
var listener1 = function(pl) {
27-
return AppDispatcher.waitFor([index2], function() {
28-
// Second and third listeners should have now been called
27+
return AppDispatcher.waitFor([index2, index4], function() {
28+
// Second, third, and fourth listeners should have now been called
2929
expect(listener2Done).toBe(true);
3030
expect(listener3Done).toBe(true);
31+
expect(listener4Done).toBe(true);
3132
listener1Done = true;
3233
});
3334
};
@@ -49,6 +50,15 @@ describe('AppDispatcher', function() {
4950
};
5051
var index3 = AppDispatcher.register(listener3);
5152

53+
var listener4Done = false;
54+
var listener4 = function(pl) {
55+
return AppDispatcher.waitFor([index3], function() {
56+
expect(listener3Done).toBe(true);
57+
listener4Done = true;
58+
});
59+
};
60+
var index4 = AppDispatcher.register(listener4);
61+
5262
runs(function() {
5363
AppDispatcher.dispatch(payload);
5464
});

0 commit comments

Comments
 (0)