@@ -24,8 +24,7 @@ describe('IgCircularBar', () => {
24
24
imports : [
25
25
IgxProgressBarModule
26
26
]
27
- } )
28
- . compileComponents ( ) ;
27
+ } ) . compileComponents ( ) ;
29
28
} ) ) ;
30
29
31
30
it ( 'Initialize circularProgressbar with default values' , ( ) => {
@@ -55,22 +54,20 @@ describe('IgCircularBar', () => {
55
54
expect ( progress . value ) . toBe ( expectedValue ) ;
56
55
} ) ;
57
56
58
- it ( 'If passed value is higher then max it should stay equal to maximum (default max size)' , fakeAsync ( ( ) => {
57
+ it ( 'If passed value is higher then max it should stay equal to maximum (default max size)' , ( ) => {
59
58
const progressBarValue = 120 ;
60
59
const expectedMaxValue = 100 ;
61
60
const fixture = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
62
61
fixture . detectChanges ( ) ;
63
62
64
63
const progress = fixture . componentInstance . circularBar ;
65
64
progress . value = progressBarValue ;
66
-
67
- tick ( 2500 ) ;
68
65
fixture . detectChanges ( ) ;
69
66
70
67
expect ( progress . value ) . toBe ( expectedMaxValue ) ;
71
- } ) ) ;
68
+ } ) ;
72
69
73
- it ( 'If passed value is higher then max it should stay equal to maximum (custom max size)' , fakeAsync ( ( ) => {
70
+ it ( 'If passed value is higher then max it should stay equal to maximum (custom max size)' , ( ) => {
74
71
const progressBarMaxValue = 150 ;
75
72
const progressBarValue = 170 ;
76
73
const fixture = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
@@ -80,13 +77,11 @@ describe('IgCircularBar', () => {
80
77
progress . max = progressBarMaxValue ;
81
78
progress . value = progressBarValue ;
82
79
83
- tick ( 3000 ) ;
84
80
fixture . detectChanges ( ) ;
85
-
86
81
expect ( progress . value ) . toBe ( progressBarMaxValue ) ;
87
- } ) ) ;
82
+ } ) ;
88
83
89
- it ( 'should not update value if max is updated' , fakeAsync ( ( ) => {
84
+ it ( 'should not update value if max is updated' , ( ) => {
90
85
let progressBarMaxValue = 150 ;
91
86
const progressBarValue = 120 ;
92
87
const fixture = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
@@ -97,7 +92,7 @@ describe('IgCircularBar', () => {
97
92
progress . max = progressBarMaxValue ;
98
93
progress . value = progressBarValue ;
99
94
100
- tick ( tickTime ) ;
95
+
101
96
fixture . detectChanges ( ) ;
102
97
103
98
expect ( progress . value ) . toBe ( progressBarValue ) ;
@@ -106,37 +101,11 @@ describe('IgCircularBar', () => {
106
101
progressBarMaxValue = 200 ;
107
102
progress . max = progressBarMaxValue ;
108
103
109
- tick ( tickTime ) ;
110
104
fixture . detectChanges ( ) ;
111
105
112
106
expect ( progress . value ) . toBe ( progressBarValue ) ;
113
107
expect ( progress . max ) . toBe ( progressBarMaxValue ) ;
114
- } ) ) ;
115
-
116
- it ( 'Should update value when we try to decrease it' , fakeAsync ( ( ) => {
117
- const fixture = TestBed . createComponent ( CircularBarComponent ) ;
118
- fixture . detectChanges ( ) ;
119
-
120
- const progressBar = fixture . componentInstance . progressbar ;
121
- let expectedValue = 50 ;
122
-
123
- fixture . componentInstance . value = expectedValue ;
124
-
125
- tick ( tickTime ) ;
126
- fixture . detectChanges ( ) ;
127
- tick ( tickTime ) ;
128
-
129
- expect ( progressBar . value ) . toBe ( expectedValue ) ;
130
-
131
- expectedValue = 20 ;
132
- fixture . componentInstance . value = expectedValue ;
133
-
134
- tick ( tickTime ) ;
135
- fixture . detectChanges ( ) ;
136
- tick ( tickTime ) ;
137
-
138
- expect ( progressBar . value ) . toBe ( expectedValue ) ;
139
- } ) ) ;
108
+ } ) ;
140
109
141
110
it ( 'Should update value when we try to decrease it (without animation)' , ( ) => {
142
111
const fixture = TestBed . createComponent ( CircularBarComponent ) ;
@@ -160,21 +129,20 @@ describe('IgCircularBar', () => {
160
129
expect ( progressBar . value ) . toBe ( expectedValue ) ;
161
130
} ) ;
162
131
163
- it ( 'When passed value is string progress indication should remain the same' , fakeAsync ( ( ) => {
132
+ it ( 'When passed value is string progress indication should remain the same' , ( ) => {
164
133
const fix = TestBed . createComponent ( CircularBarComponent ) ;
165
134
fix . detectChanges ( ) ;
166
135
167
136
const bar = fix . componentInstance . progressbar ;
168
137
const expectedRes = fix . componentInstance . value as number ;
169
138
170
- tick ( tickTime ) ;
171
139
expect ( bar . value ) . toEqual ( expectedRes ) ;
172
140
173
141
fix . componentInstance . value = '0345-234' ;
174
- tick ( tickTime ) ;
175
142
fix . detectChanges ( ) ;
143
+
176
144
expect ( bar . value ) . toEqual ( expectedRes ) ;
177
- } ) ) ;
145
+ } ) ;
178
146
179
147
it ( 'The update step is 1% of the maximum value, which prevents from slow update with big nums' , ( ) => {
180
148
const fix = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
@@ -193,35 +161,31 @@ describe('IgCircularBar', () => {
193
161
expect ( bar . step ) . toBe ( expectedValue ) ;
194
162
} ) ;
195
163
196
- it ( 'Value should not exceed the lower limit (0) when operating with floating numbers' , fakeAsync ( ( ) => {
164
+ it ( 'Value should not exceed the lower limit (0) when operating with floating numbers' , ( ) => {
197
165
const fix = TestBed . createComponent ( CircularBarComponent ) ;
198
166
const compInstance = fix . componentInstance ;
167
+ const bar = compInstance . progressbar ;
199
168
fix . detectChanges ( ) ;
200
- tick ( tickTime ) ;
201
169
202
- compInstance . max = 2.5 ;
170
+ compInstance . value = 0 ;
203
171
fix . detectChanges ( ) ;
204
172
173
+ compInstance . max = 2.5 ;
205
174
compInstance . value = - 0.3 ;
206
175
fix . detectChanges ( ) ;
207
176
208
- tick ( tickTime ) ;
209
- const bar = compInstance . progressbar ;
210
177
const expectedRes = 0 ;
211
178
expect ( bar . value ) . toBe ( expectedRes ) ;
212
179
expect ( bar . valueInPercent ) . toBe ( expectedRes ) ;
213
180
214
- compInstance . animate = false ;
215
- fix . detectChanges ( ) ;
216
-
217
181
compInstance . value = - 2 ;
218
182
fix . detectChanges ( ) ;
219
183
220
184
expect ( bar . value ) . toBe ( expectedRes ) ;
221
185
expect ( bar . valueInPercent ) . toBe ( expectedRes ) ;
222
- } ) ) ;
186
+ } ) ;
223
187
224
- it ( 'Value should not exceed the max limit when operating with floating numbers' , fakeAsync ( ( ) => {
188
+ it ( 'Value should not exceed the max limit when operating with floating numbers' , ( ) => {
225
189
const fix = TestBed . createComponent ( CircularBarComponent ) ;
226
190
const compInstance = fix . componentInstance ;
227
191
let value = 2.67 ;
@@ -234,7 +198,6 @@ describe('IgCircularBar', () => {
234
198
fix . detectChanges ( ) ;
235
199
236
200
const bar = compInstance . progressbar ;
237
- tick ( tickTime ) ;
238
201
expect ( bar . value ) . toBe ( max ) ;
239
202
expect ( bar . valueInPercent ) . toBe ( 100 ) ;
240
203
@@ -247,7 +210,7 @@ describe('IgCircularBar', () => {
247
210
248
211
expect ( bar . value ) . toBe ( max ) ;
249
212
expect ( bar . valueInPercent ) . toBe ( 100 ) ;
250
- } ) ) ;
213
+ } ) ;
251
214
252
215
it ( 'when passing string as value it should be parsed correctly' , ( ) => {
253
216
const fix = TestBed . createComponent ( CircularBarComponent ) ;
@@ -265,7 +228,7 @@ describe('IgCircularBar', () => {
265
228
expect ( bar . value ) . toBe ( expectedRes ) ;
266
229
} ) ;
267
230
268
- it ( 'when update step is bigger than passed value the progress indicator should follow the value representation' , fakeAsync ( ( ) => {
231
+ it ( 'when update step is bigger than passed value the progress indicator should follow the value representation' , ( ) => {
269
232
const fix = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
270
233
fix . detectChanges ( ) ;
271
234
@@ -278,17 +241,16 @@ describe('IgCircularBar', () => {
278
241
bar . value = value ;
279
242
280
243
fix . detectChanges ( ) ;
281
- tick ( tickTime ) ;
282
244
283
245
const percentValue = Common . calcPercentage ( value , max ) ;
284
246
expect ( bar . value ) . toBe ( value ) ;
285
247
expect ( bar . step ) . toBe ( step ) ;
286
248
expect ( bar . max ) . toBe ( max ) ;
287
249
expect ( bar . valueInPercent ) . toBe ( percentValue ) ;
288
- } ) ) ;
250
+ } ) ;
289
251
290
252
it ( `when step value is not divisble to passed value the result returned from the
291
- value getter should be the same as the passed one` , fakeAsync ( ( ) => {
253
+ value getter should be the same as the passed one` , ( ) => {
292
254
const fix = TestBed . createComponent ( InitCircularProgressBarComponent ) ;
293
255
fix . detectChanges ( ) ;
294
256
@@ -299,7 +261,6 @@ describe('IgCircularBar', () => {
299
261
bar . step = step ;
300
262
bar . value = value ;
301
263
302
- tick ( tickTime ) ;
303
264
fix . detectChanges ( ) ;
304
265
expect ( bar . step ) . toBe ( step ) ;
305
266
expect ( bar . value ) . toBe ( value ) ;
@@ -308,11 +269,11 @@ describe('IgCircularBar', () => {
308
269
value = 10 ;
309
270
valueInPercent = Common . calcPercentage ( value , bar . max ) ;
310
271
bar . value = value ;
311
- tick ( tickTime ) ;
312
272
fix . detectChanges ( ) ;
273
+
313
274
expect ( bar . value ) . toBe ( value ) ;
314
275
expect ( bar . valueInPercent ) . toBe ( valueInPercent ) ;
315
- } ) ) ;
276
+ } ) ;
316
277
317
278
it ( 'should apply its template correctly' , ( ) => {
318
279
const fixture = TestBed . createComponent ( CircularBarTemplateComponent ) ;
@@ -463,7 +424,7 @@ describe('IgCircularBar', () => {
463
424
} ) ;
464
425
} ) ;
465
426
} ) ;
466
- @Component ( { template : `<igx-circular-bar></igx-circular-bar>` } )
427
+ @Component ( { template : `<igx-circular-bar [animate]="false" ></igx-circular-bar>` } )
467
428
class InitCircularProgressBarComponent {
468
429
@ViewChild ( IgxCircularProgressBarComponent , { static : true } ) public circularBar : IgxCircularProgressBarComponent ;
469
430
}
@@ -481,7 +442,7 @@ class CircularBarComponent {
481
442
482
443
public value : string | number = 30 ;
483
444
public max = 100 ;
484
- public animate = true ;
445
+ public animate = false ;
485
446
}
486
447
487
448
@Component ( {
0 commit comments