Skip to content

Commit

Permalink
fix(progressbar): progress stays striped when type changes
Browse files Browse the repository at this point in the history
Fixes #1035
Closes #1038
  • Loading branch information
jnizet authored and pkozlowski-opensource committed Nov 13, 2016
1 parent 1702df9 commit e3af043
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/progressbar/progressbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ describe('ngb-progressbar', () => {
expect(getProgressbar(fixture.nativeElement)).toHaveCssClass('progress-striped');
expect(getProgressbar(fixture.nativeElement)).not.toHaveCssClass('false');
});

it('should stay striped when the type changes', () => {
const html = '<ngb-progressbar [value]="value" [type]="type" [striped]="true"></ngb-progressbar>';
const fixture = createTestComponent(html);

expect(getProgressbar(fixture.nativeElement)).toHaveCssClass('progress-warning');
expect(getProgressbar(fixture.nativeElement)).toHaveCssClass('progress-striped');

fixture.componentInstance.type = 'success';
fixture.detectChanges();
expect(getProgressbar(fixture.nativeElement)).toHaveCssClass('progress-success');
expect(getProgressbar(fixture.nativeElement)).toHaveCssClass('progress-striped');
});
});

describe('Custom config', () => {
Expand Down
5 changes: 2 additions & 3 deletions src/progressbar/progressbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {NgbProgressbarConfig} from './progressbar-config';
selector: 'ngb-progressbar',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<progress class="progress {{type ? 'progress-' + type : ''}}"
[class.progress-animated]="animated"
[class.progress-striped]="striped"
<progress class="progress{{type ? ' progress-' + type : ''}}{{animated ? ' progress-animated' : ''}}{{striped ?
' progress-striped' : ''}}"
[max]="max" [value]="getValue()">
<div class="progress">
<span class="progress-bar" [style.width.%]="getPercentValue()"><ng-content></ng-content></span>
Expand Down

0 comments on commit e3af043

Please sign in to comment.