Skip to content

Commit 49e712f

Browse files
committed
adding ability to test multiple event listeners
1 parent 238dfb4 commit 49e712f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/store/mapStoreToPlayer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ const sandbox = sinon.sandbox.create();
1616
function setupPlayer(params) {
1717
const playSpy = sinon.spy();
1818
const pauseSpy = sinon.spy();
19+
const eventMapper = {};
1920
const player = {
2021
play: playSpy,
2122
pause: pauseSpy,
2223
playSpy: playSpy,
2324
pauseSpy: pauseSpy,
2425
addEventListener: function addEventListener(name, cb) {
25-
this[name] = cb;
26+
if (!eventMapper[name]) eventMapper[name] = [];
27+
eventMapper[name].push(cb);
28+
29+
this[name] = () => _.each(eventMapper[name], (func) => func());
2630
}
2731
};
2832

0 commit comments

Comments
 (0)