test-all.js
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// These tests are run with two different test runners which work a bit
// differently. Runners are Testem and Karma. Read more about them in
// CONTRIBUTING.md
// Supporting both has lead to some compromises.
var utils = require('./utils');
// https://github.com/mochajs/mocha/wiki/Shared-Behaviours
var sharedTests = require('./shared-behaviour');
var ProgressBar = require("../src/main");
var afterEachCase = function() {
try {
this.bar.destroy();
} catch (e) {
// Some test cases destroy the bar themselves and calling again
// throws an error
}
};
describe('Line', function() {
beforeEach(function() {
// Append progress bar to body since adding a custom HTML and div
// with Karma was not that trivial compared to Testem
this.bar = new ProgressBar.Line('body');
});
afterEach(afterEachCase);
sharedTests();
});
describe('Circle', function() {
beforeEach(function() {
this.bar = new ProgressBar.Circle('body');
});
afterEach(afterEachCase);
sharedTests();
});
describe('Square', function() {
beforeEach(function() {
this.bar = new ProgressBar.Square('body');
});
afterEach(afterEachCase);
sharedTests();
});