1
- describe ( 'Timed functions' , function ( ) {
1
+ describe ( 'Timed functions' , function ( ) {
2
2
beforeEach ( function ( ) {
3
3
setFixtures ( '<div id="timer"></div>' ) ;
4
4
} ) ;
5
5
6
6
// Start a timer in a DIV
7
7
describe ( 'Start a timer in a DIV' , function ( ) {
8
8
var timeElapsed = 0 ;
9
- beforeEach ( function ( done ) {
10
- $ ( '#timer' ) . timer ( ) ;
9
+ beforeEach ( function ( done ) {
10
+ $ ( '#timer' ) . timer ( ) ;
11
11
setTimeout ( done , 1000 ) ;
12
12
} ) ;
13
13
14
- it ( 'Should be true if the async call has completed' , function ( ) {
14
+ it ( 'Should be true if the async call has completed' , function ( ) {
15
15
expect ( $ ( '#timer' ) . data ( 'seconds' ) ) . toEqual ( 1 ) ;
16
16
} ) ;
17
17
} ) ;
18
18
19
19
// Start timer in an INPUT element
20
20
describe ( 'Start a timer in a INPUT element' , function ( ) {
21
- beforeEach ( function ( done ) {
21
+ beforeEach ( function ( done ) {
22
22
setFixtures ( '<input id="inputTimer" type="text"/>' ) ;
23
- $ ( '#inputTimer' ) . timer ( ) ;
23
+ $ ( '#inputTimer' ) . timer ( ) ;
24
24
setTimeout ( done , 1000 ) ;
25
25
} ) ;
26
26
27
- it ( 'Should be true if the async call has completed' , function ( ) {
27
+ it ( 'Should be true if the async call has completed' , function ( ) {
28
28
expect ( $ ( '#inputTimer' ) . data ( 'seconds' ) ) . toEqual ( 1 ) ;
29
29
} ) ;
30
30
} ) ;
31
31
32
32
// Pause a timer
33
33
describe ( 'Pause a running timer' , function ( ) {
34
- beforeEach ( function ( done ) {
34
+ beforeEach ( function ( done ) {
35
35
$ ( '#timer' ) . timer ( ) ;
36
- $ ( '#timer' ) . timer ( 'pause' ) ;
36
+ $ ( '#timer' ) . timer ( 'pause' ) ;
37
37
setTimeout ( done , 1000 ) ;
38
38
} ) ;
39
39
40
- it ( 'Should be true if the async call has completed' , function ( ) {
40
+ it ( 'Should be true if the async call has completed' , function ( ) {
41
41
// Even when we wait for a second, the time elapsed shouldnt change
42
42
// as we had immediately paused the timer after starting it
43
43
expect ( $ ( '#timer' ) . data ( 'seconds' ) ) . toEqual ( 0 ) ;
@@ -46,14 +46,14 @@ describe('Timed functions', function () {
46
46
47
47
// Pause and Resume a timer
48
48
describe ( 'Pause and Resume a timer' , function ( ) {
49
- beforeEach ( function ( done ) {
49
+ beforeEach ( function ( done ) {
50
50
$ ( '#timer' ) . timer ( ) ;
51
51
$ ( '#timer' ) . timer ( 'pause' ) ;
52
52
expect ( $ ( '#timer' ) . data ( 'state' ) ) . toBe ( 'paused' ) ;
53
53
setTimeout ( done , 1000 ) ;
54
54
} ) ;
55
55
56
- it ( 'Should be true if the async call has completed' , function ( ) {
56
+ it ( 'Should be true if the async call has completed' , function ( ) {
57
57
$ ( '#timer' ) . timer ( 'resume' ) ;
58
58
expect ( $ ( '#timer' ) . data ( 'state' ) ) . toBe ( 'running' ) ;
59
59
} ) ;
@@ -62,7 +62,7 @@ describe('Timed functions', function () {
62
62
// Execute a function after a set time
63
63
describe ( 'Execute a function after a set time' , function ( ) {
64
64
var flag ;
65
- beforeEach ( function ( done ) {
65
+ beforeEach ( function ( done ) {
66
66
$ ( '#timer' ) . timer ( {
67
67
callback : function ( ) {
68
68
flag = true ;
@@ -72,15 +72,15 @@ describe('Timed functions', function () {
72
72
setTimeout ( done , 1000 ) ;
73
73
} ) ;
74
74
75
- it ( 'Should call a function after the provided duration is complete' , function ( ) {
75
+ it ( 'Should call a function after the provided duration is complete' , function ( ) {
76
76
expect ( flag ) . toBe ( true ) ;
77
77
} ) ;
78
78
} ) ;
79
79
80
80
// Execute a function after a set time
81
81
describe ( 'Execute a function after a set time provided in pretty syntax' , function ( ) {
82
82
var flag ;
83
- beforeEach ( function ( done ) {
83
+ beforeEach ( function ( done ) {
84
84
$ ( '#timer' ) . timer ( {
85
85
callback : function ( ) {
86
86
flag = true ;
@@ -91,7 +91,7 @@ describe('Timed functions', function () {
91
91
setTimeout ( done , 1000 ) ;
92
92
} ) ;
93
93
94
- it ( 'Should call a function after the provided duration is complete' , function ( ) {
94
+ it ( 'Should call a function after the provided duration is complete' , function ( ) {
95
95
expect ( flag ) . toBe ( true ) ;
96
96
expect ( $ ( '#timer' ) ) . toContainText ( '1:40 min' ) ;
97
97
} ) ;
0 commit comments