Skip to content

Commit

Permalink
Merge branch 'hotfix/player-externs' of git://github.com/dmlap/video-…
Browse files Browse the repository at this point in the history
…js into dmlap-hotfix/player-externs

Conflicts:
	Gruntfile.js
  • Loading branch information
heff committed Dec 3, 2013
2 parents 522f45f + 7efcbd5 commit c23ca52
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ module.exports = function(grunt) {
minify: {
source:{
src: ['build/files/combined.video.js', 'build/compiler/goog.base.js', 'src/js/exports.js'],
externs: ['src/js/media/flash.externs.js'],
externs: ['src/js/player.externs.js', 'src/js/media/flash.externs.js'],
dest: 'build/files/minified.video.js'
},
tests: {
src: ['build/files/combined.video.js', 'build/compiler/goog.base.js', 'src/js/exports.js', 'test/unit/*.js', '!test/unit/api.js'],
externs: ['src/js/media/flash.externs.js', 'test/qunit-externs.js'],
externs: ['src/js/player.externs.js', 'src/js/media/flash.externs.js', 'test/qunit-externs.js'],
dest: 'build/files/test.minified.video.js'
}
},
Expand Down
11 changes: 11 additions & 0 deletions src/js/player.externs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @fileoverview Externs for videojs.Player. Externs are functions that the
* compiler shouldn't obfuscate.
*/

/**
* Fullscreen functionality
*/
videojs.Player.prototype.isFullScreen = undefined;
videojs.Player.prototype.requestFullScreen = function(){};
videojs.Player.prototype.cancelFullScreen = function(){};
32 changes: 31 additions & 1 deletion test/unit/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test('should be able to initialize player twice on the same tag using string ref
player.dispose();
});

test('videojs.players should be availble after minification', function() {
test('videojs.players should be available after minification', function() {
var videoTag = PlayerTest.makeTag();
var id = videoTag.id;

Expand All @@ -106,3 +106,33 @@ test('videojs.players should be availble after minification', function() {

player.dispose();
});

test('fullscreenToggle does not depend on minified player methods', function(){
var noop, player, fullscreen, requestFullScreen, cancelFullScreen;
noop = function(){};
requestFullScreen = false;
cancelFullScreen = false;
player = {
id: noop,
on: noop,
ready: noop
};

player['requestFullScreen'] = function(){
requestFullScreen = true;
};
player['cancelFullScreen'] = function(){
cancelFullScreen = true;
};
player['isFullScreen'] = false;

fullscreen = new videojs.FullscreenToggle(player);
fullscreen.trigger('click');

ok(requestFullScreen, 'requestFullScreen called');

player.isFullScreen = true;
fullscreen.trigger('click');

ok(cancelFullScreen, 'cancelFullScreen called');
});

0 comments on commit c23ca52

Please sign in to comment.