2015-03-26 06:43:41 +02:00
|
|
|
import Player from '../../src/js/player.js';
|
2015-05-04 01:12:38 +02:00
|
|
|
import TechFaker from './tech/tech-faker.js';
|
2015-03-26 06:43:41 +02:00
|
|
|
import window from 'global/window';
|
|
|
|
import document from 'global/document';
|
|
|
|
|
|
|
|
var TestHelpers = {
|
2013-06-24 22:47:47 +03:00
|
|
|
makeTag: function(){
|
|
|
|
var videoTag = document.createElement('video');
|
|
|
|
videoTag.id = 'example_1';
|
|
|
|
videoTag.className = 'video-js vjs-default-skin';
|
|
|
|
return videoTag;
|
|
|
|
},
|
2015-03-26 06:43:41 +02:00
|
|
|
|
2013-11-27 03:53:23 +03:00
|
|
|
makePlayer: function(playerOptions, videoTag){
|
2013-06-24 22:47:47 +03:00
|
|
|
var player;
|
2013-11-27 03:53:23 +03:00
|
|
|
|
2015-03-26 06:43:41 +02:00
|
|
|
videoTag = videoTag || TestHelpers.makeTag();
|
2013-06-24 22:47:47 +03:00
|
|
|
|
|
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
|
|
fixture.appendChild(videoTag);
|
|
|
|
|
|
|
|
playerOptions = playerOptions || {};
|
2015-05-04 01:12:38 +02:00
|
|
|
playerOptions['techOrder'] = playerOptions['techOrder'] || ['techFaker'];
|
2013-06-24 22:47:47 +03:00
|
|
|
|
2015-03-26 06:43:41 +02:00
|
|
|
return player = new Player(videoTag, playerOptions);
|
|
|
|
},
|
2014-10-16 22:59:41 +03:00
|
|
|
|
|
|
|
getComputedStyle: function(el, rule){
|
2015-05-17 00:59:46 +02:00
|
|
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
|
|
return document.defaultView.getComputedStyle(el, null).getPropertyValue(rule);
|
|
|
|
}
|
2014-10-16 22:59:41 +03:00
|
|
|
|
|
|
|
// IE8
|
2015-05-17 00:59:46 +02:00
|
|
|
if (el.currentStyle) {
|
|
|
|
if (rule === 'width' || rule === 'height') {
|
|
|
|
// return clientWidth or clientHeight instead for better accuracy
|
|
|
|
rule = 'client' + rule.substr(0, 1).toUpperCase() + rule.substr(1);
|
|
|
|
return el[rule] + 'px';
|
|
|
|
} else {
|
|
|
|
return el.currentStyle[rule];
|
|
|
|
}
|
2014-10-16 22:59:41 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2015-03-26 06:43:41 +02:00
|
|
|
|
2015-05-04 01:12:38 +02:00
|
|
|
export default TestHelpers;
|