Skip to content

Commit

Permalink
Update media test to use PlayerTest player
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Tangney committed Jul 23, 2013
1 parent 0bdbe02 commit 1c225da
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions test/unit/media.html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@ test('should re-link the player if the tech is moved', function(){
});

test('should not call default action on media event', function() {
expect(2);
var player = {
id: function() { return 'id'; },
el: function() { return document.createElement('div'); },
options_: {},
trigger: function(event) {
ok(event.type === 'play', 'non-play media event fired');
ok(event.isDefaultPrevented(), 'default action not prevented');
},
ready: function() {}
};
var tech = new vjs.Html5(player, { el: vjs.TEST_VID });
// Mediafaker doesn't support play/pause, so dispatch an event manually.
expect(1);
var player = PlayerTest.makePlayer();
player.on('play', function(event) {
ok(event.isDefaultPrevented(), 'default action not prevented.');
});
var tech = new vjs.Html5(player, {});
// PhantomJS does not currently support event constructors (the creation
// method advised by MDN) https://github.com/ariya/phantomjs/issues/11289
// so we use the 'old' way of doing so here.
var event = document.createEvent('CustomEvent');
event.initCustomEvent('play', false /*bubbles*/, true /*cancelable*/, null);
// Mediafaker doesn't support play/pause, so dispatch an event manually.
tech.el_.dispatchEvent(event);
});

0 comments on commit 1c225da

Please sign in to comment.