Skip to content

Commit

Permalink
fix(material-experimental/mdc-list): don't access class before initia…
Browse files Browse the repository at this point in the history
…lization (#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.

(cherry picked from commit 503f12f)
  • Loading branch information
crisbeto committed Jun 10, 2022
1 parent a0a2b3c commit 8f7394a
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/material-experimental/mdc-list/list-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@ import {
MatListItemAvatar,
} from './list-item-sections';

@Directive({
host: {
'[class.mat-mdc-list-non-interactive]': '_isNonInteractive',
'[attr.aria-disabled]': 'disabled',
},
})
/** @docs-private */
export abstract class MatListBase {
_isNonInteractive: boolean = true;

/** Whether ripples for all list items is disabled. */
@Input()
get disableRipple(): boolean {
return this._disableRipple;
}
set disableRipple(value: BooleanInput) {
this._disableRipple = coerceBooleanProperty(value);
}
private _disableRipple: boolean = false;

/** Whether all list items are disabled. */
@Input()
get disabled(): boolean {
return this._disabled;
}
set disabled(value: BooleanInput) {
this._disabled = coerceBooleanProperty(value);
}
private _disabled = false;
}

@Directive({
host: {
'[class.mdc-list-item--disabled]': 'disabled',
Expand Down Expand Up @@ -274,37 +305,6 @@ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, Rippl
}
}

@Directive({
host: {
'[class.mat-mdc-list-non-interactive]': '_isNonInteractive',
'[attr.aria-disabled]': 'disabled',
},
})
/** @docs-private */
export abstract class MatListBase {
_isNonInteractive: boolean = true;

/** Whether ripples for all list items is disabled. */
@Input()
get disableRipple(): boolean {
return this._disableRipple;
}
set disableRipple(value: BooleanInput) {
this._disableRipple = coerceBooleanProperty(value);
}
private _disableRipple: boolean = false;

/** Whether all list items are disabled. */
@Input()
get disabled(): boolean {
return this._disabled;
}
set disabled(value: BooleanInput) {
this._disabled = coerceBooleanProperty(value);
}
private _disabled = false;
}

/**
* Sanity checks the configuration of the list item with respect to the amount
* of lines, whether there is a title, or if there is unscoped text content.
Expand Down

0 comments on commit 8f7394a

Please sign in to comment.