Commit afec2dd4 by polesye

Add tests for Android.

parent b6808d3d
...@@ -211,6 +211,11 @@ ...@@ -211,6 +211,11 @@
isTouch: ['iPad'] isTouch: ['iPad']
}, },
{ {
name: 'Android',
isShown: true,
isTouch: ['Android']
},
{
name: 'iPhone', name: 'iPhone',
isShown: false, isShown: false,
isTouch: ['iPhone'] isTouch: ['iPhone']
...@@ -237,38 +242,39 @@ ...@@ -237,38 +242,39 @@
}); });
}); });
it('is shown on paused video on iPad in HTML5 player', function () { $.each(['iPad', 'Android'], function(index, device) {
window.onTouchBasedDevice.andReturn(['iPad']); it('is shown on paused video on '+ device +' in HTML5 player', function () {
initialize(); window.onTouchBasedDevice.andReturn([device]);
var btnPlay = state.el.find('.btn-play'); initialize();
var btnPlay = state.el.find('.btn-play');
videoControl.play(); videoControl.play();
videoControl.pause(); videoControl.pause();
expect(btnPlay).not.toHaveClass('is-hidden'); expect(btnPlay).not.toHaveClass('is-hidden');
}); });
it('is hidden on playing video on iPad in HTML5 player', function () { it('is hidden on playing video on '+ device +' in HTML5 player', function () {
window.onTouchBasedDevice.andReturn(['iPad']); window.onTouchBasedDevice.andReturn([device]);
initialize(); initialize();
var btnPlay = state.el.find('.btn-play'); var btnPlay = state.el.find('.btn-play');
videoControl.play(); videoControl.play();
expect(btnPlay).toHaveClass('is-hidden'); expect(btnPlay).toHaveClass('is-hidden');
}); });
it('is hidden on paused video on iPad in YouTube player', function () { it('is hidden on paused video on '+ device +' in YouTube player', function () {
window.onTouchBasedDevice.andReturn(['iPad']); window.onTouchBasedDevice.andReturn([device]);
initializeYouTube(); initializeYouTube();
var btnPlay = state.el.find('.btn-play'); var btnPlay = state.el.find('.btn-play');
videoControl.play(); videoControl.play();
videoControl.pause(); videoControl.pause();
expect(btnPlay).toHaveClass('is-hidden'); expect(btnPlay).toHaveClass('is-hidden');
});
}); });
}); });
it('show', function () { it('show', function () {
......
...@@ -157,14 +157,13 @@ ...@@ -157,14 +157,13 @@
// JS. // JS.
describe('when on a touch based device', function () { describe('when on a touch based device', function () {
beforeEach(function () { $.each(['iPad', 'Android'], function(index, device) {
window.onTouchBasedDevice.andReturn(['iPad']); it('create video volume control on' + device, function() {
initialize(); window.onTouchBasedDevice.andReturn([device]);
}); initialize();
expect(videoVolumeControl).toBeUndefined();
it('create video volume control', function () { expect(state.el.find('div.volume')).not.toExist();
expect(videoVolumeControl).toBeUndefined(); });
expect(state.el.find('div.volume')).not.toExist();
}); });
}); });
...@@ -879,10 +878,12 @@ ...@@ -879,10 +878,12 @@
describe('on Touch devices', function () { describe('on Touch devices', function () {
it('`is-touch` class name is added to container', function () { it('`is-touch` class name is added to container', function () {
window.onTouchBasedDevice.andReturn(['iPad']); $.each(['iPad', 'Android', 'iPhone'], function(index, device) {
initialize(); 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 () { it('modules are not initialized on iPhone', function () {
...@@ -899,11 +900,17 @@ ...@@ -899,11 +900,17 @@
}); });
}); });
it('controls become visible after playing starts on iPad', function () { $.each(['iPad', 'Android'], function(index, device) {
window.onTouchBasedDevice.andReturn(['iPad']); var message = 'controls become visible after playing starts on ' +
initialize(); 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 () { waitsFor(function () {
return state.el.hasClass('is-initialized'); return state.el.hasClass('is-initialized');
...@@ -921,7 +928,7 @@ ...@@ -921,7 +928,7 @@
runs(function () { runs(function () {
expect(controls).not.toHaveClass('is-hidden'); expect(controls).not.toHaveClass('is-hidden');
}); });
});
}); });
}); });
}); });
......
...@@ -54,11 +54,12 @@ ...@@ -54,11 +54,12 @@
// We can't expect $.fn.slider not to have been called, // We can't expect $.fn.slider not to have been called,
// because sliders are used in other parts of Video. // because sliders are used in other parts of Video.
}); });
it('build the slider on iPad', function() { $.each(['iPad', 'Android'], function(index, device) {
window.onTouchBasedDevice.andReturn(['iPad']); it('build the slider on ' + device, function() {
initialize(); window.onTouchBasedDevice.andReturn([device]);
initialize();
expect(videoProgressSlider.slider).toBeDefined(); expect(videoProgressSlider.slider).toBeDefined();
});
}); });
}); });
}); });
......
...@@ -57,13 +57,12 @@ ...@@ -57,13 +57,12 @@
}); });
describe('when running on touch based device', function() { describe('when running on touch based device', function() {
beforeEach(function() { $.each(['iPad', 'Android'], function(index, device) {
window.onTouchBasedDevice.andReturn(['iPad']); it('is not rendered on' + device, function() {
initialize(); window.onTouchBasedDevice.andReturn([device]);
}); initialize();
it('is not rendered', function() {
expect(state.el.find('div.speeds')).not.toExist(); expect(state.el.find('div.speeds')).not.toExist();
});
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment