@skyux/lookup 13.0.0-alpha.8 → 13.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/skyux-lookup-testing.mjs +60 -37
- package/fesm2022/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2022/skyux-lookup.mjs +25 -43
- package/fesm2022/skyux-lookup.mjs.map +1 -1
- package/index.d.ts +6 -6
- package/package.json +11 -11
- package/testing/index.d.ts +32 -5
|
@@ -121,22 +121,27 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
121
121
|
return await this.#getInput();
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* Gets a specific autocomplete search result based on the filter criteria.
|
|
125
|
+
* @param filter The filter criteria.
|
|
126
|
+
*/
|
|
127
|
+
async getSearchResult(filter) {
|
|
128
|
+
const overlay = await this.#getOverlay();
|
|
129
|
+
if (!overlay) {
|
|
130
|
+
throw new Error('Unable to retrieve search result. The autocomplete is closed.');
|
|
131
|
+
}
|
|
132
|
+
return await overlay.queryHarness(SkyAutocompleteSearchResultHarness.with(filter));
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets an array of autocomplete search results based on the filter criteria.
|
|
136
|
+
* If no filter is provided, returns all autocomplete search results.
|
|
137
|
+
* @param filters The optional filter criteria.
|
|
125
138
|
*/
|
|
126
139
|
async getSearchResults(filters) {
|
|
127
140
|
const overlay = await this.#getOverlay();
|
|
128
141
|
if (!overlay) {
|
|
129
142
|
throw new Error('Unable to retrieve search results. The autocomplete is closed.');
|
|
130
143
|
}
|
|
131
|
-
|
|
132
|
-
if (filters && harnesses.length === 0) {
|
|
133
|
-
// Stringify the regular expression so that it's readable in the console log.
|
|
134
|
-
if (filters.text instanceof RegExp) {
|
|
135
|
-
filters.text = filters.text.toString();
|
|
136
|
-
}
|
|
137
|
-
throw new Error(`Could not find search results matching filter(s): ${JSON.stringify(filters)}`);
|
|
138
|
-
}
|
|
139
|
-
return harnesses;
|
|
144
|
+
return await overlay.queryHarnesses(SkyAutocompleteSearchResultHarness.with(filters || {}));
|
|
140
145
|
}
|
|
141
146
|
/**
|
|
142
147
|
* Returns the text content for each autocomplete search result.
|
|
@@ -339,22 +344,27 @@ class SkyCountryFieldHarness extends SkyAutocompleteHarness {
|
|
|
339
344
|
return await super.getAriaLabelledby();
|
|
340
345
|
}
|
|
341
346
|
/**
|
|
342
|
-
*
|
|
347
|
+
* Gets a specific country field search result based on the filter criteria.
|
|
348
|
+
* @param filter The filter criteria.
|
|
349
|
+
*/
|
|
350
|
+
async getSearchResult(filter) {
|
|
351
|
+
const overlay = await this.#getOverlay();
|
|
352
|
+
if (!overlay) {
|
|
353
|
+
throw new Error('Unable to retrieve search result. The country field is closed.');
|
|
354
|
+
}
|
|
355
|
+
return await overlay.queryHarness(SkyCountryFieldSearchResultHarness.with(filter));
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Gets an array of country field search results based on the filter criteria.
|
|
359
|
+
* If no filter is provided, returns all country field search results.
|
|
360
|
+
* @param filters The optional filter criteria.
|
|
343
361
|
*/
|
|
344
362
|
async getSearchResults(filters) {
|
|
345
363
|
const overlay = await this.#getOverlay();
|
|
346
364
|
if (!overlay) {
|
|
347
365
|
throw new Error('Unable to retrieve search results. The country field is closed.');
|
|
348
366
|
}
|
|
349
|
-
|
|
350
|
-
if (filters && harnesses.length === 0) {
|
|
351
|
-
// Stringify the regular expression so that it's readable in the console log.
|
|
352
|
-
if (filters.text instanceof RegExp) {
|
|
353
|
-
filters.text = filters.text.toString();
|
|
354
|
-
}
|
|
355
|
-
throw new Error(`Could not find search results matching filter(s): ${JSON.stringify(filters)}`);
|
|
356
|
-
}
|
|
357
|
-
return harnesses;
|
|
367
|
+
return await overlay.queryHarnesses(SkyCountryFieldSearchResultHarness.with(filters || {}));
|
|
358
368
|
}
|
|
359
369
|
/**
|
|
360
370
|
* Returns the text content for each country field search result.
|
|
@@ -636,7 +646,6 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
636
646
|
await (await this.#getSearchHarness()).enterText(value);
|
|
637
647
|
}
|
|
638
648
|
/**
|
|
639
|
-
*
|
|
640
649
|
* Gets the search input's aria-label.
|
|
641
650
|
*/
|
|
642
651
|
async getSearchAriaLabel() {
|
|
@@ -677,18 +686,27 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
677
686
|
await (await this.#getCancelButton()).click();
|
|
678
687
|
}
|
|
679
688
|
/**
|
|
680
|
-
* Gets a
|
|
689
|
+
* Gets a specific search result based on the filter criteria.
|
|
690
|
+
* @param filter The filter criteria.
|
|
691
|
+
*/
|
|
692
|
+
async getSearchResult(filter) {
|
|
693
|
+
const pickerId = (await (await this.host()).getAttribute('id'));
|
|
694
|
+
return await this.locatorFor(SkyRepeaterItemHarness.with({
|
|
695
|
+
...filter,
|
|
696
|
+
ancestor: `#${pickerId}`,
|
|
697
|
+
}))();
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Gets an array of search results based on the filter criteria.
|
|
701
|
+
* If no filter is provided, returns all search results.
|
|
702
|
+
* @param filters The optional filter criteria.
|
|
681
703
|
*/
|
|
682
704
|
async getSearchResults(filters) {
|
|
683
705
|
const pickerId = (await (await this.host()).getAttribute('id'));
|
|
684
|
-
|
|
706
|
+
return await this.locatorForAll(SkyRepeaterItemHarness.with({
|
|
685
707
|
...(filters || {}),
|
|
686
708
|
ancestor: `#${pickerId}`,
|
|
687
709
|
}))();
|
|
688
|
-
if (filters && harnesses.length === 0) {
|
|
689
|
-
throw new Error(`Could not find search results in the picker matching filter(s): ${JSON.stringify(filters)}`);
|
|
690
|
-
}
|
|
691
|
-
return harnesses;
|
|
692
710
|
}
|
|
693
711
|
/**
|
|
694
712
|
* Clears all selections made.
|
|
@@ -884,22 +902,27 @@ class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
|
884
902
|
return await super.getAriaLabelledby();
|
|
885
903
|
}
|
|
886
904
|
/**
|
|
887
|
-
*
|
|
905
|
+
* Gets a specific lookup search result based on the filter criteria.
|
|
906
|
+
* @param filters The filter criteria.
|
|
907
|
+
*/
|
|
908
|
+
async getSearchResult(filters) {
|
|
909
|
+
const overlay = await this.#getOverlay();
|
|
910
|
+
if (!overlay) {
|
|
911
|
+
throw new Error('Unable to retrieve search result. The lookup is closed.');
|
|
912
|
+
}
|
|
913
|
+
return await overlay.queryHarness(SkyLookupSearchResultHarness.with(filters));
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Gets an array of lookup search results based on the filter criteria.
|
|
917
|
+
* If no filter is provided, returns all lookup search results.
|
|
918
|
+
* @param filters The optional filter criteria.
|
|
888
919
|
*/
|
|
889
920
|
async getSearchResults(filters) {
|
|
890
921
|
const overlay = await this.#getOverlay();
|
|
891
922
|
if (!overlay) {
|
|
892
923
|
throw new Error('Unable to retrieve search results. The lookup is closed.');
|
|
893
924
|
}
|
|
894
|
-
|
|
895
|
-
if (filters && harnesses.length === 0) {
|
|
896
|
-
// Stringify the regular expression so that it's readable in the console log.
|
|
897
|
-
if (filters.text instanceof RegExp) {
|
|
898
|
-
filters.text = filters.text.toString();
|
|
899
|
-
}
|
|
900
|
-
throw new Error(`Could not find search results matching filter(s): ${JSON.stringify(filters)}`);
|
|
901
|
-
}
|
|
902
|
-
return harnesses;
|
|
925
|
+
return await overlay.queryHarnesses(SkyLookupSearchResultHarness.with(filters || {}));
|
|
903
926
|
}
|
|
904
927
|
/**
|
|
905
928
|
* Returns the text content for each lookup search result.
|