Skip to content

Commit

Permalink
Add tests for showSpinner. (See #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Aug 21, 2013
1 parent 92b9205 commit f7ac85e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ if (typeof module === 'object') require('./setup');

testSuite('NProgress', function() {

beforeEach(function() {
this.settings = $.extend({}, NProgress.settings);
});

afterEach(function() {
$("#nprogress").remove();
$('html').attr('class', '');
NProgress.status = null;

// Restore settings
$.extend(NProgress.settings, this.settings);
});

describe('.set()', function() {
Expand Down Expand Up @@ -111,4 +118,25 @@ testSuite('NProgress', function() {
assert.equal(NProgress.settings.minimum, 0.5);
});
});

// ----

describe('.configure(showSpinner)', function() {
it('should render spinner by default', function() {
NProgress.start();

assert.equal($("#nprogress .spinner").length, 1);
});

it('should be true by default', function() {
assert.equal(NProgress.settings.showSpinner, true);
});

it('should hide (on false)', function() {
NProgress.configure({ showSpinner: false });
NProgress.start();

assert.equal($("#nprogress .spinner").length, 0);
});
});
});

0 comments on commit f7ac85e

Please sign in to comment.