Skip to content

Commit

Permalink
Redtest: no source tests
Browse files Browse the repository at this point in the history
Blocked by vimeo/player.js#166

#5 Test vimeo
  • Loading branch information
LoveIsGrief committed Oct 1, 2017
1 parent 62bef3e commit f65e1ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
43 changes: 5 additions & 38 deletions src/tech/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ class Vimeo extends Externals {
// When the player is setup incorrectly the first time, we need to re-init
// Vimeo leaves its player in a bad state dependent on our element, so we just recreate it
// and get a new vimeo player... super hacky
let parent = this.el_.parentNode;
parent.removeChild(this.el_);
parent.appendChild(this.createEl());
this.options_.source = src;
this.initTech();
this.one('ready', () => {
// Simulate event from iframe when we're ready in order to trigger all necessary events
this.onStateChange({type: "loaded"})
})
} else {
this.src_ = src;
this.widgetPlayer.loadVideo(this.parseSrc(src)).catch((error) => {
Expand All @@ -67,36 +68,6 @@ class Vimeo extends Externals {
return window['Vimeo'] && window['Vimeo']['Player'];
}

addScriptTag() {
var self = this;
if (window['requirejs']) {
let requirejs = window['requirejs'];
requirejs([this.options_.api], function (Vimeo) {
window['Vimeo'] = {Player: Vimeo};
self.initTech();
});
} else {
var r = false,
d = document,
s = d.getElementsByTagName('head')[0] || d.documentElement;
var js = d.createElement('script');
js.async = true;
js.type = 'text/javascript';
js.onload = js.onreadystatechange = function () {
var rs = this.readyState;
if (!r && (!rs || /loaded|complete/.test(rs))) {
r = true;
// Handle memory leak in IE
js.onload = js.onreadystatechange = null;
self.initTech();
}
};

js.src = this.options_.api;
s.insertBefore(js, s.firstChild);
}
}

initTech() {
if (!this.isApiReady()) {
return;
Expand All @@ -115,15 +86,11 @@ class Vimeo extends Externals {
this.widgetPlayer.ready().then(videojs.bind(this, this.onReady)).catch((error) => {
this.widgetPlayer.unload();
this.error(error.message);
super.onReady();
this.onReady();
});
super.initTech();
}

onReady() {
super.onReady();
}

setupTriggers() {
this.widgetPlayer.vjsTech = this;
for (var i = Vimeo.Events.length - 1; i >= 0; i--) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/vimeo.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const stringSourceTestSuiteGenerator = new StringSourceTestSuiteGenerator(

var testFactory = new MainTestFactory(basicConfiguration);

testFactory.addTestSuiteFactory(htmlSourceTestSuiteGenerator);
// testFactory.addTestSuiteFactory(noSourceTestSuiteGenerator);
// testFactory.addTestSuiteFactory(htmlSourceTestSuiteGenerator);
testFactory.addTestSuiteFactory(noSourceTestSuiteGenerator);
// testFactory.addTestSuiteFactory(objectSourceTestSuiteGenerator);
// testFactory.addTestSuiteFactory(stringSourceTestSuiteGenerator);

Expand Down

0 comments on commit f65e1ee

Please sign in to comment.