Skip to content

Commit 640a65b

Browse files
committed
refactor(material/legacy-list): rename ts symbols
1 parent 7b10fcb commit 640a65b

13 files changed

+141
-99
lines changed

src/material/legacy-list/public-api.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export * from './list-module';
10-
export * from './list';
11-
export * from './selection-list';
9+
export {MatLegacyListModule} from './list-module';
10+
export {
11+
MatLegacyNavList,
12+
MatLegacyList,
13+
MatLegacyListAvatarCssMatStyler,
14+
MatLegacyListIconCssMatStyler,
15+
MatLegacyListSubheaderCssMatStyler,
16+
MatLegacyListItem,
17+
} from './list';
18+
export {
19+
MAT_LEGACY_SELECTION_LIST_VALUE_ACCESSOR,
20+
MatLegacySelectionListChange,
21+
MatLegacyListOptionCheckboxPosition,
22+
MatLegacyListOption,
23+
MatLegacySelectionList,
24+
} from './selection-list';
1225

13-
export {MAT_LIST, MAT_NAV_LIST} from '@angular/material/list';
26+
export {
27+
MAT_LIST as MAT_LEGACY_LIST,
28+
MAT_NAV_LIST as MAT_LEGACY_NAV_LIST,
29+
} from '@angular/material/list';

src/material/legacy-list/selection-list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const _MatSelectionListBase = mixinDisableRipple(class {});
4747
const _MatListOptionBase = mixinDisableRipple(class {});
4848

4949
/** @docs-private */
50-
export const MAT_SELECTION_LIST_VALUE_ACCESSOR: any = {
50+
export const MAT_LEGACY_SELECTION_LIST_VALUE_ACCESSOR: any = {
5151
provide: NG_VALUE_ACCESSOR,
5252
useExisting: forwardRef(() => MatLegacySelectionList),
5353
multi: true,
@@ -341,7 +341,7 @@ export class MatLegacyListOption
341341
template: '<ng-content></ng-content>',
342342
styleUrls: ['list.css'],
343343
encapsulation: ViewEncapsulation.None,
344-
providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR],
344+
providers: [MAT_LEGACY_SELECTION_LIST_VALUE_ACCESSOR],
345345
changeDetection: ChangeDetectionStrategy.OnPush,
346346
})
347347
export class MatLegacySelectionList

src/material/legacy-list/testing/action-list-harness.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88

99
import {HarnessPredicate} from '@angular/cdk/testing';
1010
import {MatLegacyListHarnessBase} from './list-harness-base';
11-
import {ActionListHarnessFilters, ActionListItemHarnessFilters} from './list-harness-filters';
11+
import {
12+
LegacyActionListHarnessFilters,
13+
LegacyActionListItemHarnessFilters,
14+
} from './list-harness-filters';
1215
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';
1316

1417
/** Harness for interacting with a standard mat-action-list in tests. */
1518
export class MatLegacyActionListHarness extends MatLegacyListHarnessBase<
1619
typeof MatLegacyActionListItemHarness,
1720
MatLegacyActionListItemHarness,
18-
ActionListItemHarnessFilters
21+
LegacyActionListItemHarnessFilters
1922
> {
2023
/** The selector for the host element of a `MatActionList` instance. */
2124
static hostSelector = 'mat-action-list.mat-list';
@@ -27,7 +30,7 @@ export class MatLegacyActionListHarness extends MatLegacyListHarnessBase<
2730
* @return a `HarnessPredicate` configured with the given options.
2831
*/
2932
static with(
30-
options: ActionListHarnessFilters = {},
33+
options: LegacyActionListHarnessFilters = {},
3134
): HarnessPredicate<MatLegacyActionListHarness> {
3235
return new HarnessPredicate(MatLegacyActionListHarness, options);
3336
}
@@ -47,7 +50,7 @@ export class MatLegacyActionListItemHarness extends MatLegacyListItemHarnessBase
4750
* @return a `HarnessPredicate` configured with the given options.
4851
*/
4952
static with(
50-
options: ActionListItemHarnessFilters = {},
53+
options: LegacyActionListItemHarnessFilters = {},
5154
): HarnessPredicate<MatLegacyActionListItemHarness> {
5255
return getListItemPredicate(MatLegacyActionListItemHarness, options);
5356
}

src/material/legacy-list/testing/list-harness-base.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
parallel,
1414
} from '@angular/cdk/testing';
1515
import {DividerHarnessFilters, MatDividerHarness} from '@angular/material/divider/testing';
16-
import {BaseListItemHarnessFilters, SubheaderHarnessFilters} from './list-harness-filters';
16+
import {
17+
LegacyBaseListItemHarnessFilters,
18+
LegacySubheaderHarnessFilters,
19+
} from './list-harness-filters';
1720
import {MatLegacySubheaderHarness} from './list-item-harness-base';
1821

