2013-03-05 23:39:43 +03:00
|
|
|
module('Player Minified');
|
|
|
|
|
2013-06-24 22:47:47 +03:00
|
|
|
test('should be able to access expected player API methods', function() {
|
|
|
|
var player = PlayerTest.makePlayer();
|
|
|
|
|
|
|
|
// Native HTML5 Methods
|
2013-12-10 03:16:09 +03:00
|
|
|
ok(player.error, 'error exists');
|
2013-06-24 22:47:47 +03:00
|
|
|
ok(player.src, 'src exists');
|
2013-12-10 03:16:09 +03:00
|
|
|
ok(player.currentSrc, 'currentSrc exists');
|
|
|
|
ok(player.buffered, 'buffered exists');
|
|
|
|
ok(player.load, 'load exists');
|
|
|
|
ok(player.seeking, 'seeking exists');
|
2013-06-24 22:47:47 +03:00
|
|
|
ok(player.currentTime, 'currentTime exists');
|
|
|
|
ok(player.duration, 'duration exists');
|
2013-12-10 03:16:09 +03:00
|
|
|
ok(player.paused, 'paused exists');
|
|
|
|
ok(player.ended, 'ended exists');
|
|
|
|
ok(player.autoplay, 'autoplay exists');
|
|
|
|
ok(player.loop, 'loop exists');
|
|
|
|
ok(player.play , 'play exists');
|
|
|
|
ok(player.pause , 'pause exists');
|
|
|
|
ok(player.controls, 'controls exists');
|
2013-06-24 22:47:47 +03:00
|
|
|
ok(player.volume, 'volume exists');
|
|
|
|
ok(player.muted, 'muted exists');
|
|
|
|
ok(player.width, 'width exists');
|
|
|
|
ok(player.height, 'height exists');
|
2013-12-10 03:16:09 +03:00
|
|
|
ok(player.poster, 'poster exists');
|
|
|
|
ok(player.textTracks, 'textTracks exists');
|
2013-06-24 22:47:47 +03:00
|
|
|
ok(player.requestFullScreen, 'requestFullScreen exists');
|
|
|
|
ok(player.cancelFullScreen, 'cancelFullScreen exists');
|
|
|
|
|
2013-12-10 03:16:09 +03:00
|
|
|
// Unsupported Native HTML5 Methods
|
|
|
|
// ok(player.canPlayType, 'canPlayType exists');
|
|
|
|
// ok(player.readyState, 'readyState exists');
|
|
|
|
// ok(player.networkState, 'networkState exists');
|
|
|
|
// ok(player.startTime, 'startTime exists');
|
|
|
|
// ok(player.defaultPlaybackRate, 'defaultPlaybackRate exists');
|
|
|
|
// ok(player.playbackRate, 'playbackRate exists');
|
|
|
|
// ok(player.played, 'played exists');
|
|
|
|
// ok(player.seekable, 'seekable exists');
|
|
|
|
// ok(player.videoWidth, 'videoWidth exists');
|
|
|
|
// ok(player.videoHeight, 'videoHeight exists');
|
|
|
|
|
|
|
|
// Additional player methods
|
|
|
|
ok(player.bufferedPercent, 'bufferedPercent exists');
|
|
|
|
ok(player.reportUserActivity, 'reportUserActivity exists');
|
|
|
|
ok(player.userActive, 'userActive exists');
|
|
|
|
ok(player.usingNativeControls, 'usingNativeControls exists');
|
|
|
|
ok(player.isFullScreen, 'isFullScreen exists');
|
|
|
|
|
2013-06-24 22:47:47 +03:00
|
|
|
player.dispose();
|
|
|
|
});
|
2013-03-05 23:39:43 +03:00
|
|
|
|
2013-12-19 04:53:43 +03:00
|
|
|
test('should be able to access expected component API methods', function() {
|
2014-02-07 03:54:35 +03:00
|
|
|
var comp = videojs.Component.create({ id: function(){ return 1; }, reportUserActivity: function(){} });
|
2013-12-19 04:53:43 +03:00
|
|
|
|
|
|
|
// Component methods
|
|
|
|
ok(comp.player, 'player exists');
|
|
|
|
ok(comp.options, 'options exists');
|
|
|
|
ok(comp.init, 'init exists');
|
|
|
|
ok(comp.dispose, 'dispose exists');
|
|
|
|
ok(comp.createEl, 'createEl exists');
|
|
|
|
ok(comp.contentEl, 'contentEl exists');
|
|
|
|
ok(comp.el, 'el exists');
|
|
|
|
ok(comp.addChild, 'addChild exists');
|
|
|
|
ok(comp.getChild, 'getChild exists');
|
|
|
|
ok(comp.getChildById, 'getChildById exists');
|
|
|
|
ok(comp.children, 'children exists');
|
|
|
|
ok(comp.initChildren, 'initChildren exists');
|
|
|
|
ok(comp.removeChild, 'removeChild exists');
|
|
|
|
ok(comp.on, 'on exists');
|
|
|
|
ok(comp.off, 'off exists');
|
|
|
|
ok(comp.one, 'one exists');
|
|
|
|
ok(comp.trigger, 'trigger exists');
|
|
|
|
ok(comp.triggerReady, 'triggerReady exists');
|
|
|
|
ok(comp.show, 'show exists');
|
|
|
|
ok(comp.hide, 'hide exists');
|
|
|
|
ok(comp.width, 'width exists');
|
|
|
|
ok(comp.height, 'height exists');
|
|
|
|
ok(comp.dimensions, 'dimensions exists');
|
|
|
|
ok(comp.ready, 'ready exists');
|
|
|
|
ok(comp.addClass, 'addClass exists');
|
|
|
|
ok(comp.removeClass, 'removeClass exists');
|
|
|
|
ok(comp.buildCSSClass, 'buildCSSClass exists');
|
|
|
|
});
|
|
|
|
|
2013-03-05 23:39:43 +03:00
|
|
|
test('should export ready api call to public', function() {
|
|
|
|
var videoTag = PlayerTest.makeTag();
|
|
|
|
|
|
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
|
|
fixture.appendChild(videoTag);
|
|
|
|
|
2013-05-09 19:23:32 +03:00
|
|
|
var player = videojs('example_1');
|
2013-03-05 23:39:43 +03:00
|
|
|
ok(player.ready !== undefined, 'ready callback is defined');
|
|
|
|
player.dispose();
|
|
|
|
});
|
2013-03-06 00:23:01 +03:00
|
|
|
|
2013-08-23 21:15:58 +03:00
|
|
|
test('should export useful components to the public', function () {
|
2014-01-24 02:14:52 +03:00
|
|
|
ok(videojs.TOUCH_ENABLED !== undefined, 'Touch detection should be public');
|
2013-08-23 21:15:58 +03:00
|
|
|
ok(videojs.ControlBar, 'ControlBar should be public');
|
|
|
|
ok(videojs.Button, 'Button should be public');
|
|
|
|
ok(videojs.PlayToggle, 'PlayToggle should be public');
|
|
|
|
ok(videojs.FullscreenToggle, 'FullscreenToggle should be public');
|
|
|
|
ok(videojs.BigPlayButton, 'BigPlayButton should be public');
|
|
|
|
ok(videojs.LoadingSpinner, 'LoadingSpinner should be public');
|
|
|
|
ok(videojs.CurrentTimeDisplay, 'CurrentTimeDisplay should be public');
|
|
|
|
ok(videojs.DurationDisplay, 'DurationDisplay should be public');
|
|
|
|
ok(videojs.TimeDivider, 'TimeDivider should be public');
|
|
|
|
ok(videojs.RemainingTimeDisplay, 'RemainingTimeDisplay should be public');
|
|
|
|
ok(videojs.Slider, 'Slider should be public');
|
|
|
|
ok(videojs.ProgressControl, 'ProgressControl should be public');
|
|
|
|
ok(videojs.SeekBar, 'SeekBar should be public');
|
|
|
|
ok(videojs.LoadProgressBar, 'LoadProgressBar should be public');
|
|
|
|
ok(videojs.PlayProgressBar, 'PlayProgressBar should be public');
|
|
|
|
ok(videojs.SeekHandle, 'SeekHandle should be public');
|
|
|
|
ok(videojs.VolumeControl, 'VolumeControl should be public');
|
|
|
|
ok(videojs.VolumeBar, 'VolumeBar should be public');
|
|
|
|
ok(videojs.VolumeLevel, 'VolumeLevel should be public');
|
|
|
|
ok(videojs.VolumeMenuButton, 'VolumeMenuButton should be public');
|
|
|
|
ok(videojs.VolumeHandle, 'VolumeHandle should be public');
|
|
|
|
ok(videojs.MuteToggle, 'MuteToggle should be public');
|
|
|
|
ok(videojs.PosterImage, 'PosterImage should be public');
|
|
|
|
ok(videojs.Menu, 'Menu should be public');
|
|
|
|
ok(videojs.MenuItem, 'MenuItem should be public');
|
|
|
|
ok(videojs.MenuButton, 'MenuButton should be public');
|
2013-12-03 04:11:08 +03:00
|
|
|
|
|
|
|
ok(videojs.util, 'util namespace should be public');
|
|
|
|
ok(videojs.util.mergeOptions, 'mergeOptions should be public');
|
2013-08-23 21:15:58 +03:00
|
|
|
});
|
|
|
|
|
2013-03-06 00:23:01 +03:00
|
|
|
test('should be able to initialize player twice on the same tag using string reference', function() {
|
|
|
|
var videoTag = PlayerTest.makeTag();
|
|
|
|
var id = videoTag.id;
|
|
|
|
|
|
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
|
|
fixture.appendChild(videoTag);
|
|
|
|
|
2013-05-09 19:23:32 +03:00
|
|
|
var player = videojs('example_1');
|
2013-03-06 00:23:01 +03:00
|
|
|
player.dispose();
|
|
|
|
ok(!document.getElementById(id), 'element is removed');
|
|
|
|
|
|
|
|
videoTag = PlayerTest.makeTag();
|
|
|
|
fixture.appendChild(videoTag);
|
|
|
|
|
2013-05-09 19:23:32 +03:00
|
|
|
player = videojs('example_1');
|
2013-03-06 00:23:01 +03:00
|
|
|
player.dispose();
|
|
|
|
});
|
2013-06-03 23:19:46 +03:00
|
|
|
|
2013-11-26 23:45:45 +03:00
|
|
|
test('videojs.players should be available after minification', function() {
|
2013-06-05 20:27:38 +03:00
|
|
|
var videoTag = PlayerTest.makeTag();
|
|
|
|
var id = videoTag.id;
|
|
|
|
|
|
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
|
|
fixture.appendChild(videoTag);
|
|
|
|
|
|
|
|
var player = videojs(id);
|
2013-08-10 00:29:22 +03:00
|
|
|
ok(videojs.players[id] === player, 'videojs.players is available');
|
2013-06-05 20:27:38 +03:00
|
|
|
|
|
|
|
player.dispose();
|
|
|
|
});
|
2013-11-26 23:46:20 +03:00
|
|
|
|
2013-12-03 04:31:18 +03:00
|
|
|
// NOTE: This test could be removed after we've landed on a permanent
|
|
|
|
// externs/exports strategy. See comment on videojs/video.js#853
|
2013-11-26 23:46:20 +03:00
|
|
|
test('fullscreenToggle does not depend on minified player methods', function(){
|
2013-12-10 03:16:09 +03:00
|
|
|
var noop, player, fullscreen, requestFullScreen, cancelFullScreen, isFullScreen_;
|
2013-11-26 23:46:20 +03:00
|
|
|
noop = function(){};
|
|
|
|
requestFullScreen = false;
|
|
|
|
cancelFullScreen = false;
|
|
|
|
player = {
|
|
|
|
id: noop,
|
|
|
|
on: noop,
|
2014-02-07 03:54:35 +03:00
|
|
|
ready: noop,
|
|
|
|
reportUserActivity: noop
|
2013-11-26 23:46:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
player['requestFullScreen'] = function(){
|
|
|
|
requestFullScreen = true;
|
|
|
|
};
|
|
|
|
player['cancelFullScreen'] = function(){
|
2013-12-10 03:16:09 +03:00
|
|
|
cancelFullScreen = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
isFullScreen_ = false;
|
|
|
|
player['isFullScreen'] = function(){
|
|
|
|
return isFullScreen_;
|
2013-11-26 23:46:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
fullscreen = new videojs.FullscreenToggle(player);
|
|
|
|
fullscreen.trigger('click');
|
|
|
|
|
|
|
|
ok(requestFullScreen, 'requestFullScreen called');
|
|
|
|
|
2013-12-10 03:16:09 +03:00
|
|
|
isFullScreen_ = true;
|
2013-11-26 23:46:20 +03:00
|
|
|
fullscreen.trigger('click');
|
|
|
|
|
|
|
|
ok(cancelFullScreen, 'cancelFullScreen called');
|
|
|
|
});
|