1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-25 11:13:52 +02:00

ready method exposed in minified version

test case for minified lib and not minified code
This commit is contained in:
Alex Vasilenko 2013-03-05 22:39:43 +02:00 committed by avasilenko
parent 29297bd37b
commit 2de8ad6f63
4 changed files with 70 additions and 2 deletions

View File

@ -37,7 +37,7 @@ module.exports = function(grunt) {
dest: 'build/files/minified.video.js'
},
tests: {
src: ['build/files/combined.video.js', 'test/unit/*.js'],
src: ['build/files/combined.video.js', 'test/unit/*.js', '!test/unit/minified.js'],
externs: ['src/js/media.flash.externs.js', 'test/qunit/qunit-externs.js'],
dest: 'build/files/test.minified.video.js'
}
@ -45,7 +45,8 @@ module.exports = function(grunt) {
dist: {},
qunit: {
source: ['test/index.html'],
minified: ['test/minified.html']
minified: ['test/minified.html'],
minified_lib: ['test/minified-lib.html']
},
watch: {
files: [ 'src/**/*.js', 'test/unit/*.js' ],

View File

@ -48,6 +48,7 @@ goog.exportProperty(vjs.Component.prototype, 'hide', vjs.Component.prototype.hid
goog.exportProperty(vjs.Component.prototype, 'width', vjs.Component.prototype.width);
goog.exportProperty(vjs.Component.prototype, 'height', vjs.Component.prototype.height);
goog.exportProperty(vjs.Component.prototype, 'dimensions', vjs.Component.prototype.dimensions);
goog.exportProperty(vjs.Component.prototype, 'ready', vjs.Component.prototype.ready);
goog.exportSymbol('videojs.Player', vjs.Player);

45
test/minified-lib.html Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video.js Test Suite</title>
<!-- QUnit -->
<link rel="stylesheet" href="../test/qunit/qunit/qunit.css" />
<script src="../test/qunit/qunit/qunit.js"></script>
<!-- Video.js CSS -->
<link rel="stylesheet" href="../src/css/video-js.css" type="text/css">
<!-- LIB COMPILED WITH NOT COMPILED TESTS
Check publicly available APIs against compiled lib
-->
<script type="text/javascript">
(function(){
// ADD NEW TEST FILES HERE
var tests = [
'test/unit/minified.js'
];
var projectRoot = '../';
var scripts = [];
scripts = scripts.concat(['build/files/minified.video.js'], tests);
for (var i = 0; i < scripts.length; i++) {
document.write( "<script src='" + projectRoot + scripts[i] + "'><\/script>" );
}
})()
</script>
</head>
<body>
<div>
<h1 id="qunit-header">Video.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</div>
</body>
</html>

21
test/unit/minified.js Normal file
View File

@ -0,0 +1,21 @@
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 = _V_('example_1');
ok(player.ready !== undefined, 'ready callback is defined');
player.dispose();
});