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

fix(videojs): missing return in registerComponent #8247

Merged
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
2 changes: 1 addition & 1 deletion src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ videojs.registerComponent = (name, comp) => {
log.warn(`The ${name} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);
}

Component.registerComponent.call(Component, name, comp);
return Component.registerComponent.call(Component, name, comp);
};

videojs.getTech = Tech.getTech;
Expand Down
6 changes: 6 additions & 0 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,12 @@ QUnit.test('When VIDEOJS_NO_DYNAMIC_STYLE is set, apply sizing directly to the t
window.VIDEOJS_NO_DYNAMIC_STYLE = originalVjsNoDynamicStyling;
});

QUnit.test('should return the registered component', function(assert) {
class CustomPlayer extends Player {}

assert.strictEqual(videojs.registerComponent('CustomPlayer', CustomPlayer), CustomPlayer, 'the component is returned');
});

QUnit.test('should allow to register custom player when any player has not been created', function(assert) {
class CustomPlayer extends Player {}
videojs.registerComponent('Player', CustomPlayer);
Expand Down