@@ -115,6 +115,49 @@ const setupAfterEach = function(totalSourcesets) {
115
115
const testTypes = [ 'video el' , 'change video el' , 'audio el' , 'change audio el' , 'video-js' , 'change video-js el' ] ;
116
116
117
117
QUnit [ qunitFn ] ( 'sourceset' , function ( hooks ) {
118
+ QUnit . module ( 'sourceset option' , ( subhooks ) => testTypes . forEach ( ( testName ) => {
119
+ QUnit . module ( testName , {
120
+ beforeEach ( ) {
121
+
122
+ setupEnv ( this , testName ) ;
123
+ } ,
124
+ afterEach : setupAfterEach ( 1 )
125
+ } ) ;
126
+
127
+ QUnit . test ( 'sourceset enabled by default' , function ( assert ) {
128
+ const done = assert . async ( ) ;
129
+
130
+ this . mediaEl . setAttribute ( 'data-setup' , JSON . stringify ( { sources : [ testSrc ] } ) ) ;
131
+ this . player = videojs ( this . mediaEl , { } ) ;
132
+
133
+ this . player . one ( 'sourceset' , ( e ) => {
134
+ validateSource ( this . player , [ testSrc ] , e ) ;
135
+ done ( ) ;
136
+ } ) ;
137
+ } ) ;
138
+
139
+ QUnit . test ( 'sourceset not triggered if turned off' , function ( assert ) {
140
+ const done = assert . async ( ) ;
141
+
142
+ this . player = videojs ( this . mediaEl , {
143
+ enableSourceset : false
144
+ } ) ;
145
+
146
+ this . totalSourcesets = 0 ;
147
+
148
+ this . player . one ( 'sourceset' , ( e ) => {
149
+ this . totalSourcesets = 1 ;
150
+ } ) ;
151
+
152
+ this . player . on ( 'loadstart' , ( ) => {
153
+ done ( ) ;
154
+ } ) ;
155
+
156
+ this . player . src ( testSrc ) ;
157
+
158
+ } ) ;
159
+ } ) ) ;
160
+
118
161
QUnit . module ( 'source before player' , ( subhooks ) => testTypes . forEach ( ( testName ) => {
119
162
QUnit . module ( testName , {
120
163
beforeEach ( ) {
0 commit comments