From f1558c660bbc132b23dbd63b2f3cdf7b6e60d00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <34163393+amtins@users.noreply.github.com> Date: Fri, 12 May 2023 18:23:27 +0200 Subject: [PATCH] fix(videojs): missing return in registerComponent (#8247) --- src/js/video.js | 2 +- test/unit/player.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/video.js b/src/js/video.js index d271362c0f..2734cf08df 100644 --- a/src/js/video.js +++ b/src/js/video.js @@ -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; diff --git a/test/unit/player.test.js b/test/unit/player.test.js index 09e69e773d..9831b0090d 100644 --- a/test/unit/player.test.js +++ b/test/unit/player.test.js @@ -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);