1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-14 11:23:30 +02:00
video.js/test/unit/controls.js
Steve Heffernan 3b48be921e First pass at automated multi-browser/device testing. closes #419
I've got a way to run tests across every browser and device out there except for IE8, and IE8 should work except I'm running into a Browserstack bug that I've let them know about.

It uses a project called bunyip, which internallt uses Yeti (YUI), Pagekite, and Browserstack.

Next steps include:
  - Making it all automatic. Right now you have to wait for browsers to connect and then manually hit enter when they have.
  - Make it a grunt task
  - Document it all so others can use it

I think this is close enough for me to close the milestone 4.0 issue.
2013-04-12 16:51:04 -07:00

78 lines
2.0 KiB
JavaScript

module('Controls');
test('should hide volume control if it\'s not supported', function(){
expect(2);
var noop, player, volumeControl, muteToggle;
noop = function(){};
player = {
id: noop,
on: noop,
ready: noop,
tech: {
features: {
volumeControl: false
}
},
volume: function(){}
};
volumeControl = new vjs.VolumeControl(player);
muteToggle = new vjs.MuteToggle(player);
ok(volumeControl.el().className.indexOf('vjs-hidden') >= 0, 'volumeControl is not hidden');
ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0, 'muteToggle is not hidden');
});
test('should test and toggle volume control on `loadstart`', function(){
var noop, listeners, player, volumeControl, muteToggle, i;
noop = function(){};
listeners = [];
player = {
id: noop,
on: function(event, callback){
listeners.push(callback);
},
ready: noop,
volume: function(){
return 1;
},
muted: function(){
return false;
},
tech: {
features: {
volumeControl: true
}
}
};
volumeControl = new vjs.VolumeControl(player);
muteToggle = new vjs.MuteToggle(player);
ok(volumeControl.el().className.indexOf('vjs-hidden') < 0,
'volumeControl is hidden initially');
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
'muteToggle is hidden initially');
player.tech.features.volumeControl = false;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}
ok(volumeControl.el().className.indexOf('vjs-hidden') >= 0,
'volumeControl does not hide itself');
ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0,
'muteToggle does not hide itself');
player.tech.features.volumeControl = true;
for (i = 0; i < listeners.length; i++) {
listeners[i]();
}
ok(volumeControl.el().className.indexOf('vjs-hidden') < 0,
'volumeControl does not show itself');
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
'muteToggle does not show itself');
});