Skip to content

Commit 633a536

Browse files
committed
fix(progressbar): decrease the progress when pass lower value Closes #7286 Closes #7279
1 parent c84f81e commit 633a536

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

projects/igniteui-angular/src/lib/progressbar/circularbar.component.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import {
33
async,
44
fakeAsync,
55
TestBed,
6-
tick,
7-
flush
6+
tick
87
} from '@angular/core/testing';
98
import { By } from '@angular/platform-browser';
109
import { IgxCircularProgressBarComponent, IgxProgressBarModule } from './progressbar.component';
@@ -15,7 +14,6 @@ import { configureTestSuite } from '../test-utils/configure-suite';
1514
const CIRCULAR_INNER_CLASS = 'igx-circular-bar__inner';
1615
const CIRCULAR_OUTER_CLASS = 'igx-circular-bar__outer';
1716
const CIRCULAR_TEXT_CLASS = 'igx-circular-bar__text';
18-
const CIRCULAR_HIDDEN_TEXT_CLASS = 'igx-circular-bar__text--hidden';
1917
const CIRCULAR_INDETERMINATE_CLASS = 'igx-circular-bar--indeterminate';
2018

2119
describe('IgCircularBar', () => {
@@ -248,17 +246,20 @@ describe('IgCircularBar', () => {
248246
it('when passing string as value it should be parsed correctly', () => {
249247
const fix = TestBed.createComponent(CircularBarComponent);
250248
const compInstance = fix.componentInstance;
251-
const stringValue = '0.50';
249+
const stringValue = '10';
250+
251+
compInstance.animate = false;
252+
fix.detectChanges();
253+
252254
compInstance.value = stringValue;
253255
fix.detectChanges();
254256

255257
const bar = compInstance.progressbar;
256-
257-
const expectedRes = parseFloat(stringValue);
258+
const expectedRes = parseInt(stringValue, 10);
258259
expect(bar.value).toBe(expectedRes);
259260
});
260261

261-
it('when update step is bigger than passed value the progress indicator should follow the value representation', () => {
262+
it('when update step is bigger than passed value the progress indicator should follow the value representation', fakeAsync(() => {
262263
const fix = TestBed.createComponent(InitCircularProgressBarComponent);
263264
fix.detectChanges();
264265

@@ -271,13 +272,14 @@ describe('IgCircularBar', () => {
271272
bar.value = value;
272273

273274
fix.detectChanges();
275+
tick(tickTime);
274276

275277
const percentValue = Common.calcPercentage(value, max);
276278
expect(bar.value).toBe(value);
277279
expect(bar.step).toBe(step);
278280
expect(bar.max).toBe(max);
279281
expect(bar.valueInPercent).toBe(percentValue);
280-
});
282+
}));
281283

282284
it(`when step value is not divisble to passed value the result returned from the
283285
value getter should be the same as the passed one`, fakeAsync(() => {

projects/igniteui-angular/src/lib/progressbar/linearbar.component.spec.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,20 @@ describe('IgLinearBar', () => {
273273
it('when passing string as value it should be parsed correctly', () => {
274274
const fix = TestBed.createComponent(LinearBarComponent);
275275
const compInstance = fix.componentInstance;
276-
const stringValue = '0.50';
277-
compInstance.value = stringValue;
276+
const bar = compInstance.progressbar;
277+
278+
compInstance.animate = false;
278279
fix.detectChanges();
279280

280-
const bar = compInstance.progressbar;
281+
const stringValue = '20';
282+
compInstance.value = stringValue;
283+
fix.detectChanges();
281284

282-
let expectedRes: number | string = stringValue.toString();
283-
expectedRes = parseFloat(stringValue);
285+
const expectedRes = parseInt(stringValue, 10);
284286
expect(bar.value).toBe(expectedRes);
285287
});
286288

287-
it('when update step is bigger than passed value the progress indicator should follow the value representation', () => {
289+
it('when update step is bigger than passed value the progress indicator should follow the value itself', fakeAsync(() => {
288290
const fix = TestBed.createComponent(InitLinearProgressBarComponent);
289291
fix.detectChanges();
290292

@@ -297,13 +299,14 @@ describe('IgLinearBar', () => {
297299
bar.value = value;
298300

299301
fix.detectChanges();
302+
tick(tickTime);
300303

301304
const percentValue = Common.calcPercentage(value, max);
302305
expect(bar.value).toBe(value);
303306
expect(bar.step).toBe(step);
304307
expect(bar.max).toBe(max);
305308
expect(bar.valueInPercent).toBe(percentValue);
306-
});
309+
}));
307310

308311
it(`when step value is not divisble to passed value the result returned from the
309312
value getter should be as same as the passed one`, fakeAsync(() => {

0 commit comments

Comments
 (0)