-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: lint to code to vjs 7 standards (#433)
* chore: lint to code to vjs 7 standards * travis * update vjsstandard to disable jsdoc rules * update to vjs standard 8
- Loading branch information
1 parent
fc5bf22
commit df10d45
Showing
39 changed files
with
736 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ dist/ | |
docs/api/ | ||
test/dist/ | ||
examples/module-import/bundle.js | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,16 @@ | ||
sudo: false | ||
dist: trusty | ||
language: node_js | ||
node_js: | ||
- 'node' | ||
- 'lts/argon' | ||
# node version is specified using the .nvmrc file | ||
before_install: | ||
- npm install -g greenkeeper-lockfile@1 | ||
before_script: | ||
|
||
# Check if the current version is equal to the major version for the env. | ||
- 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"' | ||
|
||
# We have to add semicolons to the end of each line in the if as Travis runs | ||
# this all on one line. | ||
- 'if [ -z "$IS_INSTALLED" ]; then | ||
echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0"; | ||
npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0"; | ||
else | ||
echo "video.js@$VJS ALREADY INSTALLED"; | ||
fi' | ||
- export CHROME_BIN=/usr/bin/google-chrome | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
env: | ||
- VJS=5 | ||
- VJS=6 | ||
- greenkeeper-lockfile-update | ||
after_script: | ||
- greenkeeper-lockfile-upload | ||
addons: | ||
firefox: latest | ||
apt: | ||
sources: | ||
- google-chrome | ||
packages: | ||
- google-chrome-stable | ||
chrome: stable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,95 @@ | ||
/* | ||
* Composes per-module `beforeEach` and `afterEach` hooks with common/shared | ||
* hooks. | ||
* | ||
* @param {Object} [hooks] | ||
* @param {Function} [hooks.beforeEach] | ||
* @param {Function} [hooks.afterEach] | ||
* @return {Object} | ||
*/ | ||
window.sharedModuleHooks = (function(){ | ||
var Html5 = videojs.getTech('Html5'); | ||
import videojs from 'video.js'; | ||
import sinon from 'sinon'; | ||
import document from 'global/document'; | ||
import window from 'global/window'; | ||
import _ from 'lodash'; | ||
|
||
var backup = { | ||
Html5: { | ||
isSupported: Html5.isSupported, | ||
setSource: Html5.prototype.setSource | ||
} | ||
}; | ||
const Html5 = videojs.getTech('Html5'); | ||
|
||
var common = { | ||
const backup = { | ||
Html5: { | ||
isSupported: Html5.isSupported, | ||
setSource: Html5.prototype.setSource | ||
} | ||
}; | ||
|
||
beforeEach: function() { | ||
const common = { | ||
|
||
// Fake HTML 5 support. | ||
Html5.isSupported = function() { | ||
return true; | ||
}; | ||
beforeEach() { | ||
|
||
delete Html5.setSource; | ||
// Fake HTML 5 support. | ||
Html5.isSupported = function() { | ||
return true; | ||
}; | ||
|
||
delete Html5.setSource; | ||
|
||
this.sandbox = sinon.sandbox.create(); | ||
this.sandbox = sinon.sandbox.create(); | ||
|
||
// Use fake timers to replace setTimeout and so forth. | ||
this.clock = sinon.useFakeTimers(); | ||
// Use fake timers to replace setTimeout and so forth. | ||
this.clock = sinon.useFakeTimers(); | ||
|
||
// Create video element and player. | ||
this.video = document.createElement('video'); | ||
// Create video element and player. | ||
this.video = document.createElement('video'); | ||
|
||
// backfill broken phantom implementation(s) | ||
if (/phantom/i.test(window.navigator.userAgent)) { | ||
this.video.removeAttribute = function(attr) { | ||
this[attr] = ''; | ||
}; | ||
this.video.load = function(){}; | ||
this.video.play = function(){}; | ||
this.video.pause = function(){}; | ||
} | ||
// backfill broken phantom implementation(s) | ||
if (/phantom/i.test(window.navigator.userAgent)) { | ||
this.video.removeAttribute = function(attr) { | ||
this[attr] = ''; | ||
}; | ||
this.video.load = function() {}; | ||
this.video.play = function() {}; | ||
this.video.pause = function() {}; | ||
} | ||
|
||
document.getElementById('qunit-fixture').appendChild(this.video); | ||
document.getElementById('qunit-fixture').appendChild(this.video); | ||
|
||
this.player = videojs(this.video); | ||
this.player = videojs(this.video); | ||
|
||
// Tick the clock because videojs player creation is now async. | ||
this.clock.tick(1000); | ||
// Tick the clock because videojs player creation is now async. | ||
this.clock.tick(1000); | ||
|
||
this.player.buffered = function() { | ||
return videojs.createTimeRange(0, 0); | ||
}; | ||
this.player.buffered = function() { | ||
return videojs.createTimeRange(0, 0); | ||
}; | ||
|
||
this.player.ads(this.adsOptions); | ||
}, | ||
this.player.ads(this.adsOptions); | ||
}, | ||
|
||
afterEach: function() { | ||
afterEach() { | ||
|
||
// Restore original state of the Html5 component. | ||
Html5.isSupported = backup.Html5.isSupported; | ||
Html5.prototype.setSource = backup.Html5.setSource; | ||
// Restore original state of the Html5 component. | ||
Html5.isSupported = backup.Html5.isSupported; | ||
Html5.prototype.setSource = backup.Html5.setSource; | ||
|
||
// Restore setTimeout et al. | ||
this.clock.restore(); | ||
// Restore setTimeout et al. | ||
this.clock.restore(); | ||
|
||
// Kill the player and its element (i.e. `this.video`). | ||
this.player.dispose(); | ||
// Kill the player and its element (i.e. `this.video`). | ||
this.player.dispose(); | ||
|
||
// Kill the "contentplayback" spy. | ||
this.contentPlaybackSpy = this.contentPlaybackReason = null; | ||
// Kill the "contentplayback" spy. | ||
this.contentPlaybackSpy = this.contentPlaybackReason = null; | ||
|
||
this.sandbox.restore(); | ||
} | ||
}; | ||
this.sandbox.restore(); | ||
} | ||
}; | ||
|
||
return function(hooks) { | ||
hooks = hooks || {}; | ||
return { | ||
beforeEach: _.flow(common.beforeEach, hooks.beforeEach || _.noop), | ||
afterEach: _.flow(common.afterEach, hooks.afterEach || _.noop) | ||
}; | ||
/* | ||
* Composes per-module `beforeEach` and `afterEach` hooks with common/shared | ||
* hooks. | ||
* | ||
* @param {Object} [hooks] | ||
* @param {Function} [hooks.beforeEach] | ||
* @param {Function} [hooks.afterEach] | ||
* @return {Object} | ||
*/ | ||
const sharedModuleHooks = function(hooks) { | ||
hooks = hooks || {}; | ||
return { | ||
beforeEach: _.flow(common.beforeEach, hooks.beforeEach || _.noop), | ||
afterEach: _.flow(common.afterEach, hooks.afterEach || _.noop) | ||
}; | ||
}()); | ||
}; | ||
|
||
export default sharedModuleHooks; |
Oops, something went wrong.