Skip to content

Commit

Permalink
Merge pull request #906 from heff/feature/more-exports
Browse files Browse the repository at this point in the history
Added missing component exports
  • Loading branch information
heff committed Jan 24, 2014
2 parents 6a1c0bd + 024b031 commit a8afe9c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions src/js/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
43 changes: 33 additions & 10 deletions test/unit/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit a8afe9c

Please sign in to comment.