Skip to content

Commit 66a87f2

Browse files
committed
refactor(material/legacy-chips): rename ts symbols
1 parent 9fcd1e9 commit 66a87f2

17 files changed

+123
-84
lines changed

src/material/legacy-chips/chip-default-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ export interface MatLegacyChipsDefaultOptions {
1515
}
1616

1717
/** Injection token to be used to override the default options for the chips module. */
18-
export const MAT_CHIPS_DEFAULT_OPTIONS = new InjectionToken<MatLegacyChipsDefaultOptions>(
18+
export const MAT_LEGACY_CHIPS_DEFAULT_OPTIONS = new InjectionToken<MatLegacyChipsDefaultOptions>(
1919
'mat-chips-default-options',
2020
);

src/material/legacy-chips/chip-input.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
88
import {By} from '@angular/platform-browser';
99
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
1010
import {Subject} from 'rxjs';
11-
import {MAT_CHIPS_DEFAULT_OPTIONS, MatLegacyChipsDefaultOptions} from './chip-default-options';
11+
import {
12+
MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
13+
MatLegacyChipsDefaultOptions,
14+
} from './chip-default-options';
1215
import {MatLegacyChipInput, MatLegacyChipInputEvent} from './chip-input';
1316
import {MatLegacyChipList} from './chip-list';
1417
import {MatLegacyChipsModule} from './index';
@@ -225,7 +228,7 @@ describe('MatChipInput', () => {
225228
declarations: [TestChipInput],
226229
providers: [
227230
{
228-
provide: MAT_CHIPS_DEFAULT_OPTIONS,
231+
provide: MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
229232
useValue: {separatorKeyCodes: [COMMA]} as MatLegacyChipsDefaultOptions,
230233
},
231234
],

src/material/legacy-chips/chip-input.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import {
1919
OnDestroy,
2020
Output,
2121
} from '@angular/core';
22-
import {MatLegacyChipsDefaultOptions, MAT_CHIPS_DEFAULT_OPTIONS} from './chip-default-options';
22+
import {
23+
MatLegacyChipsDefaultOptions,
24+
MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
25+
} from './chip-default-options';
2326
import {MatLegacyChipList} from './chip-list';
2427
import {MatLegacyChipTextControl} from './chip-text-control';
2528

@@ -132,7 +135,7 @@ export class MatLegacyChipInput
132135

133136
constructor(
134137
protected _elementRef: ElementRef<HTMLInputElement>,
135-
@Inject(MAT_CHIPS_DEFAULT_OPTIONS) private _defaultOptions: MatLegacyChipsDefaultOptions,
138+
@Inject(MAT_LEGACY_CHIPS_DEFAULT_OPTIONS) private _defaultOptions: MatLegacyChipsDefaultOptions,
136139
) {
137140
this.inputElement = this._elementRef.nativeElement as HTMLInputElement;
138141
}

src/material/legacy-chips/chip.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ export class MatLegacyChipSelectionChange {
6767
* alternative token to the actual `MatChipRemove` class which could cause unnecessary
6868
* retention of the class and its directive metadata.
6969
*/
70-
export const MAT_CHIP_REMOVE = new InjectionToken<MatLegacyChipRemove>('MatChipRemove');
70+
export const MAT_LEGACY_CHIP_REMOVE = new InjectionToken<MatLegacyChipRemove>('MatChipRemove');
7171

7272
/**
7373
* Injection token that can be used to reference instances of `MatChipAvatar`. It serves as
7474
* alternative token to the actual `MatChipAvatar` class which could cause unnecessary
7575
* retention of the class and its directive metadata.
7676
*/
77-
export const MAT_CHIP_AVATAR = new InjectionToken<MatLegacyChipAvatar>('MatChipAvatar');
77+
export const MAT_LEGACY_CHIP_AVATAR = new InjectionToken<MatLegacyChipAvatar>('MatChipAvatar');
7878

7979
/**
8080
* Injection token that can be used to reference instances of `MatChipTrailingIcon`. It serves as
8181
* alternative token to the actual `MatChipTrailingIcon` class which could cause unnecessary
8282
* retention of the class and its directive metadata.
8383
*/
84-
export const MAT_CHIP_TRAILING_ICON = new InjectionToken<MatLegacyChipTrailingIcon>(
84+
export const MAT_LEGACY_CHIP_TRAILING_ICON = new InjectionToken<MatLegacyChipTrailingIcon>(
8585
'MatChipTrailingIcon',
8686
);
8787

@@ -101,7 +101,7 @@ const _MatChipMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(MatChipBas
101101
@Directive({
102102
selector: 'mat-chip-avatar, [matChipAvatar]',
103103
host: {'class': 'mat-chip-avatar'},
104-
providers: [{provide: MAT_CHIP_AVATAR, useExisting: MatLegacyChipAvatar}],
104+
providers: [{provide: MAT_LEGACY_CHIP_AVATAR, useExisting: MatLegacyChipAvatar}],
105105
})
106106
export class MatLegacyChipAvatar {}
107107

@@ -112,7 +112,7 @@ export class MatLegacyChipAvatar {}
112112
@Directive({
113113
selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
114114
host: {'class': 'mat-chip-trailing-icon'},
115-
providers: [{provide: MAT_CHIP_TRAILING_ICON, useExisting: MatLegacyChipTrailingIcon}],
115+
providers: [{provide: MAT_LEGACY_CHIP_TRAILING_ICON, useExisting: MatLegacyChipTrailingIcon}],
116116
})
117117
export class MatLegacyChipTrailingIcon {}
118118

@@ -197,13 +197,13 @@ export class MatLegacyChip
197197
_chipListDisabled: boolean = false;
198198

199199
/** The chip avatar */
200-
@ContentChild(MAT_CHIP_AVATAR) avatar: MatLegacyChipAvatar;
200+
@ContentChild(MAT_LEGACY_CHIP_AVATAR) avatar: MatLegacyChipAvatar;
201201

202202
/** The chip's trailing icon. */
203-
@ContentChild(MAT_CHIP_TRAILING_ICON) trailingIcon: MatLegacyChipTrailingIcon;
203+
@ContentChild(MAT_LEGACY_CHIP_TRAILING_ICON) trailingIcon: MatLegacyChipTrailingIcon;
204204

205205
/** The chip's remove toggler. */
206-
@ContentChild(MAT_CHIP_REMOVE) removeIcon: MatLegacyChipRemove;
206+
@ContentChild(MAT_LEGACY_CHIP_REMOVE) removeIcon: MatLegacyChipRemove;
207207

208208
/** ARIA role that should be applied to the chip. */
209209
@Input() role: string = 'option';
@@ -477,7 +477,7 @@ export class MatLegacyChip
477477
'class': 'mat-chip-remove mat-chip-trailing-icon',
478478
'(click)': '_handleClick($event)',
479479
},
480-
providers: [{provide: MAT_CHIP_REMOVE, useExisting: MatLegacyChipRemove}],
480+
providers: [{provide: MAT_LEGACY_CHIP_REMOVE, useExisting: MatLegacyChipRemove}],
481481
})
482482
export class MatLegacyChipRemove {
483483
constructor(protected _parentChip: MatLegacyChip, elementRef: ElementRef<HTMLElement>) {

src/material/legacy-chips/chips-module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import {
1515
MatLegacyChipRemove,
1616
MatLegacyChipTrailingIcon,
1717
} from './chip';
18-
import {MAT_CHIPS_DEFAULT_OPTIONS, MatLegacyChipsDefaultOptions} from './chip-default-options';
18+
import {
19+
MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
20+
MatLegacyChipsDefaultOptions,
21+
} from './chip-default-options';
1922
import {MatLegacyChipInput} from './chip-input';
2023
import {MatLegacyChipList} from './chip-list';
2124

@@ -35,7 +38,7 @@ const CHIP_DECLARATIONS = [
3538
providers: [
3639
ErrorStateMatcher,
3740
{
38-
provide: MAT_CHIPS_DEFAULT_OPTIONS,
41+
provide: MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
3942
useValue: {
4043
separatorKeyCodes: [ENTER],
4144
} as MatLegacyChipsDefaultOptions,

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

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

9-
export * from './chips-module';
10-
export * from './chip-list';
11-
export * from './chip';
12-
export * from './chip-input';
13-
export * from './chip-default-options';
9+
export {MatLegacyChipsModule} from './chips-module';
10+
export {MatLegacyChipListChange, MatLegacyChipList} from './chip-list';
11+
export {
12+
MatLegacyChipEvent,
13+
MatLegacyChipSelectionChange,
14+
MAT_LEGACY_CHIP_REMOVE,
15+
MAT_LEGACY_CHIP_AVATAR,
16+
MAT_LEGACY_CHIP_TRAILING_ICON,
17+
MatLegacyChipAvatar,
18+
MatLegacyChipTrailingIcon,
19+
MatLegacyChip,
20+
MatLegacyChipRemove,
21+
} from './chip';
22+
export {MatLegacyChipInputEvent, MatLegacyChipInput} from './chip-input';
23+
export {
24+
MatLegacyChipsDefaultOptions,
25+
MAT_LEGACY_CHIPS_DEFAULT_OPTIONS,
26+
} from './chip-default-options';

src/material/legacy-chips/testing/chip-avatar-harness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {HarnessPredicate, ComponentHarness} from '@angular/cdk/testing';
10-
import {ChipAvatarHarnessFilters} from './chip-harness-filters';
10+
import {LegacyChipAvatarHarnessFilters} from './chip-harness-filters';
1111

1212
/** Harness for interacting with a standard Material chip avatar in tests. */
1313
export class MatLegacyChipAvatarHarness extends ComponentHarness {
@@ -20,7 +20,7 @@ export class MatLegacyChipAvatarHarness extends ComponentHarness {
2020
* @return a `HarnessPredicate` configured with the given options.
2121
*/
2222
static with(
23-
options: ChipAvatarHarnessFilters = {},
23+
options: LegacyChipAvatarHarnessFilters = {},
2424
): HarnessPredicate<MatLegacyChipAvatarHarness> {
2525
return new HarnessPredicate(MatLegacyChipAvatarHarness, options);
2626
}

src/material/legacy-chips/testing/chip-harness-filters.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,39 @@
88
import {BaseHarnessFilters} from '@angular/cdk/testing';
99

1010
/** A set of criteria that can be used to filter a list of chip instances. */
11-
export interface ChipHarnessFilters extends BaseHarnessFilters {
11+
export interface LegacyChipHarnessFilters extends BaseHarnessFilters {
1212
/** Only find instances whose text matches the given value. */
1313
text?: string | RegExp;
1414
/**
1515
* Only find chip instances whose selected state matches the given value.
16-
* @deprecated Use `MatChipOptionHarness` together with `ChipOptionHarnessFilters`.
16+
* @deprecated Use Legacy Chip Option Harness together with Legacy Chip Option Harness Filters.
1717
* @breaking-change 12.0.0
1818
*/
1919
selected?: boolean;
2020
}
2121

2222
/** A set of criteria that can be used to filter a list of selectable chip instances. */
23-
export interface ChipOptionHarnessFilters extends ChipHarnessFilters {
23+
export interface LegacyChipOptionHarnessFilters extends LegacyChipHarnessFilters {
2424
/** Only find chip instances whose selected state matches the given value. */
2525
selected?: boolean;
2626
}
2727

2828
/** A set of criteria that can be used to filter chip list instances. */
29-
export interface ChipListHarnessFilters extends BaseHarnessFilters {}
29+
export interface LegacyChipListHarnessFilters extends BaseHarnessFilters {}
3030

3131
/** A set of criteria that can be used to filter selectable chip list instances. */
32-
export interface ChipListboxHarnessFilters extends BaseHarnessFilters {}
32+
export interface LegacyChipListboxHarnessFilters extends BaseHarnessFilters {}
3333

3434
/** A set of criteria that can be used to filter a list of `MatChipListInputHarness` instances. */
35-
export interface ChipInputHarnessFilters extends BaseHarnessFilters {
35+
export interface LegacyChipInputHarnessFilters extends BaseHarnessFilters {
3636
/** Filters based on the value of the input. */
3737
value?: string | RegExp;
3838
/** Filters based on the placeholder text of the input. */
3939
placeholder?: string | RegExp;
4040
}
4141

4242
/** A set of criteria that can be used to filter a list of `MatChipRemoveHarness` instances. */
43-
export interface ChipRemoveHarnessFilters extends BaseHarnessFilters {}
43+
export interface LegacyChipRemoveHarnessFilters extends BaseHarnessFilters {}
4444

4545
/** A set of criteria that can be used to filter a list of `MatChipAvatarHarness` instances. */
46-
export interface ChipAvatarHarnessFilters extends BaseHarnessFilters {}
46+
export interface LegacyChipAvatarHarnessFilters extends BaseHarnessFilters {}

src/material/legacy-chips/testing/chip-harness.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import {ContentContainerComponentHarness, HarnessPredicate, TestKey} from '@angular/cdk/testing';
1010
import {MatLegacyChipAvatarHarness} from './chip-avatar-harness';
1111
import {
12-
ChipAvatarHarnessFilters,
13-
ChipHarnessFilters,
14-
ChipRemoveHarnessFilters,
12+
LegacyChipAvatarHarnessFilters,
13+
LegacyChipHarnessFilters,
14+
LegacyChipRemoveHarnessFilters,
1515
} from './chip-harness-filters';
1616
import {MatLegacyChipRemoveHarness} from './chip-remove-harness';
1717

@@ -26,7 +26,7 @@ export class MatLegacyChipHarness extends ContentContainerComponentHarness {
2626
* @param options Options for filtering which chip instances are considered a match.
2727
* @return a `HarnessPredicate` configured with the given options.
2828
*/
29-
static with(options: ChipHarnessFilters = {}): HarnessPredicate<MatLegacyChipHarness> {
29+
static with(options: LegacyChipHarnessFilters = {}): HarnessPredicate<MatLegacyChipHarness> {
3030
return new HarnessPredicate(MatLegacyChipHarness, options)
3131
.addOption('text', options.text, (harness, label) =>
3232
HarnessPredicate.stringMatches(harness.getText(), label),
@@ -100,7 +100,7 @@ export class MatLegacyChipHarness extends ContentContainerComponentHarness {
100100
* @param filter Optionally filters which remove buttons are included.
101101
*/
102102
async getRemoveButton(
103-
filter: ChipRemoveHarnessFilters = {},
103+
filter: LegacyChipRemoveHarnessFilters = {},
104104
): Promise<MatLegacyChipRemoveHarness> {
105105
return this.locatorFor(MatLegacyChipRemoveHarness.with(filter))();
106106
}
@@ -110,7 +110,7 @@ export class MatLegacyChipHarness extends ContentContainerComponentHarness {
110110
* @param filter Optionally filters which avatars are included.
111111
*/
112112
async getAvatar(
113-
filter: ChipAvatarHarnessFilters = {},
113+
filter: LegacyChipAvatarHarnessFilters = {},
114114
): Promise<MatLegacyChipAvatarHarness | null> {
115115
return this.locatorForOptional(MatLegacyChipAvatarHarness.with(filter))();
116116
}

src/material/legacy-chips/testing/chip-input-harness.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {HarnessPredicate, ComponentHarness, TestKey} from '@angular/cdk/testing';
10-
import {ChipInputHarnessFilters} from './chip-harness-filters';
10+
import {LegacyChipInputHarnessFilters} from './chip-harness-filters';
1111

1212
/** Harness for interacting with a standard Material chip inputs in tests. */
1313
export class MatLegacyChipInputHarness extends ComponentHarness {
@@ -19,7 +19,9 @@ export class MatLegacyChipInputHarness extends ComponentHarness {
1919
* @param options Options for filtering which input instances are considered a match.
2020
* @return a `HarnessPredicate` configured with the given options.
2121
*/
22-
static with(options: ChipInputHarnessFilters = {}): HarnessPredicate<MatLegacyChipInputHarness> {
22+
static with(
23+
options: LegacyChipInputHarnessFilters = {},
24+
): HarnessPredicate<MatLegacyChipInputHarness> {
2325
return new HarnessPredicate(MatLegacyChipInputHarness, options)
2426
.addOption('value', options.value, async (harness, value) => {
2527
return (await harness.getValue()) === value;

0 commit comments

Comments
 (0)