diff --git a/src/js/exports.js b/src/js/exports.js index 9661bc681..60c5431d9 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -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); diff --git a/test/index.html b/test/index.html index fe9487a96..29ae4b15d 100644 --- a/test/index.html +++ b/test/index.html @@ -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', diff --git a/test/minified-api.html b/test/minified-api.html index 8fc3c310e..e4340c379 100644 --- a/test/minified-api.html +++ b/test/minified-api.html @@ -18,6 +18,7 @@ // ADD NEW TEST FILES HERE var tests = [ + 'test/unit/test-helpers.js', 'test/unit/api.js' ]; var projectRoot = '../'; diff --git a/test/unit/api.js b/test/unit/api.js index 9f989bd87..98970dc9a 100644 --- a/test/unit/api.js +++ b/test/unit/api.js @@ -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; diff --git a/test/unit/player.js b/test/unit/player.js index 0aebcdd25..c68d29099 100644 --- a/test/unit/player.js +++ b/test/unit/player.js @@ -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", { // /** diff --git a/test/unit/test-helpers.js b/test/unit/test-helpers.js new file mode 100644 index 000000000..211b943db --- /dev/null +++ b/test/unit/test-helpers.js @@ -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); + } +}; \ No newline at end of file