1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-15 01:34:23 +02:00

@carpasse enhanced events to allow passing a second data argument. closes #2163

This commit is contained in:
Carlos
2015-06-05 10:36:59 -07:00
committed by heff
parent 3a0f14728e
commit 55a391b54a
5 changed files with 47 additions and 7 deletions

View File

@ -221,6 +221,23 @@ test('should trigger a listener once using one()', function(){
comp.trigger('test-event');
});
test('should be possible to pass data when you trigger an event', function () {
var comp = new Component(getFakePlayer(), {});
var data1 = 'Data1';
var data2 = {txt: 'Data2'};
expect(3);
var testListener = function(evt, hash){
ok(true, 'fired event once');
deepEqual(hash.d1, data1);
deepEqual(hash.d2, data2);
};
comp.one('test-event', testListener);
comp.trigger('test-event', {d1: data1, d2: data2});
comp.trigger('test-event');
});
test('should add listeners to other components and remove them', function(){
var player = getFakePlayer(),
comp1 = new Component(player),