1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-12 11:15:04 +02:00
video.js/test/unit/api.js
2013-06-03 13:19:46 -07:00

54 lines
1.4 KiB
JavaScript

module('Player Minified');
var PlayerTest = {
makeTag: function(){
var videoTag = document.createElement('video');
videoTag.id = 'example_1';
videoTag.className = 'video-js vjs-default-skin';
return videoTag;
}
};
test('should export ready api call to public', function() {
var videoTag = PlayerTest.makeTag();
var fixture = document.getElementById('qunit-fixture');
fixture.appendChild(videoTag);
var player = videojs('example_1');
ok(player.ready !== undefined, 'ready callback is defined');
player.dispose();
});
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);
var player = videojs('example_1');
player.dispose();
ok(!document.getElementById(id), 'element is removed');
videoTag = PlayerTest.makeTag();
fixture.appendChild(videoTag);
player = videojs('example_1');
player.dispose();
});
test('requestFullScreen and cancelFullScreen methods should exist', function() {
var videoTag = PlayerTest.makeTag();
var id = videoTag.id;
var fixture = document.getElementById('qunit-fixture');
fixture.appendChild(videoTag);
var player = videojs('example_1');
ok(player.requestFullScreen, 'requestFullScreen exists');
ok(player.requestFullScreen, 'cancelFullScreen exists');
player.dispose();
});