1922
/** Represents a section of a list falling under a specific header. */
@@ -35,7 +38,7 @@ export interface ListSection<I> {
3538
export abstract class MatLegacyListHarnessBase<
3639
T extends ComponentHarnessConstructor<C> & {with: (options?: F) => HarnessPredicate<C>},
3740
C extends ComponentHarness,
38-
F extends BaseListItemHarnessFilters,
41+
F extends LegacyBaseListItemHarnessFilters,
3942
> extends ComponentHarness {
4043
protected _itemHarness: T;
4144

@@ -130,7 +133,7 @@ export abstract class MatLegacyListHarnessBase<
130133
}): Promise<C[]>;
131134
getItemsWithSubheadersAndDividers(filters: {
132135
item: false;
133-
subheader?: SubheaderHarnessFilters | false;
136+
subheader?: LegacySubheaderHarnessFilters | false;
134137
divider: false;
135138
}): Promise<MatLegacySubheaderHarness[]>;
136139
getItemsWithSubheadersAndDividers(filters: {
@@ -140,7 +143,7 @@ export abstract class MatLegacyListHarnessBase<
140143
}): Promise<MatDividerHarness[]>;
141144
getItemsWithSubheadersAndDividers(filters: {
142145
item?: F | false;
143-
subheader?: SubheaderHarnessFilters | false;
146+
subheader?: LegacySubheaderHarnessFilters | false;
144147
divider: false;
145148
}): Promise<(C | MatLegacySubheaderHarness)[]>;
146149
getItemsWithSubheadersAndDividers(filters: {
@@ -150,18 +153,18 @@ export abstract class MatLegacyListHarnessBase<
150153
}): Promise<(C | MatDividerHarness)[]>;
151154
getItemsWithSubheadersAndDividers(filters: {
152155
item: false;
153-
subheader?: false | SubheaderHarnessFilters;
156+
subheader?: false | LegacySubheaderHarnessFilters;
154157
divider?: false | DividerHarnessFilters;
155158
}): Promise<(MatLegacySubheaderHarness | MatDividerHarness)[]>;
156159
getItemsWithSubheadersAndDividers(filters?: {
157160
item?: F | false;
158-
subheader?: SubheaderHarnessFilters | false;
161+
subheader?: LegacySubheaderHarnessFilters | false;
159162
divider?: DividerHarnessFilters | false;
160163
}): Promise<(C | MatLegacySubheaderHarness | MatDividerHarness)[]>;
161164
async getItemsWithSubheadersAndDividers(
162165
filters: {
163166
item?: F | false;
164-
subheader?: SubheaderHarnessFilters | false;
167+
subheader?: LegacySubheaderHarnessFilters | false;
165168
divider?: DividerHarnessFilters | false;
166169
} = {},
167170
): Promise<(C | MatLegacySubheaderHarness | MatDividerHarness)[]> {

src/material/legacy-list/testing/list-harness-filters.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88

99
import {BaseHarnessFilters} from '@angular/cdk/testing';
1010

11-
export interface ListHarnessFilters extends BaseHarnessFilters {}
11+
export interface LegacyListHarnessFilters extends BaseHarnessFilters {}
1212

13-
export interface ActionListHarnessFilters extends BaseHarnessFilters {}
13+
export interface LegacyActionListHarnessFilters extends BaseHarnessFilters {}
1414

15-
export interface NavListHarnessFilters extends BaseHarnessFilters {}
15+
export interface LegacyNavListHarnessFilters extends BaseHarnessFilters {}
1616

17-
export interface SelectionListHarnessFilters extends BaseHarnessFilters {}
17+
export interface LegacySelectionListHarnessFilters extends BaseHarnessFilters {}
1818

19-
export interface BaseListItemHarnessFilters extends BaseHarnessFilters {
19+
export interface LegacyBaseListItemHarnessFilters extends BaseHarnessFilters {
2020
text?: string | RegExp;
2121
}
2222

23-
export interface ListItemHarnessFilters extends BaseListItemHarnessFilters {}
23+
export interface LegacyListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {}
2424

25-
export interface ActionListItemHarnessFilters extends BaseListItemHarnessFilters {}
25+
export interface LegacyActionListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {}
2626

27-
export interface NavListItemHarnessFilters extends BaseListItemHarnessFilters {
27+
export interface LegacyNavListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {
2828
href?: string | RegExp | null;
2929
}
3030

31-
export interface ListOptionHarnessFilters extends BaseListItemHarnessFilters {
31+
export interface LegacyListOptionHarnessFilters extends LegacyBaseListItemHarnessFilters {
3232
selected?: boolean;
3333
}
3434

35-
export interface SubheaderHarnessFilters extends BaseHarnessFilters {
35+
export interface LegacySubheaderHarnessFilters extends BaseHarnessFilters {
3636
text?: string | RegExp;
3737
}

src/material/legacy-list/testing/list-harness.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
import {HarnessPredicate} from '@angular/cdk/testing';
1010
import {MatLegacyListHarnessBase} from './list-harness-base';
11-
import {ListHarnessFilters, ListItemHarnessFilters} from './list-harness-filters';
11+
import {LegacyListHarnessFilters, LegacyListItemHarnessFilters} from './list-harness-filters';
1212
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';
1313

1414
/** Harness for interacting with a standard mat-list in tests. */
1515
export class MatLegacyListHarness extends MatLegacyListHarnessBase<
1616
typeof MatLegacyListItemHarness,
1717
MatLegacyListItemHarness,
18-
ListItemHarnessFilters
18+
LegacyListItemHarnessFilters
1919
> {
2020
/** The selector for the host element of a `MatList` instance. */
2121
static hostSelector = '.mat-list:not(mat-action-list)';
@@ -26,7 +26,7 @@ export class MatLegacyListHarness extends MatLegacyListHarnessBase<
2626
* @param options Options for filtering which list instances are considered a match.
2727
* @return a `HarnessPredicate` configured with the given options.
2828
*/
29-
static with(options: ListHarnessFilters = {}): HarnessPredicate<MatLegacyListHarness> {
29+
static with(options: LegacyListHarnessFilters = {}): HarnessPredicate<MatLegacyListHarness> {
3030
return new HarnessPredicate(MatLegacyListHarness, options);
3131
}
3232

@@ -44,7 +44,9 @@ export class MatLegacyListItemHarness extends MatLegacyListItemHarnessBase {
4444
* @param options Options for filtering which list item instances are considered a match.
4545
* @return a `HarnessPredicate` configured with the given options.
4646
*/
47-
static with(options: ListItemHarnessFilters = {}): HarnessPredicate<MatLegacyListItemHarness> {
47+
static with(
48+
options: LegacyListItemHarnessFilters = {},
49+
): HarnessPredicate<MatLegacyListItemHarness> {
4850
return getListItemPredicate(MatLegacyListItemHarness, options);
4951
}
5052
}

src/material/legacy-list/testing/list-item-harness-base.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
ContentContainerComponentHarness,
1414
parallel,
1515
} from '@angular/cdk/testing';
16-
import {BaseListItemHarnessFilters, SubheaderHarnessFilters} from './list-harness-filters';
16+
import {
17+
LegacyBaseListItemHarnessFilters,
18+
LegacySubheaderHarnessFilters,
19+
} from './list-harness-filters';
1720

1821
const iconSelector = '.mat-list-icon';
1922
const avatarSelector = '.mat-list-avatar';
@@ -28,7 +31,7 @@ const avatarSelector = '.mat-list-avatar';
2831
*/
2932
export function getListItemPredicate<H extends MatLegacyListItemHarnessBase>(
3033
harnessType: ComponentHarnessConstructor<H>,
31-
options: BaseListItemHarnessFilters,
34+
options: LegacyBaseListItemHarnessFilters,
3235
): HarnessPredicate<H> {
3336
return new HarnessPredicate(harnessType, options).addOption(
3437
'text',
@@ -41,7 +44,9 @@ export function getListItemPredicate<H extends MatLegacyListItemHarnessBase>(
4144
export class MatLegacySubheaderHarness extends ComponentHarness {
4245
static hostSelector = '.mat-subheader';
4346

44-
static with(options: SubheaderHarnessFilters = {}): HarnessPredicate<MatLegacySubheaderHarness> {
47+
static with(
48+
options: LegacySubheaderHarnessFilters = {},
49+
): HarnessPredicate<MatLegacySubheaderHarness> {
4550
return new HarnessPredicate(MatLegacySubheaderHarness, options).addOption(
4651
'text',
4752
options.text,

src/material/legacy-list/testing/nav-list-harness.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
import {HarnessPredicate} from '@angular/cdk/testing';
1010
import {MatLegacyListHarnessBase} from './list-harness-base';
11-
import {NavListHarnessFilters, NavListItemHarnessFilters} from './list-harness-filters';
11+
import {LegacyNavListHarnessFilters, LegacyNavListItemHarnessFilters} from './list-harness-filters';
1212
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';
1313

1414
/** Harness for interacting with a standard mat-nav-list in tests. */
1515
export class MatLegacyNavListHarness extends MatLegacyListHarnessBase<
1616
typeof MatLegacyNavListItemHarness,
1717
MatLegacyNavListItemHarness,
18-
NavListItemHarnessFilters
18+
LegacyNavListItemHarnessFilters
1919
> {
2020
/** The selector for the host element of a `MatNavList` instance. */
2121
static hostSelector = '.mat-nav-list';
@@ -26,7 +26,9 @@ export class MatLegacyNavListHarness extends MatLegacyListHarnessBase<
2626
* @param options Options for filtering which nav list instances are considered a match.
2727
* @return a `HarnessPredicate` configured with the given options.
2828
*/
29-
static with(options: NavListHarnessFilters = {}): HarnessPredicate<MatLegacyNavListHarness> {
29+
static with(
30+
options: LegacyNavListHarnessFilters = {},
31+
): HarnessPredicate<MatLegacyNavListHarness> {
3032
return new HarnessPredicate(MatLegacyNavListHarness, options);
3133
}
3234

@@ -45,7 +47,7 @@ export class MatLegacyNavListItemHarness extends MatLegacyListItemHarnessBase {
4547
* @return a `HarnessPredicate` configured with the given options.
4648
*/
4749
static with(
48-
options: NavListItemHarnessFilters = {},
50+
options: LegacyNavListItemHarnessFilters = {},
4951
): HarnessPredicate<MatLegacyNavListItemHarness> {
5052
return getListItemPredicate(MatLegacyNavListItemHarness, options).addOption(
5153
'href',

src/material/legacy-list/testing/public-api.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,20 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export * from './action-list-harness';
10-
export * from './list-harness';
11-
export * from './list-harness-filters';
12-
export * from './nav-list-harness';
13-
export * from './selection-list-harness';
9+
export {MatLegacyActionListHarness, MatLegacyActionListItemHarness} from './action-list-harness';
10+
export {MatLegacyListHarness, MatLegacyListItemHarness} from './list-harness';
11+
export {
12+
LegacyListHarnessFilters,
13+
LegacyActionListHarnessFilters,
14+
LegacyNavListHarnessFilters,
15+
LegacySelectionListHarnessFilters,
16+
LegacyBaseListItemHarnessFilters,
17+
LegacyListItemHarnessFilters,
18+
LegacyActionListItemHarnessFilters,
19+
LegacyNavListItemHarnessFilters,
20+
LegacyListOptionHarnessFilters,
21+
LegacySubheaderHarnessFilters,
22+
} from './list-harness-filters';
23+
export {MatLegacyNavListHarness, MatLegacyNavListItemHarness} from './nav-list-harness';
24+
export {MatLegacySelectionListHarness, MatLegacyListOptionHarness} from './selection-list-harness';
1425
export {MatLegacyListItemSection} from './list-item-harness-base';

src/material/legacy-list/testing/selection-list-harness.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ import {HarnessPredicate, parallel} from '@angular/cdk/testing';
1010
import {MatLegacyListOptionCheckboxPosition} from '@angular/material/legacy-list';
1111
import {MatLegacyListHarnessBase} from './list-harness-base';
1212
import {
13-
ListItemHarnessFilters,
14-
ListOptionHarnessFilters,
15-
SelectionListHarnessFilters,
13+
LegacyListItemHarnessFilters,
14+
LegacyListOptionHarnessFilters,
15+
LegacySelectionListHarnessFilters,
1616
} from './list-harness-filters';
1717
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';
1818

1919
/** Harness for interacting with a standard mat-selection-list in tests. */
2020
export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
2121
typeof MatLegacyListOptionHarness,
2222
MatLegacyListOptionHarness,
23-
ListOptionHarnessFilters
23+
LegacyListOptionHarnessFilters
2424
> {
2525
/** The selector for the host element of a `MatSelectionList` instance. */
2626
static hostSelector = '.mat-selection-list';
@@ -32,7 +32,7 @@ export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
3232
* @return a `HarnessPredicate` configured with the given options.
3333
*/
3434
static with(
35-
options: SelectionListHarnessFilters = {},
35+
options: LegacySelectionListHarnessFilters = {},
3636
): HarnessPredicate<MatLegacySelectionListHarness> {
3737
return new HarnessPredicate(MatLegacySelectionListHarness, options);
3838
}
@@ -48,7 +48,7 @@ export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
4848
* Selects all items matching any of the given filters.
4949
* @param filters Filters that specify which items should be selected.
5050
*/
51-
async selectItems(...filters: ListOptionHarnessFilters[]): Promise<void> {
51+
async selectItems(...filters: LegacyListOptionHarnessFilters[]): Promise<void> {
5252
const items = await this._getItems(filters);
5353
await parallel(() => items.map(item => item.select()));
5454
}
@@ -57,14 +57,14 @@ export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
5757
* Deselects all items matching any of the given filters.
5858
* @param filters Filters that specify which items should be deselected.
5959
*/
60-
async deselectItems(...filters: ListItemHarnessFilters[]): Promise<void> {
60+
async deselectItems(...filters: LegacyListItemHarnessFilters[]): Promise<void> {
6161
const items = await this._getItems(filters);
6262
await parallel(() => items.map(item => item.deselect()));
6363
}
6464

6565
/** Gets all items matching the given list of filters. */
6666
private async _getItems(
67-
filters: ListOptionHarnessFilters[],
67+
filters: LegacyListOptionHarnessFilters[],
6868
): Promise<MatLegacyListOptionHarness[]> {
6969
if (!filters.length) {
7070
return this.getItems();
@@ -88,7 +88,7 @@ export class MatLegacyListOptionHarness extends MatLegacyListItemHarnessBase {
8888
* @return a `HarnessPredicate` configured with the given options.
8989
*/
9090
static with(
91-
options: ListOptionHarnessFilters = {},
91+
options: LegacyListOptionHarnessFilters = {},
9292
): HarnessPredicate<MatLegacyListOptionHarness> {
9393
return getListItemPredicate(MatLegacyListOptionHarness, options).addOption(
9494
'is selected',

0 commit comments

Comments
 (0)