From a0ed42194b92ec8dbc918a21d5e40465d2cb2382 Mon Sep 17 00:00:00 2001 From: codingtwinky Date: Sun, 7 Jan 2018 15:59:11 -0800 Subject: [PATCH] Making pause to be an unpersisted operation --- nprogress.js | 4 ++-- test/test.js | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nprogress.js b/nprogress.js index 94c1a94..576da24 100644 --- a/nprogress.js +++ b/nprogress.js @@ -179,11 +179,11 @@ }; NProgress.continue = function() { - return NProgress.configure({isPaused: true}); + return NProgress.configure({isPaused: false}); } NProgress.pause = function() { - return NProgress.configure({isPaused: false}); + return NProgress.configure({isPaused: true}); } NProgress.trickle = function() { diff --git a/test/test.js b/test/test.js index 431c89b..3ea040c 100644 --- a/test/test.js +++ b/test/test.js @@ -172,20 +172,8 @@ }); describe('.pause()', function() { - it('should be able to create paused nprogress', function(done) { - this.timeout(600) - NProgress.pause(); - NProgress.start(); - NProgress.set(0.3); - - setTimeout(function() { - assert.operator(NProgress.status, '==', 0.3); - done(); - }, 500); - }); - it('should be able to pause and unpause existing nprogress', function(done) { - this.timeout(2000) + this.timeout(2000); NProgress.continue(); NProgress.start(); NProgress.set(0.3); @@ -207,6 +195,18 @@ done(); }, 700); }); + + it('should not be a persitent operation', function(done) { + this.timeout(600); + NProgress.pause(); + NProgress.set(0); + NProgress.start(); // <--- this should be unpaused progress bar + + setTimeout(function() { + assert.operator(NProgress.status, '>', NProgress.settings.minimum); + done(); + }, 300); + }); }); });