mirror of
https://github.com/videojs/video.js.git
synced 2025-01-23 11:04:59 +02:00
@dmlap added an error message if techOrder is not in options. closes #2097
This commit is contained in:
parent
f7b1492332
commit
b5968f13e2
@ -20,6 +20,7 @@ CHANGELOG
|
||||
* @forbesjo added a vjs-button class to button controls ([view](https://github.com/videojs/video.js/pull/2084))
|
||||
* @bc-bbay Load plugins before controls ([view](https://github.com/videojs/video.js/pull/2094))
|
||||
* @bc-bbay rename onEvent methods to handleEvent ([view](https://github.com/videojs/video.js/pull/2093))
|
||||
* @dmlap added an error message if techOrder is not in options ([view](https://github.com/videojs/video.js/pull/2097))
|
||||
|
||||
--------------------
|
||||
|
||||
|
38
Gruntfile.js
38
Gruntfile.js
@ -269,19 +269,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
build: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
],
|
||||
transform: [
|
||||
require('babelify').configure({
|
||||
sourceMapRelative: './src/js'
|
||||
@ -295,6 +283,29 @@ module.exports = function(grunt) {
|
||||
version: version.majorMinor
|
||||
}]
|
||||
]
|
||||
},
|
||||
build: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
]
|
||||
}
|
||||
},
|
||||
test: {
|
||||
files: {
|
||||
'build/temp/tests.js': [
|
||||
'test/globals-shim.js',
|
||||
'test/unit/**/*.js',
|
||||
'test/api/**.js'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -307,6 +318,9 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
coveralls: {
|
||||
options: {
|
||||
force: true
|
||||
},
|
||||
all: {
|
||||
src: 'test/coverage/lcov.info'
|
||||
}
|
||||
|
@ -76,6 +76,17 @@ class Player extends Component {
|
||||
// Run base component initializing with new options
|
||||
super(null, options, ready);
|
||||
|
||||
|
||||
// if the global option object was accidentally blown away by
|
||||
// someone, bail early with an informative error
|
||||
if (!this.options_ ||
|
||||
!this.options_.techOrder ||
|
||||
!this.options_.techOrder.length) {
|
||||
throw new Error('No techOrder specified. Did you overwrite ' +
|
||||
'videojs.options instead of just changing the ' +
|
||||
'properties you want to override?');
|
||||
}
|
||||
|
||||
this.tag = tag; // Store the original tag used to set options
|
||||
|
||||
// Store the tag attributes used to restore html5 element
|
||||
|
10
test/globals-shim.js
Normal file
10
test/globals-shim.js
Normal file
@ -0,0 +1,10 @@
|
||||
import window from 'global/window';
|
||||
import sinon from 'sinon';
|
||||
|
||||
window.q = QUnit;
|
||||
window.sinon = sinon;
|
||||
|
||||
// This may not be needed anymore, but double check before removing
|
||||
window.fixture = document.createElement('div');
|
||||
fixture.id = 'qunit-fixture';
|
||||
document.body.appendChild(fixture);
|
15
test/index.html
Normal file
15
test/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>VideoJS Tests</title>
|
||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||
<link rel="stylesheet" href="../build/temp/video-js.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="../build/temp/tests.js"></script>
|
||||
<script src="api/api.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +0,0 @@
|
||||
var q = QUnit;
|
||||
|
||||
// This may not be needed anymore, but double check before removing
|
||||
var fixture = document.createElement('div');
|
||||
fixture.id = 'qunit-fixture';
|
||||
document.body.appendChild(fixture);
|
@ -50,20 +50,16 @@ module.exports = function(config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
|
||||
frameworks: ['browserify', 'qunit', 'sinon'],
|
||||
frameworks: ['browserify', 'qunit'],
|
||||
|
||||
autoWatch: false,
|
||||
|
||||
singleRun: true,
|
||||
|
||||
// customLaunchers: customLaunchers,
|
||||
|
||||
files: [
|
||||
'../build/temp/video-js.min.css',
|
||||
'../test/karma-qunit-shim.js',
|
||||
'../test/unit/**/*.js',
|
||||
'../build/temp/video.min.js',
|
||||
'../test/api/**/*.js',
|
||||
'../build/temp/tests.js',
|
||||
],
|
||||
|
||||
preprocessors: {
|
||||
@ -84,7 +80,6 @@ module.exports = function(config) {
|
||||
'karma-phantomjs-launcher',
|
||||
'karma-safari-launcher',
|
||||
'karma-sauce-launcher',
|
||||
'karma-sinon',
|
||||
'karma-browserify',
|
||||
'karma-coverage'
|
||||
],
|
||||
|
@ -717,3 +717,14 @@ test('should be scrubbing while seeking', function(){
|
||||
equal(player.scrubbing(), true, 'player is scrubbing');
|
||||
ok(player.el().className.indexOf('scrubbing') !== -1, 'scrubbing class is present');
|
||||
});
|
||||
|
||||
test('should throw on startup no techs are specified', function() {
|
||||
const techOrder = Options.techOrder;
|
||||
|
||||
Options.techOrder = null;
|
||||
q.throws(function() {
|
||||
videojs(TestHelpers.makeTag());
|
||||
}, 'a falsey techOrder should throw');
|
||||
|
||||
Options.techOrder = techOrder;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user