1
0
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:
mister-ben 2017-05-11 22:15:12 +01:00 committed by Gary Katsevman
parent 0a19cf0d6a
commit ae423df4f5
2 changed files with 14 additions and 0 deletions

View File

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

View File

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