Skip to content

Commit 64932e2

Browse files
mmalerbajelbourn
authored andcommitted
build: fix rebase conflict between autocomplete harness and selector filter (#16918)
1 parent e14df64 commit 64932e2

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

src/material-experimental/mdc-autocomplete/harness/autocomplete-harness-filters.ts

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

9-
export type AutocompleteHarnessFilters = {
10-
id?: string;
11-
name?: string,
12-
};
9+
import {BaseHarnessFilters} from '@angular/cdk-experimental/testing';
10+
11+
export interface AutocompleteHarnessFilters extends BaseHarnessFilters {}

src/material-experimental/mdc-autocomplete/harness/autocomplete-harness.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ function runTests() {
5656
});
5757

5858
it('should be able to get text inside the input', async () => {
59-
const input = await loader.getHarness(harness.with({id: 'prefilled'}));
59+
const input = await loader.getHarness(harness.with({selector: '#prefilled'}));
6060
expect(await input.getText()).toBe('Prefilled value');
6161
});
6262

6363
it('should get disabled state', async () => {
64-
const enabled = await loader.getHarness(harness.with({id: 'plain'}));
65-
const disabled = await loader.getHarness(harness.with({id: 'disabled'}));
64+
const enabled = await loader.getHarness(harness.with({selector: '#plain'}));
65+
const disabled = await loader.getHarness(harness.with({selector: '#disabled'}));
6666

6767
expect(await enabled.isDisabled()).toBe(false);
6868
expect(await disabled.isDisabled()).toBe(true);
6969
});
7070

7171
it('should focus and blur an input', async () => {
72-
const input = await loader.getHarness(harness.with({id: 'plain'}));
72+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
7373
expect(getActiveElementId()).not.toBe('plain');
7474
await input.focus();
7575
expect(getActiveElementId()).toBe('plain');
@@ -78,19 +78,19 @@ function runTests() {
7878
});
7979

8080
it('should be able to type in an input', async () => {
81-
const input = await loader.getHarness(harness.with({id: 'plain'}));
81+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
8282
await input.enterText('Hello there');
8383
expect(await input.getText()).toBe('Hello there');
8484
});
8585

8686
it('should be able to get the autocomplete panel', async () => {
87-
const input = await loader.getHarness(harness.with({id: 'plain'}));
87+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
8888
await input.focus();
8989
expect(await input.getPanel()).toBeTruthy();
9090
});
9191

9292
it('should be able to get the autocomplete panel options', async () => {
93-
const input = await loader.getHarness(harness.with({id: 'plain'}));
93+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
9494
await input.focus();
9595
const options = await input.getOptions();
9696

@@ -99,7 +99,7 @@ function runTests() {
9999
});
100100

101101
it('should be able to get the autocomplete panel groups', async () => {
102-
const input = await loader.getHarness(harness.with({id: 'grouped'}));
102+
const input = await loader.getHarness(harness.with({selector: '#grouped'}));
103103
await input.focus();
104104
const groups = await input.getOptionGroups();
105105
const options = await input.getOptions();
@@ -113,13 +113,13 @@ function runTests() {
113113
fixture.componentInstance.states = [];
114114
fixture.detectChanges();
115115

116-
const input = await loader.getHarness(harness.with({id: 'plain'}));
116+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
117117
await input.focus();
118118
expect(await input.isPanelVisible()).toBe(false);
119119
});
120120

121121
it('should be able to get whether the autocomplete is open', async () => {
122-
const input = await loader.getHarness(harness.with({id: 'plain'}));
122+
const input = await loader.getHarness(harness.with({selector: '#plain'}));
123123

124124
expect(await input.isOpen()).toBe(false);
125125
await input.focus();

src/material-experimental/mdc-autocomplete/harness/autocomplete-harness.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ export class MatAutocompleteHarness extends ComponentHarness {
3434
* @return a `HarnessPredicate` configured with the given options.
3535
*/
3636
static with(options: AutocompleteHarnessFilters = {}): HarnessPredicate<MatAutocompleteHarness> {
37-
return new HarnessPredicate(MatAutocompleteHarness)
38-
.addOption('name', options.name,
39-
async (harness, name) => (await harness.getAttribute('name')) === name)
40-
.addOption('id', options.id,
41-
async (harness, id) => (await harness.getAttribute('id')) === id);
37+
return new HarnessPredicate(MatAutocompleteHarness, options);
4238
}
4339

4440
async getAttribute(attributeName: string): Promise<string|null> {

0 commit comments

Comments
 (0)