Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit b05d51a

Browse files
authored
fix(media-marshaller): do not propagate undefined value (#1245)
1 parent bf069af commit b05d51a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/lib/core/media-marshaller/media-marshaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export class MediaMarshaller {
317317
const activatedBp = this.activatedBreakpoints[i];
318318
const valueMap = bpMap.get(activatedBp.alias);
319319
if (valueMap) {
320-
if (key === undefined || valueMap.has(key)) {
320+
if (key === undefined || (valueMap.has(key) && valueMap.get(key) !== undefined)) {
321321
return valueMap;
322322
}
323323
}

src/lib/extended/class/class.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ describe('class directive', () => {
198198
expectNativeEl(fixture).toHaveCssClass('mat-class');
199199
});
200200

201+
it('should support more than one responsive breakpoint on one element with undefined', () => {
202+
createTestComponent(`<div ngClass.lt-lg="mat-class" [ngClass.md]="undefined"></div>`);
203+
mediaController.activate('md', true);
204+
expectNativeEl(fixture).toHaveCssClass('mat-class');
205+
});
206+
201207
it('should work with ngClass object notation', () => {
202208
createTestComponent(`
203209
<div [ngClass]="{'x1': hasX1, 'x3': hasX3}"

0 commit comments

Comments
 (0)