Skip to content

Commit

Permalink
fix(media-marshaller): do not propagate undefined value (#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaerusKaru authored May 9, 2020
1 parent bf069af commit b05d51a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/core/media-marshaller/media-marshaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class MediaMarshaller {
const activatedBp = this.activatedBreakpoints[i];
const valueMap = bpMap.get(activatedBp.alias);
if (valueMap) {
if (key === undefined || valueMap.has(key)) {
if (key === undefined || (valueMap.has(key) && valueMap.get(key) !== undefined)) {
return valueMap;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/lib/extended/class/class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ describe('class directive', () => {
expectNativeEl(fixture).toHaveCssClass('mat-class');
});

it('should support more than one responsive breakpoint on one element with undefined', () => {
createTestComponent(`<div ngClass.lt-lg="mat-class" [ngClass.md]="undefined"></div>`);
mediaController.activate('md', true);
expectNativeEl(fixture).toHaveCssClass('mat-class');
});

it('should work with ngClass object notation', () => {
createTestComponent(`
<div [ngClass]="{'x1': hasX1, 'x3': hasX3}"
Expand Down

0 comments on commit b05d51a

Please sign in to comment.