Skip to content

Commit

Permalink
Making pause to be an unpersisted operation
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-kim committed Jan 7, 2018
1 parent 1bcb129 commit a0ed421
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions nprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
26 changes: 13 additions & 13 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
});
});
});

Expand Down

0 comments on commit a0ed421

Please sign in to comment.