1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

Close GH-588: Export bufferedPercent.

This commit is contained in:
Steve Heffernan 2013-06-24 12:47:47 -07:00
parent 19a33cc7c7
commit 1ddef27903
6 changed files with 51 additions and 44 deletions

View File

@ -61,6 +61,7 @@ goog.exportSymbol('videojs.Player', vjs.Player);
goog.exportProperty(vjs.Player.prototype, 'dispose', vjs.Player.prototype.dispose);
goog.exportProperty(vjs.Player.prototype, 'requestFullScreen', vjs.Player.prototype.requestFullScreen);
goog.exportProperty(vjs.Player.prototype, 'cancelFullScreen', vjs.Player.prototype.cancelFullScreen);
goog.exportProperty(vjs.Player.prototype, 'bufferedPercent', vjs.Player.prototype.bufferedPercent);
goog.exportSymbol('videojs.MediaLoader', vjs.MediaLoader);
goog.exportSymbol('videojs.TextTrackDisplay', vjs.TextTrackDisplay);

View File

@ -19,6 +19,7 @@
// ADD NEW TEST FILES HERE
window.tests = [
'test/unit/test-helpers.js',
'test/unit/core-object.js',
'test/unit/lib.js',
'test/unit/events.js',

View File

@ -18,6 +18,7 @@
// ADD NEW TEST FILES HERE
var tests = [
'test/unit/test-helpers.js',
'test/unit/api.js'
];
var projectRoot = '../';

View File

@ -1,13 +1,33 @@
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 be able to access expected player API methods', function() {
var player = PlayerTest.makePlayer();
// Native HTML5 Methods
ok(player.play, 'play exists');
ok(player.pause, 'pause exists');
ok(player.paused, 'paused exists');
ok(player.src, 'src exists');
ok(player.currentTime, 'currentTime exists');
ok(player.duration, 'duration exists');
ok(player.buffered, 'buffered exists');
ok(player.volume, 'volume exists');
ok(player.muted, 'muted exists');
ok(player.width, 'width exists');
ok(player.height, 'height exists');
ok(player.requestFullScreen, 'requestFullScreen exists');
ok(player.cancelFullScreen, 'cancelFullScreen exists');
// Added player methods
ok(player.ready, 'ready exists');
ok(player.on, 'on exists');
ok(player.off, 'off exists');
ok(player.one, 'one exists');
ok(player.bufferedPercent, 'bufferedPercent exists');
ok(player.dimensions, 'dimensions exists');
player.dispose();
});
test('should export ready api call to public', function() {
var videoTag = PlayerTest.makeTag();
@ -38,20 +58,6 @@ test('should be able to initialize player twice on the same tag using string ref
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();
});
test('videojs.players should be availble after minification', function() {
var videoTag = PlayerTest.makeTag();
var id = videoTag.id;

View File

@ -1,27 +1,5 @@
module('Player');
var PlayerTest = {
makeTag: function(){
var videoTag = document.createElement('video');
videoTag.id = 'example_1';
videoTag.className = 'video-js vjs-default-skin';
return videoTag;
},
makePlayer: function(playerOptions){
var player;
var videoTag = PlayerTest.makeTag();
var fixture = document.getElementById('qunit-fixture');
fixture.appendChild(videoTag);
var opts = vjs.obj.merge({
'techOrder': ['mediaFaker']
}, playerOptions);
return player = new vjs.Player(videoTag, opts);
}
};
// Compiler doesn't like using 'this' in setup/teardown.
// module("Player", {
// /**

20
test/unit/test-helpers.js Normal file
View File

@ -0,0 +1,20 @@
var PlayerTest = {
makeTag: function(){
var videoTag = document.createElement('video');
videoTag.id = 'example_1';
videoTag.className = 'video-js vjs-default-skin';
return videoTag;
},
makePlayer: function(playerOptions){
var player;
var videoTag = PlayerTest.makeTag();
var fixture = document.getElementById('qunit-fixture');
fixture.appendChild(videoTag);
playerOptions = playerOptions || {};
playerOptions['techOrder'] = ['mediaFaker'];
return player = new videojs.Player(videoTag, playerOptions);
}
};