Add tests for Android.
This commit is contained in:
@@ -210,6 +210,11 @@
|
||||
isShown: true,
|
||||
isTouch: ['iPad']
|
||||
},
|
||||
{
|
||||
name: 'Android',
|
||||
isShown: true,
|
||||
isTouch: ['Android']
|
||||
},
|
||||
{
|
||||
name: 'iPhone',
|
||||
isShown: false,
|
||||
@@ -237,38 +242,39 @@
|
||||
});
|
||||
});
|
||||
|
||||
it('is shown on paused video on iPad in HTML5 player', function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
$.each(['iPad', 'Android'], function(index, device) {
|
||||
it('is shown on paused video on '+ device +' in HTML5 player', function () {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
|
||||
videoControl.play();
|
||||
videoControl.pause();
|
||||
videoControl.play();
|
||||
videoControl.pause();
|
||||
|
||||
expect(btnPlay).not.toHaveClass('is-hidden');
|
||||
expect(btnPlay).not.toHaveClass('is-hidden');
|
||||
});
|
||||
|
||||
it('is hidden on playing video on '+ device +' in HTML5 player', function () {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
|
||||
videoControl.play();
|
||||
|
||||
expect(btnPlay).toHaveClass('is-hidden');
|
||||
});
|
||||
|
||||
it('is hidden on paused video on '+ device +' in YouTube player', function () {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initializeYouTube();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
|
||||
videoControl.play();
|
||||
videoControl.pause();
|
||||
|
||||
expect(btnPlay).toHaveClass('is-hidden');
|
||||
});
|
||||
});
|
||||
|
||||
it('is hidden on playing video on iPad in HTML5 player', function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
|
||||
videoControl.play();
|
||||
|
||||
expect(btnPlay).toHaveClass('is-hidden');
|
||||
});
|
||||
|
||||
it('is hidden on paused video on iPad in YouTube player', function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initializeYouTube();
|
||||
var btnPlay = state.el.find('.btn-play');
|
||||
|
||||
videoControl.play();
|
||||
videoControl.pause();
|
||||
|
||||
expect(btnPlay).toHaveClass('is-hidden');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('show', function () {
|
||||
|
||||
@@ -157,14 +157,13 @@
|
||||
// JS.
|
||||
|
||||
describe('when on a touch based device', function () {
|
||||
beforeEach(function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
});
|
||||
|
||||
it('create video volume control', function () {
|
||||
expect(videoVolumeControl).toBeUndefined();
|
||||
expect(state.el.find('div.volume')).not.toExist();
|
||||
$.each(['iPad', 'Android'], function(index, device) {
|
||||
it('create video volume control on' + device, function() {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
expect(videoVolumeControl).toBeUndefined();
|
||||
expect(state.el.find('div.volume')).not.toExist();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -879,10 +878,12 @@
|
||||
|
||||
describe('on Touch devices', function () {
|
||||
it('`is-touch` class name is added to container', function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
$.each(['iPad', 'Android', 'iPhone'], function(index, device) {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
|
||||
expect(state.el).toHaveClass('is-touch');
|
||||
expect(state.el).toHaveClass('is-touch');
|
||||
});
|
||||
});
|
||||
|
||||
it('modules are not initialized on iPhone', function () {
|
||||
@@ -899,11 +900,17 @@
|
||||
});
|
||||
});
|
||||
|
||||
it('controls become visible after playing starts on iPad', function () {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
$.each(['iPad', 'Android'], function(index, device) {
|
||||
var message = 'controls become visible after playing starts on ' +
|
||||
device;
|
||||
it(message, function() {
|
||||
var controls;
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
|
||||
var controls = state.el.find('.video-controls');
|
||||
runs(function () {
|
||||
initialize();
|
||||
controls = state.el.find('.video-controls');
|
||||
});
|
||||
|
||||
waitsFor(function () {
|
||||
return state.el.hasClass('is-initialized');
|
||||
@@ -921,7 +928,7 @@
|
||||
runs(function () {
|
||||
expect(controls).not.toHaveClass('is-hidden');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,11 +54,12 @@
|
||||
// We can't expect $.fn.slider not to have been called,
|
||||
// because sliders are used in other parts of Video.
|
||||
});
|
||||
it('build the slider on iPad', function() {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
|
||||
expect(videoProgressSlider.slider).toBeDefined();
|
||||
$.each(['iPad', 'Android'], function(index, device) {
|
||||
it('build the slider on ' + device, function() {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
expect(videoProgressSlider.slider).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -57,13 +57,12 @@
|
||||
});
|
||||
|
||||
describe('when running on touch based device', function() {
|
||||
beforeEach(function() {
|
||||
window.onTouchBasedDevice.andReturn(['iPad']);
|
||||
initialize();
|
||||
});
|
||||
|
||||
it('is not rendered', function() {
|
||||
$.each(['iPad', 'Android'], function(index, device) {
|
||||
it('is not rendered on' + device, function() {
|
||||
window.onTouchBasedDevice.andReturn([device]);
|
||||
initialize();
|
||||
expect(state.el.find('div.speeds')).not.toExist();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user