1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

fix(videojs): missing return in registerComponent (#8247)

This commit is contained in:
André 2023-05-12 18:23:27 +02:00 committed by GitHub
parent 866ef24b79
commit f1558c660b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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);