Skip to content

Commit 8f1b8f5

Browse files
fix(components/lookup): rename harness filters textContent property to text to satisfy conventions (#526)
1 parent 7df9437 commit 8f1b8f5

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

libs/components/lookup/testing/src/autocomplete/autocomplete-harness.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('Autocomplete harness', () => {
7272
const results = await autocompleteHarness.getSearchResults();
7373

7474
await expectAsync(results[0].getDescriptorValue()).toBeResolvedTo('Red');
75-
await expectAsync(results[0].textContent()).toBeResolvedTo('Red');
75+
await expectAsync(results[0].getText()).toBeResolvedTo('Red');
7676
});
7777

7878
it('should return search results text content', async () => {
@@ -113,7 +113,7 @@ describe('Autocomplete harness', () => {
113113

114114
await autocompleteHarness.enterText('r');
115115
await autocompleteHarness.selectSearchResult({
116-
textContent: 'Green',
116+
text: 'Green',
117117
});
118118

119119
await expectAsync(autocompleteHarness.getValue()).toBeResolvedTo('Green');
@@ -127,7 +127,7 @@ describe('Autocomplete harness', () => {
127127
// First, set a value on the autocomplete.
128128
await autocompleteHarness.enterText('r');
129129
await autocompleteHarness.selectSearchResult({
130-
textContent: 'Green',
130+
text: 'Green',
131131
});
132132
await expectAsync(autocompleteHarness.getValue()).toBeResolvedTo('Green');
133133

@@ -157,10 +157,10 @@ describe('Autocomplete harness', () => {
157157

158158
await expectAsync(
159159
autocompleteHarness.getSearchResults({
160-
textContent: /invalidsearchtext/,
160+
text: /invalidsearchtext/,
161161
})
162162
).toBeRejectedWithError(
163-
'Could not find search results matching filter(s): {"textContent":"/invalidsearchtext/"}'
163+
'Could not find search results matching filter(s): {"text":"/invalidsearchtext/"}'
164164
);
165165
});
166166

@@ -187,7 +187,7 @@ describe('Autocomplete harness', () => {
187187
const results = await autocompleteHarness.getSearchResults();
188188

189189
await expectAsync(results[0].getDescriptorValue()).toBeResolvedTo('Red');
190-
await expectAsync(results[0].textContent()).toBeResolvedTo('Red ID: 1');
190+
await expectAsync(results[0].getText()).toBeResolvedTo('Red ID: 1');
191191
});
192192

193193
it('should query child harnesses', async () => {

libs/components/lookup/testing/src/autocomplete/autocomplete-harness.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class SkyAutocompleteHarness extends SkyComponentHarness {
7878

7979
if (filters && harnesses.length === 0) {
8080
// Stringify the regular expression so that it's readable in the console log.
81-
if (filters.textContent instanceof RegExp) {
82-
filters.textContent = filters.textContent.toString();
81+
if (filters.text instanceof RegExp) {
82+
filters.text = filters.text.toString();
8383
}
8484

8585
throw new Error(
@@ -102,7 +102,7 @@ export class SkyAutocompleteHarness extends SkyComponentHarness {
102102

103103
const text: string[] = [];
104104
for (const harness of harnesses) {
105-
text.push(await harness.textContent());
105+
text.push(await harness.getText());
106106
}
107107

108108
return text;

libs/components/lookup/testing/src/autocomplete/autocomplete-search-result-harness-filters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export interface SkyAutocompleteSearchResultHarnessFilters
99
/**
1010
* Only find instances whose content matches the given value.
1111
*/
12-
textContent?: string | RegExp;
12+
text?: string | RegExp;
1313
}

libs/components/lookup/testing/src/autocomplete/autocomplete-search-result-harness.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export class SkyAutocompleteSearchResultHarness extends ComponentHarness {
2626
return new HarnessPredicate(
2727
SkyAutocompleteSearchResultHarness,
2828
filters
29-
).addOption('textContent', filters.textContent, async (harness, text) =>
30-
HarnessPredicate.stringMatches(await harness.textContent(), text)
29+
).addOption('textContent', filters.text, async (harness, text) =>
30+
HarnessPredicate.stringMatches(await harness.getText(), text)
3131
);
3232
}
3333

@@ -58,9 +58,9 @@ export class SkyAutocompleteSearchResultHarness extends ComponentHarness {
5858
}
5959

6060
/**
61-
* Returns the text content of the search result.
61+
* Returns the text of the search result.
6262
*/
63-
public async textContent(): Promise<string> {
63+
public async getText(): Promise<string> {
6464
return (await this.host()).text();
6565
}
6666
}

libs/components/lookup/testing/src/lookup/lookup-harness.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function testSingleSelect(dataSkyId: string) {
4444
const results = await lookupHarness.getSearchResults();
4545

4646
await expectAsync(results[0].getDescriptorValue()).toBeResolvedTo('Abed');
47-
await expectAsync(results[0].textContent()).toBeResolvedTo('Abed');
47+
await expectAsync(results[0].getText()).toBeResolvedTo('Abed');
4848
});
4949

5050
it('should select one option from the autocomplete results', async () => {
@@ -56,7 +56,7 @@ function testSingleSelect(dataSkyId: string) {
5656

5757
await lookupHarness.enterText('d');
5858
await lookupHarness.selectSearchResult({
59-
textContent: 'Leonard',
59+
text: 'Leonard',
6060
});
6161

6262
await expectAsync(lookupHarness.getValue()).toBeResolvedTo('Leonard');
@@ -312,7 +312,7 @@ describe('Lookup harness', () => {
312312
const results = await lookupHarness.getSearchResults();
313313

314314
await expectAsync(results[0].getDescriptorValue()).toBeResolvedTo('Abed');
315-
await expectAsync(results[0].textContent()).toBeResolvedTo(
315+
await expectAsync(results[0].getText()).toBeResolvedTo(
316316
'Abed (Mr. Nadir)'
317317
);
318318
});

0 commit comments

Comments
 (0)