File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -413,6 +413,11 @@ class Player extends Component {
413413 // Make player easily findable by ID
414414 Player . players [ this . id_ ] = this ;
415415
416+ // Add a major version class to aid css in plugins
417+ const majorVersion = require ( '../../package.json' ) . version . split ( '.' ) [ 0 ] ;
418+
419+ this . addClass ( `vjs-v${ majorVersion } ` ) ;
420+
416421 // When the player is first initialized, trigger activity so components
417422 // like the control bar show themselves if needed
418423 this . userActive ( true ) ;
Original file line number Diff line number Diff line change @@ -1387,3 +1387,12 @@ QUnit.test('should not allow to register custom player when any player has been
13871387 // reset the Player to the original value;
13881388 videojs . registerComponent ( 'Player' , Player ) ;
13891389} ) ;
1390+
1391+ QUnit . test ( 'should add a class with major version' , function ( assert ) {
1392+ const majorVersion = require ( '../../package.json' ) . version . split ( '.' ) [ 0 ] ;
1393+ const player = TestHelpers . makePlayer ( ) ;
1394+
1395+ assert . ok ( player . hasClass ( 'vjs-v' + majorVersion ) , 'the version class should be added to the player' ) ;
1396+
1397+ player . dispose ( ) ;
1398+ } ) ;
You can’t perform that action at this time.
0 commit comments