Skip to content

Commit 503f12f

Browse files
authored
fix(material-experimental/mdc-list): don't access class before initialization (#25049)
Moves the `MatListBase` class up so that it isn't being referenced before it is used which seems to cause issues with Jest. Fixes #25008.
1 parent d40da65 commit 503f12f

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/material-experimental/mdc-list/list-base.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,37 @@ import {
3636
MatListItemAvatar,
3737
} from './list-item-sections';
3838

39+
@Directive({
40+
host: {
41+
'[class.mat-mdc-list-non-interactive]': '_isNonInteractive',
42+
'[attr.aria-disabled]': 'disabled',
43+
},
44+
})
45+
/** @docs-private */
46+
export abstract class MatListBase {
47+
_isNonInteractive: boolean = true;
48+
49+
/** Whether ripples for all list items is disabled. */
50+
@Input()
51+
get disableRipple(): boolean {
52+
return this._disableRipple;
53+
}
54+
set disableRipple(value: BooleanInput) {
55+
this._disableRipple = coerceBooleanProperty(value);
56+
}
57+
private _disableRipple: boolean = false;
58+
59+
/** Whether all list items are disabled. */
60+
@Input()
61+
get disabled(): boolean {
62+
return this._disabled;
63+
}
64+
set disabled(value: BooleanInput) {
65+
this._disabled = coerceBooleanProperty(value);
66+
}
67+
private _disabled = false;
68+
}
69+
3970
@Directive({
4071
host: {
4172
'[class.mdc-list-item--disabled]': 'disabled',
@@ -274,37 +305,6 @@ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, Rippl
274305
}
275306
}
276307

277-
@Directive({
278-
host: {
279-
'[class.mat-mdc-list-non-interactive]': '_isNonInteractive',
280-
'[attr.aria-disabled]': 'disabled',
281-
},
282-
})
283-
/** @docs-private */
284-
export abstract class MatListBase {
285-
_isNonInteractive: boolean = true;
286-
287-
/** Whether ripples for all list items is disabled. */
288-
@Input()
289-
get disableRipple(): boolean {
290-
return this._disableRipple;
291-
}
292-
set disableRipple(value: BooleanInput) {
293-
this._disableRipple = coerceBooleanProperty(value);
294-
}
295-
private _disableRipple: boolean = false;
296-
297-
/** Whether all list items are disabled. */
298-
@Input()
299-
get disabled(): boolean {
300-
return this._disabled;
301-
}
302-
set disabled(value: BooleanInput) {
303-
this._disabled = coerceBooleanProperty(value);
304-
}
305-
private _disabled = false;
306-
}
307-
308308
/**
309309
* Sanity checks the configuration of the list item with respect to the amount
310310
* of lines, whether there is a title, or if there is unscoped text content.

0 commit comments

Comments
 (0)