Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing component exports #906

Merged
merged 1 commit into from
Jan 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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