mirror of
https://github.com/videojs/video.js.git
synced 2025-04-07 07:19:54 +02:00
feat: Add a version class to the player (#4320)
Adds `vjs-v6` class so you can target that version of Video.js.
This commit is contained in:
parent
0a19cf0d6a
commit
ae423df4f5
@ -442,6 +442,11 @@ class Player extends Component {
|
||||
// Make player easily findable by ID
|
||||
Player.players[this.id_] = this;
|
||||
|
||||
// Add a major version class to aid css in plugins
|
||||
const majorVersion = require('../../package.json').version.split('.')[0];
|
||||
|
||||
this.addClass(`vjs-v${majorVersion}`);
|
||||
|
||||
// When the player is first initialized, trigger activity so components
|
||||
// like the control bar show themselves if needed
|
||||
this.userActive(true);
|
||||
|
@ -1617,3 +1617,12 @@ QUnit.test('options: plugins', function(assert) {
|
||||
player.dispose();
|
||||
Plugin.deregisterPlugin('foo');
|
||||
});
|
||||
|
||||
QUnit.test('should add a class with major version', function(assert) {
|
||||
const majorVersion = require('../../package.json').version.split('.')[0];
|
||||
const player = TestHelpers.makePlayer();
|
||||
|
||||
assert.ok(player.hasClass('vjs-v' + majorVersion), 'the version class should be added to the player');
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user