Skip to content

Commit 5d8f9b2

Browse files
Merge pull request #84 from RobotlegsJS/upgrade-dependencies
Update dependencies to latest version 🚀 (closes #83)
2 parents 61a9d14 + 079adf6 commit 5d8f9b2

File tree

3 files changed

+260
-281
lines changed

3 files changed

+260
-281
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
},
6969
"devDependencies": {
7070
"@types/bluebird": "^3.5.24",
71-
"@types/chai": "^4.1.4",
71+
"@types/chai": "^4.1.5",
7272
"@types/mocha": "^5.2.5",
7373
"@types/sinon": "^5.0.2",
7474
"bluebird": "^3.5.2",
@@ -96,22 +96,22 @@
9696
"karma-webpack": "^3.0.5",
9797
"mocha": "^5.2.0",
9898
"nyc": "^13.0.1",
99-
"prettier": "^1.14.2",
99+
"prettier": "^1.14.3",
100100
"publish-please": "^3.2.0",
101101
"reflect-metadata": "^0.1.12",
102102
"remap-istanbul": "^0.12.0",
103103
"rimraf": "^2.6.2",
104-
"sinon": "^6.3.3",
104+
"sinon": "^6.3.4",
105105
"sinon-chai": "^3.2.0",
106106
"source-map-support": "^0.5.9",
107-
"ts-loader": "^5.1.1",
107+
"ts-loader": "^5.2.0",
108108
"ts-node": "^7.0.1",
109109
"tslint": "^5.11.0",
110110
"tslint-config-prettier": "^1.15.0",
111111
"typescript": "^3.0.3",
112-
"uglifyjs-webpack-plugin": "^2.0.0",
113-
"webpack": "^4.19.0",
114-
"webpack-cli": "^3.1.0",
115-
"webpack-dev-server": "^3.1.8"
112+
"uglifyjs-webpack-plugin": "^2.0.1",
113+
"webpack": "^4.20.1",
114+
"webpack-cli": "^3.1.1",
115+
"webpack-dev-server": "^3.1.9"
116116
}
117117
}

test/org/osflash/signals/PriorityListenersTest.test.ts

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import { assert } from "chai";
1111

1212
import { AsyncUtil } from "../../../util/AsyncUtil";
1313
import { DeluxeSignal } from "../../../../src/org/osflash/signals/DeluxeSignal";
14+
1415
describe("PriorityListenersTest", () => {
1516
let async: AsyncUtil = new AsyncUtil();
1617

1718
let completed: DeluxeSignal;
19+
let listenersToCall: number;
1820
let listenersCalled: any[];
21+
let callback: Function;
1922

2023
beforeEach(() => {
2124
completed = new DeluxeSignal(this);
@@ -26,34 +29,61 @@ describe("PriorityListenersTest", () => {
2629
completed.removeAll();
2730
completed = null;
2831
listenersCalled = null;
29-
});
30-
31-
it("listener_added_second_with_higher_priority_should_be_called_first()", done => {
32-
completed.addWithPriority(async.add(listener1, 5));
33-
completed.addWithPriority(async.add(listener0, 5, done), 10);
34-
35-
completed.dispatch();
32+
callback = null;
3633
});
3734

3835
function listener0(): void {
3936
listenersCalled.push(listener0);
4037
assert.equal(listener0, listenersCalled[0], "this should be the first listener called");
38+
checkCallback();
4139
}
4240

4341
function listener1(): void {
4442
listenersCalled.push(listener1);
4543
assert.equal(listener1, listenersCalled[1], "this should be the second listener called");
44+
checkCallback();
4645
}
4746

4847
function listener2(): void {
4948
listenersCalled.push(listener2);
5049
assert.equal(listener2, listenersCalled[2], "this should be the third listener called");
50+
checkCallback();
51+
}
52+
53+
function checkCallback(): void {
54+
if (listenersCalled.length >= listenersToCall) {
55+
callback();
56+
}
5157
}
5258

59+
it("listener_added_second_with_higher_priority_should_be_called_first()", done => {
60+
listenersToCall = 2;
61+
callback = done;
62+
63+
completed.addWithPriority(async.add(listener1, 5));
64+
completed.addWithPriority(async.add(listener0, 5), 10);
65+
66+
completed.dispatch();
67+
});
68+
5369
it("listeners_added_with_same_priority_should_be_called_in_order_added()", done => {
70+
listenersToCall = 3;
71+
callback = done;
72+
5473
completed.addWithPriority(async.add(listener0, 5), 10);
5574
completed.addWithPriority(async.add(listener1, 5), 10);
56-
completed.addWithPriority(async.add(listener2, 5, done), 10);
75+
completed.addWithPriority(async.add(listener2, 5), 10);
76+
77+
completed.dispatch();
78+
});
79+
80+
it("listeners_with_high_priority_should_be_called_first", done => {
81+
listenersToCall = 3;
82+
callback = done;
83+
84+
completed.addWithPriority(async.add(listener2, 5), 0);
85+
completed.addWithPriority(async.add(listener1, 5), 5);
86+
completed.addWithPriority(async.add(listener0, 5), 10);
5787

5888
completed.dispatch();
5989
});

0 commit comments

Comments
 (0)