1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-27 02:43:45 +02:00

Added missing component exports. fixes #903

This commit is contained in:
Steve Heffernan 2013-12-18 17:53:43 -08:00
parent 950072ad97
commit 024b031646
3 changed files with 45 additions and 10 deletions

View File

@ -687,6 +687,9 @@ vjs.Component.prototype.unlockShowing = function(){
/**
* Disable component by making it unshowable
*
* Currently private because we're movign towards more css-based states.
* @private
*/
vjs.Component.prototype.disable = function(){
this.hide();

View File

@ -39,12 +39,20 @@ goog.exportSymbol('videojs.cache', vjs.cache);
// goog.exportProperty(vjs.CoreObject, 'create', vjs.CoreObject.create);
goog.exportSymbol('videojs.Component', vjs.Component);
// already in default externs: id, name
goog.exportProperty(vjs.Component.prototype, 'player', vjs.Component.prototype.player);
goog.exportProperty(vjs.Component.prototype, 'options', vjs.Component.prototype.options);
goog.exportProperty(vjs.Component.prototype, 'init', vjs.Component.prototype.init);
goog.exportProperty(vjs.Component.prototype, 'dispose', vjs.Component.prototype.dispose);
goog.exportProperty(vjs.Component.prototype, 'createEl', vjs.Component.prototype.createEl);
goog.exportProperty(vjs.Component.prototype, 'contentEl', vjs.Component.prototype.contentEl);
goog.exportProperty(vjs.Component.prototype, 'el', vjs.Component.prototype.el);
goog.exportProperty(vjs.Component.prototype, 'addChild', vjs.Component.prototype.addChild);
goog.exportProperty(vjs.Component.prototype, 'getChild', vjs.Component.prototype.getChild);
goog.exportProperty(vjs.Component.prototype, 'getChildById', vjs.Component.prototype.getChildById);
goog.exportProperty(vjs.Component.prototype, 'children', vjs.Component.prototype.children);
goog.exportProperty(vjs.Component.prototype, 'initChildren', vjs.Component.prototype.initChildren);
goog.exportProperty(vjs.Component.prototype, 'removeChild', vjs.Component.prototype.removeChild);
goog.exportProperty(vjs.Component.prototype, 'on', vjs.Component.prototype.on);
goog.exportProperty(vjs.Component.prototype, 'off', vjs.Component.prototype.off);
goog.exportProperty(vjs.Component.prototype, 'one', vjs.Component.prototype.one);
@ -58,6 +66,7 @@ goog.exportProperty(vjs.Component.prototype, 'dimensions', vjs.Component.prototy
goog.exportProperty(vjs.Component.prototype, 'ready', vjs.Component.prototype.ready);
goog.exportProperty(vjs.Component.prototype, 'addClass', vjs.Component.prototype.addClass);
goog.exportProperty(vjs.Component.prototype, 'removeClass', vjs.Component.prototype.removeClass);
goog.exportProperty(vjs.Component.prototype, 'buildCSSClass', vjs.Component.prototype.buildCSSClass);
// Need to export ended to ensure it's not removed by CC, since it's not used internally
goog.exportProperty(vjs.Player.prototype, 'ended', vjs.Player.prototype.ended);

View File

@ -47,19 +47,42 @@ test('should be able to access expected player API methods', function() {
ok(player.usingNativeControls, 'usingNativeControls exists');
ok(player.isFullScreen, 'isFullScreen exists');
// Component methods
ok(player.ready, 'ready exists');
ok(player.on, 'on exists');
ok(player.off, 'off exists');
ok(player.one, 'one exists');
ok(player.dimensions, 'dimensions exists');
ok(player.addClass, 'addClass exists');
ok(player.removeClass, 'removeClass exists');
ok(player.dispose, 'dispose exists');
player.dispose();
});
test('should be able to access expected component API methods', function() {
var comp = videojs.Component.create({ id: function(){ return 1; } });
// Component methods
ok(comp.player, 'player exists');
ok(comp.options, 'options exists');
ok(comp.init, 'init exists');
ok(comp.dispose, 'dispose exists');
ok(comp.createEl, 'createEl exists');
ok(comp.contentEl, 'contentEl exists');
ok(comp.el, 'el exists');
ok(comp.addChild, 'addChild exists');
ok(comp.getChild, 'getChild exists');
ok(comp.getChildById, 'getChildById exists');
ok(comp.children, 'children exists');
ok(comp.initChildren, 'initChildren exists');
ok(comp.removeChild, 'removeChild exists');
ok(comp.on, 'on exists');
ok(comp.off, 'off exists');
ok(comp.one, 'one exists');
ok(comp.trigger, 'trigger exists');
ok(comp.triggerReady, 'triggerReady exists');
ok(comp.show, 'show exists');
ok(comp.hide, 'hide exists');
ok(comp.width, 'width exists');
ok(comp.height, 'height exists');
ok(comp.dimensions, 'dimensions exists');
ok(comp.ready, 'ready exists');
ok(comp.addClass, 'addClass exists');
ok(comp.removeClass, 'removeClass exists');
ok(comp.buildCSSClass, 'buildCSSClass exists');
});
test('should export ready api call to public', function() {
var videoTag = PlayerTest.makeTag();