summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2014-06-02 18:09:26 +0200
committerMorris Jobke <morris.jobke@gmail.com>2014-06-02 18:09:41 +0200
commitfbe42a771f433a01e54f744998593ae4cf07ed82 (patch)
treef61610170b85f7f7ba10722a69166f8ce27798db /core
parentcd61fb06ebb59889a9368b34ab432f2f6a155d2e (diff)
downloadnextcloud-server-fbe42a771f433a01e54f744998593ae4cf07ed82.tar.gz
nextcloud-server-fbe42a771f433a01e54f744998593ae4cf07ed82.zip
fix unit tests after introduction of animations - adds delays for click trigger
Diffstat (limited to 'core')
-rw-r--r--core/js/tests/specs/coreSpec.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 233c4d5a0b4..b981eb579a7 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -359,8 +359,10 @@ describe('Core base tests', function() {
var oldMatchMedia;
var $toggle;
var $navigation;
+ var clock;
beforeEach(function() {
+ clock = sinon.useFakeTimers();
oldMatchMedia = OC._matchMedia;
// a separate method was needed because window.matchMedia
// cannot be stubbed due to a bug in PhantomJS:
@@ -376,6 +378,7 @@ describe('Core base tests', function() {
afterEach(function() {
OC._matchMedia = oldMatchMedia;
+ clock.restore();
});
it('Sets up menu toggle in mobile mode', function() {
OC._matchMedia.returns({matches: true});
@@ -413,8 +416,10 @@ describe('Core base tests', function() {
$navigation.hide(); // normally done through media query triggered CSS
expect($navigation.is(':visible')).toEqual(false);
$toggle.click();
+ clock.tick(1 * 1000);
expect($navigation.is(':visible')).toEqual(true);
$toggle.click();
+ clock.tick(1 * 1000);
expect($navigation.is(':visible')).toEqual(false);
});
it('Clicking menu toggle does not toggle navigation in desktop mode', function() {
@@ -448,6 +453,7 @@ describe('Core base tests', function() {
window.initCore();
expect($navigation.is(':visible')).toEqual(false);
$toggle.click();
+ clock.tick(1 * 1000);
expect($navigation.is(':visible')).toEqual(true);
mq.matches = false;
$(window).trigger('resize');
@@ -456,6 +462,7 @@ describe('Core base tests', function() {
$(window).trigger('resize');
expect($navigation.is(':visible')).toEqual(false);
$toggle.click();
+ clock.tick(1 * 1000);
expect($navigation.is(':visible')).toEqual(true);
});
});