@skyux/lookup 8.7.2 → 9.0.0-alpha.1
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/documentation.json +244 -244
- package/esm2022/lib/modules/autocomplete/autocomplete-adapter.service.mjs +61 -0
- package/esm2022/lib/modules/autocomplete/autocomplete-input.directive.mjs +237 -0
- package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.mjs +4 -4
- package/esm2022/lib/modules/autocomplete/autocomplete.component.mjs +817 -0
- package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete.module.mjs +27 -27
- package/esm2022/lib/modules/country-field/country-field.component.mjs +444 -0
- package/{esm2020 → esm2022}/lib/modules/country-field/country-field.module.mjs +19 -19
- package/{esm2020 → esm2022}/lib/modules/lookup/lookup-adapter.service.mjs +4 -4
- package/esm2022/lib/modules/lookup/lookup-autocomplete-adapter.mjs +114 -0
- package/esm2022/lib/modules/lookup/lookup-show-more-modal.component.mjs +270 -0
- package/{esm2020 → esm2022}/lib/modules/lookup/lookup.component.mjs +299 -280
- package/{esm2020 → esm2022}/lib/modules/lookup/lookup.module.mjs +37 -37
- package/esm2022/lib/modules/search/search-adapter.service.mjs +46 -0
- package/esm2022/lib/modules/search/search.component.mjs +285 -0
- package/{esm2020 → esm2022}/lib/modules/search/search.module.mjs +17 -17
- package/{esm2020 → esm2022}/lib/modules/selection-modal/selection-modal-item-selected.pipe.mjs +4 -4
- package/esm2022/lib/modules/selection-modal/selection-modal.component.mjs +201 -0
- package/{esm2020 → esm2022}/lib/modules/selection-modal/selection-modal.module.mjs +27 -27
- package/esm2022/lib/modules/selection-modal/selection-modal.service.mjs +89 -0
- package/esm2022/lib/modules/selection-modal/types/selection-modal-instance.mjs +45 -0
- package/esm2022/lib/modules/shared/sky-lookup-resources.module.mjs +71 -0
- package/esm2022/testing/autocomplete/autocomplete-harness.mjs +155 -0
- package/esm2022/testing/autocomplete/autocomplete-input-harness.mjs +63 -0
- package/esm2022/testing/autocomplete/autocomplete-search-result-harness.mjs +44 -0
- package/esm2022/testing/country-field/country-field-fixture.mjs +118 -0
- package/{esm2020 → esm2022}/testing/country-field/country-field-testing.module.mjs +5 -5
- package/esm2022/testing/lookup/lookup-harness.mjs +76 -0
- package/{esm2020 → esm2022}/testing/search/search-fixture.mjs +18 -19
- package/esm2022/testing/search/search-harness.mjs +80 -0
- package/{esm2020 → esm2022}/testing/search/search-testing.module.mjs +5 -5
- package/esm2022/testing/selection-modal/selection-modal-harness.mjs +122 -0
- package/{fesm2020 → fesm2022}/skyux-lookup-testing.mjs +171 -187
- package/{fesm2020 → fesm2022}/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2022/skyux-lookup.mjs +3707 -0
- package/{fesm2015 → fesm2022}/skyux-lookup.mjs.map +1 -1
- package/lib/modules/autocomplete/autocomplete-input.directive.d.ts +1 -1
- package/lib/modules/autocomplete/autocomplete.component.d.ts +1 -1
- package/lib/modules/country-field/country-field.component.d.ts +1 -1
- package/lib/modules/lookup/lookup-autocomplete-adapter.d.ts +1 -1
- package/lib/modules/lookup/lookup.component.d.ts +1 -1
- package/lib/modules/search/search.component.d.ts +1 -1
- package/package.json +23 -31
- package/esm2020/lib/modules/autocomplete/autocomplete-adapter.service.mjs +0 -64
- package/esm2020/lib/modules/autocomplete/autocomplete-input.directive.mjs +0 -235
- package/esm2020/lib/modules/autocomplete/autocomplete.component.mjs +0 -775
- package/esm2020/lib/modules/country-field/country-field.component.mjs +0 -433
- package/esm2020/lib/modules/lookup/lookup-autocomplete-adapter.mjs +0 -115
- package/esm2020/lib/modules/lookup/lookup-show-more-modal.component.mjs +0 -271
- package/esm2020/lib/modules/search/search-adapter.service.mjs +0 -46
- package/esm2020/lib/modules/search/search.component.mjs +0 -279
- package/esm2020/lib/modules/selection-modal/selection-modal.component.mjs +0 -199
- package/esm2020/lib/modules/selection-modal/selection-modal.service.mjs +0 -92
- package/esm2020/lib/modules/selection-modal/types/selection-modal-instance.mjs +0 -48
- package/esm2020/lib/modules/shared/sky-lookup-resources.module.mjs +0 -71
- package/esm2020/testing/autocomplete/autocomplete-harness.mjs +0 -161
- package/esm2020/testing/autocomplete/autocomplete-input-harness.mjs +0 -63
- package/esm2020/testing/autocomplete/autocomplete-search-result-harness.mjs +0 -44
- package/esm2020/testing/country-field/country-field-fixture.mjs +0 -114
- package/esm2020/testing/lookup/lookup-harness.mjs +0 -82
- package/esm2020/testing/search/search-harness.mjs +0 -86
- package/esm2020/testing/selection-modal/selection-modal-harness.mjs +0 -128
- package/fesm2015/skyux-lookup-testing.mjs +0 -980
- package/fesm2015/skyux-lookup-testing.mjs.map +0 -1
- package/fesm2015/skyux-lookup.mjs +0 -3642
- package/fesm2020/skyux-lookup.mjs +0 -3625
- package/fesm2020/skyux-lookup.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete-default-search-function.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-default-search-function-options.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-input-text-change.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-message-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-message.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-function.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-result.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function-response.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-selection-change.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-show-more-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/country-field/types/country-field-context-token.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/country-field/types/country-field-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/country-field/types/country.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-add-click-callback-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-add-click-event-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-select-mode-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-select-mode.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-config.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-custom-picker-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-custom-picker.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-native-picker-config.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-native-picker-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-add-click-callback-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-add-click-event-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-close-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-context.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-open-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-result.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-search-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-search-result.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/shared/sky-lookup-string-utils.mjs +0 -0
- /package/{esm2020 → esm2022}/skyux-lookup.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/autocomplete/autocomplete-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/autocomplete/autocomplete-search-result-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-selection-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-selection-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-selections-list-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-search-result-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-search-result-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/search/search-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selection-modal/selection-modal-search-result-harness-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selection-modal/selection-modal-search-result-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/skyux-lookup-testing.mjs +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
2
1
|
import { SkyComponentHarness, SkyOverlayHarness } from '@skyux/core/testing';
|
|
3
2
|
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
4
3
|
import { By } from '@angular/platform-browser';
|
|
@@ -14,6 +13,10 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
14
13
|
* @internal
|
|
15
14
|
*/
|
|
16
15
|
class SkyAutocompleteInputHarness extends ComponentHarness {
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
static { this.hostSelector = '[skyAutocomplete]'; }
|
|
17
20
|
/**
|
|
18
21
|
* Blurs the input.
|
|
19
22
|
*/
|
|
@@ -67,16 +70,16 @@ class SkyAutocompleteInputHarness extends ComponentHarness {
|
|
|
67
70
|
return (await this.host()).getAttribute('aria-owns');
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
/**
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
SkyAutocompleteInputHarness.hostSelector = '[skyAutocomplete]';
|
|
74
73
|
|
|
75
74
|
/**
|
|
76
75
|
* Harness for interacting with an autocomplete search results in tests.
|
|
77
76
|
* @internal
|
|
78
77
|
*/
|
|
79
78
|
class SkyAutocompleteSearchResultHarness extends ComponentHarness {
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
static { this.hostSelector = '.sky-autocomplete-result'; }
|
|
80
83
|
/**
|
|
81
84
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
82
85
|
* `SkyAutocompleteSearchResultHarness` that meets certain criteria.
|
|
@@ -110,23 +113,18 @@ class SkyAutocompleteSearchResultHarness extends ComponentHarness {
|
|
|
110
113
|
return (await this.host()).text();
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
|
-
/**
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
|
-
SkyAutocompleteSearchResultHarness.hostSelector = '.sky-autocomplete-result';
|
|
117
116
|
|
|
118
|
-
var _SkyAutocompleteHarness_instances, _SkyAutocompleteHarness_documentRootLocator, _SkyAutocompleteHarness_getInput, _SkyAutocompleteHarness_getOverlay;
|
|
119
117
|
/**
|
|
120
118
|
* Harness for interacting with an autocomplete component in tests.
|
|
121
119
|
* @internal
|
|
122
120
|
*/
|
|
123
121
|
class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
static { this.hostSelector = 'sky-autocomplete'; }
|
|
126
|
+
#documentRootLocator = this.documentRootLocatorFactory();
|
|
127
|
+
#getInput = this.locatorFor(SkyAutocompleteInputHarness);
|
|
130
128
|
/**
|
|
131
129
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
132
130
|
* `SkyAutocompleteHarness` that meets certain criteria.
|
|
@@ -138,31 +136,31 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
138
136
|
* Blurs the autocomplete input.
|
|
139
137
|
*/
|
|
140
138
|
async blur() {
|
|
141
|
-
return (await
|
|
139
|
+
return (await this.#getInput()).blur();
|
|
142
140
|
}
|
|
143
141
|
/**
|
|
144
142
|
* Clears the input value.
|
|
145
143
|
*/
|
|
146
144
|
async clear() {
|
|
147
|
-
return (await
|
|
145
|
+
return (await this.#getInput()).clear();
|
|
148
146
|
}
|
|
149
147
|
/**
|
|
150
148
|
* Enters text into the autocomplete input.
|
|
151
149
|
*/
|
|
152
150
|
async enterText(value) {
|
|
153
|
-
return (await
|
|
151
|
+
return (await this.#getInput()).enterText(value);
|
|
154
152
|
}
|
|
155
153
|
/**
|
|
156
154
|
* Focuses the autocomplete input.
|
|
157
155
|
*/
|
|
158
156
|
async focus() {
|
|
159
|
-
return (await
|
|
157
|
+
return (await this.#getInput()).focus();
|
|
160
158
|
}
|
|
161
159
|
/**
|
|
162
160
|
* Returns search result harnesses.
|
|
163
161
|
*/
|
|
164
162
|
async getSearchResults(filters) {
|
|
165
|
-
const overlay = await
|
|
163
|
+
const overlay = await this.#getOverlay();
|
|
166
164
|
if (!overlay) {
|
|
167
165
|
throw new Error('Unable to retrieve search results. The autocomplete is closed.');
|
|
168
166
|
}
|
|
@@ -191,25 +189,25 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
191
189
|
* Gets the value of the autocomplete input.
|
|
192
190
|
*/
|
|
193
191
|
async getValue() {
|
|
194
|
-
return (await
|
|
192
|
+
return (await this.#getInput()).getValue();
|
|
195
193
|
}
|
|
196
194
|
/**
|
|
197
195
|
* Whether the autocomplete input is disabled.
|
|
198
196
|
*/
|
|
199
197
|
async isDisabled() {
|
|
200
|
-
return (await
|
|
198
|
+
return (await this.#getInput()).isDisabled();
|
|
201
199
|
}
|
|
202
200
|
/**
|
|
203
201
|
* Whether the autocomplete input is focused.
|
|
204
202
|
*/
|
|
205
203
|
async isFocused() {
|
|
206
|
-
return (await
|
|
204
|
+
return (await this.#getInput()).isFocused();
|
|
207
205
|
}
|
|
208
206
|
/**
|
|
209
207
|
* Whether the autocomplete is open.
|
|
210
208
|
*/
|
|
211
209
|
async isOpen() {
|
|
212
|
-
const overlay = await
|
|
210
|
+
const overlay = await this.#getOverlay();
|
|
213
211
|
return !!overlay;
|
|
214
212
|
}
|
|
215
213
|
/**
|
|
@@ -230,7 +228,7 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
230
228
|
* still access this feature, however.)
|
|
231
229
|
*/
|
|
232
230
|
async clickAddButton() {
|
|
233
|
-
const overlay = await
|
|
231
|
+
const overlay = await this.#getOverlay();
|
|
234
232
|
if (!overlay) {
|
|
235
233
|
throw new Error('Unable to find the "Add" button. The autocomplete is closed.');
|
|
236
234
|
}
|
|
@@ -249,7 +247,7 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
249
247
|
* still access this feature, however.)
|
|
250
248
|
*/
|
|
251
249
|
async clickShowMoreButton() {
|
|
252
|
-
const overlay = await
|
|
250
|
+
const overlay = await this.#getOverlay();
|
|
253
251
|
if (!overlay) {
|
|
254
252
|
throw new Error('Unable to find the "Show more" button. ' +
|
|
255
253
|
'The autocomplete is closed.');
|
|
@@ -260,29 +258,25 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
260
258
|
}
|
|
261
259
|
await button.click();
|
|
262
260
|
}
|
|
261
|
+
async #getOverlay() {
|
|
262
|
+
const overlayId = await (await this.#getInput()).getAriaOwns();
|
|
263
|
+
return overlayId
|
|
264
|
+
? this.#documentRootLocator.locatorForOptional(SkyOverlayHarness.with({ selector: `#${overlayId}` }))()
|
|
265
|
+
: null;
|
|
266
|
+
}
|
|
263
267
|
}
|
|
264
|
-
_SkyAutocompleteHarness_documentRootLocator = new WeakMap(), _SkyAutocompleteHarness_getInput = new WeakMap(), _SkyAutocompleteHarness_instances = new WeakSet(), _SkyAutocompleteHarness_getOverlay = async function _SkyAutocompleteHarness_getOverlay() {
|
|
265
|
-
const overlayId = await (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).getAriaOwns();
|
|
266
|
-
return overlayId
|
|
267
|
-
? __classPrivateFieldGet(this, _SkyAutocompleteHarness_documentRootLocator, "f").locatorForOptional(SkyOverlayHarness.with({ selector: `#${overlayId}` }))()
|
|
268
|
-
: null;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* @internal
|
|
272
|
-
*/
|
|
273
|
-
SkyAutocompleteHarness.hostSelector = 'sky-autocomplete';
|
|
274
268
|
|
|
275
|
-
var _SkyCountryFieldFixture_instances, _SkyCountryFieldFixture_debugEl, _SkyCountryFieldFixture_fixture, _SkyCountryFieldFixture_getCountryFlag, _SkyCountryFieldFixture_getAutocompleteElement, _SkyCountryFieldFixture_getInputElement, _SkyCountryFieldFixture_blurInput, _SkyCountryFieldFixture_enterSearch, _SkyCountryFieldFixture_searchAndGetResults, _SkyCountryFieldFixture_searchAndSelect;
|
|
276
269
|
/**
|
|
277
270
|
* Allows interaction with a SKY UX country field component.
|
|
278
271
|
* @internal
|
|
279
272
|
*/
|
|
280
273
|
class SkyCountryFieldFixture {
|
|
274
|
+
#debugEl;
|
|
281
275
|
/**
|
|
282
276
|
* The value of the input field's autocomplete attribute.
|
|
283
277
|
*/
|
|
284
278
|
get autocompleteAttribute() {
|
|
285
|
-
return
|
|
279
|
+
return this.#getInputElement().getAttribute('autocomplete');
|
|
286
280
|
}
|
|
287
281
|
/**
|
|
288
282
|
* A flag indicating if the country flag is currently visible.
|
|
@@ -290,27 +284,25 @@ class SkyCountryFieldFixture {
|
|
|
290
284
|
* and if the hideSelectedCountryFlag option is false.
|
|
291
285
|
*/
|
|
292
286
|
get countryFlagIsVisible() {
|
|
293
|
-
const flag =
|
|
287
|
+
const flag = this.#getCountryFlag();
|
|
294
288
|
return flag !== null;
|
|
295
289
|
}
|
|
296
290
|
/**
|
|
297
291
|
* A flag indicating whether or not the input has been disabled.
|
|
298
292
|
*/
|
|
299
293
|
get disabled() {
|
|
300
|
-
return
|
|
294
|
+
return this.#getInputElement().disabled;
|
|
301
295
|
}
|
|
302
296
|
/**
|
|
303
297
|
* The value of the input field.
|
|
304
298
|
*/
|
|
305
299
|
get searchText() {
|
|
306
|
-
return
|
|
300
|
+
return this.#getInputElement().value;
|
|
307
301
|
}
|
|
302
|
+
#fixture;
|
|
308
303
|
constructor(fixture, skyTestId) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
_SkyCountryFieldFixture_fixture.set(this, void 0);
|
|
312
|
-
__classPrivateFieldSet(this, _SkyCountryFieldFixture_fixture, fixture, "f");
|
|
313
|
-
__classPrivateFieldSet(this, _SkyCountryFieldFixture_debugEl, SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-country-field'), "f");
|
|
304
|
+
this.#fixture = fixture;
|
|
305
|
+
this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-country-field');
|
|
314
306
|
}
|
|
315
307
|
/**
|
|
316
308
|
* Enters the search text into the input field displaying search results, but making no selection.
|
|
@@ -318,15 +310,15 @@ class SkyCountryFieldFixture {
|
|
|
318
310
|
* @returns The list of country names matching the search text.
|
|
319
311
|
*/
|
|
320
312
|
async search(searchText) {
|
|
321
|
-
const resultNodes = await
|
|
313
|
+
const resultNodes = await this.#searchAndGetResults(searchText, this.#fixture);
|
|
322
314
|
const resultArray = Array.prototype.slice.call(resultNodes);
|
|
323
315
|
const results = resultArray.map((result) => {
|
|
324
316
|
const countryNameEl = result.querySelector('.sky-highlight-mark');
|
|
325
317
|
const countryName = SkyAppTestUtility.getText(countryNameEl);
|
|
326
318
|
return countryName;
|
|
327
319
|
});
|
|
328
|
-
|
|
329
|
-
await
|
|
320
|
+
this.#fixture.detectChanges();
|
|
321
|
+
await this.#fixture.whenStable();
|
|
330
322
|
return results;
|
|
331
323
|
}
|
|
332
324
|
/**
|
|
@@ -334,64 +326,71 @@ class SkyCountryFieldFixture {
|
|
|
334
326
|
* @param searchText The name of the country to select.
|
|
335
327
|
*/
|
|
336
328
|
async searchAndSelectFirstResult(searchText) {
|
|
337
|
-
await
|
|
338
|
-
|
|
339
|
-
return
|
|
329
|
+
await this.#searchAndSelect(searchText, 0, this.#fixture);
|
|
330
|
+
this.#fixture.detectChanges();
|
|
331
|
+
return this.#fixture.whenStable();
|
|
340
332
|
}
|
|
341
333
|
/**
|
|
342
334
|
* Clears the country selection and input field.
|
|
343
335
|
*/
|
|
344
336
|
clear() {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return
|
|
337
|
+
this.#enterSearch('', this.#fixture);
|
|
338
|
+
this.#fixture.detectChanges();
|
|
339
|
+
return this.#fixture.whenStable();
|
|
340
|
+
}
|
|
341
|
+
//#region helpers
|
|
342
|
+
#getCountryFlag() {
|
|
343
|
+
return this.#debugEl.query(By.css('.sky-country-field-flag'));
|
|
344
|
+
}
|
|
345
|
+
#getAutocompleteElement() {
|
|
346
|
+
return document.querySelector('.sky-autocomplete-results');
|
|
347
|
+
}
|
|
348
|
+
#getInputElement() {
|
|
349
|
+
const debugEl = this.#debugEl.query(By.css('textarea'));
|
|
350
|
+
return debugEl.nativeElement;
|
|
351
|
+
}
|
|
352
|
+
#blurInput(fixture) {
|
|
353
|
+
SkyAppTestUtility.fireDomEvent(this.#getInputElement(), 'blur');
|
|
354
|
+
fixture.detectChanges();
|
|
355
|
+
return fixture.whenStable();
|
|
356
|
+
}
|
|
357
|
+
#enterSearch(newValue, fixture) {
|
|
358
|
+
const inputElement = this.#getInputElement();
|
|
359
|
+
inputElement.value = newValue;
|
|
360
|
+
SkyAppTestUtility.fireDomEvent(inputElement, 'focus');
|
|
361
|
+
SkyAppTestUtility.fireDomEvent(inputElement, 'keyup');
|
|
362
|
+
SkyAppTestUtility.fireDomEvent(inputElement, 'input');
|
|
363
|
+
fixture.detectChanges();
|
|
364
|
+
return fixture.whenStable();
|
|
365
|
+
}
|
|
366
|
+
async #searchAndGetResults(newValue, fixture) {
|
|
367
|
+
await this.#enterSearch(newValue, fixture);
|
|
368
|
+
fixture.detectChanges();
|
|
369
|
+
await fixture.whenStable();
|
|
370
|
+
return this.#getAutocompleteElement().querySelectorAll('.sky-autocomplete-result');
|
|
371
|
+
}
|
|
372
|
+
async #searchAndSelect(newValue, index, fixture) {
|
|
373
|
+
const inputElement = this.#getInputElement();
|
|
374
|
+
const searchResults = await this.#searchAndGetResults(newValue, fixture);
|
|
375
|
+
if (searchResults.length < index + 1) {
|
|
376
|
+
throw new Error('Index out of range for results');
|
|
377
|
+
}
|
|
378
|
+
// Note: the ordering of these events is important!
|
|
379
|
+
SkyAppTestUtility.fireDomEvent(inputElement, 'change');
|
|
380
|
+
SkyAppTestUtility.fireDomEvent(searchResults[index], 'mousedown');
|
|
381
|
+
this.#blurInput(fixture);
|
|
348
382
|
}
|
|
349
383
|
}
|
|
350
|
-
_SkyCountryFieldFixture_debugEl = new WeakMap(), _SkyCountryFieldFixture_fixture = new WeakMap(), _SkyCountryFieldFixture_instances = new WeakSet(), _SkyCountryFieldFixture_getCountryFlag = function _SkyCountryFieldFixture_getCountryFlag() {
|
|
351
|
-
return __classPrivateFieldGet(this, _SkyCountryFieldFixture_debugEl, "f").query(By.css('.sky-country-field-flag'));
|
|
352
|
-
}, _SkyCountryFieldFixture_getAutocompleteElement = function _SkyCountryFieldFixture_getAutocompleteElement() {
|
|
353
|
-
return document.querySelector('.sky-autocomplete-results');
|
|
354
|
-
}, _SkyCountryFieldFixture_getInputElement = function _SkyCountryFieldFixture_getInputElement() {
|
|
355
|
-
const debugEl = __classPrivateFieldGet(this, _SkyCountryFieldFixture_debugEl, "f").query(By.css('textarea'));
|
|
356
|
-
return debugEl.nativeElement;
|
|
357
|
-
}, _SkyCountryFieldFixture_blurInput = function _SkyCountryFieldFixture_blurInput(fixture) {
|
|
358
|
-
SkyAppTestUtility.fireDomEvent(__classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_getInputElement).call(this), 'blur');
|
|
359
|
-
fixture.detectChanges();
|
|
360
|
-
return fixture.whenStable();
|
|
361
|
-
}, _SkyCountryFieldFixture_enterSearch = function _SkyCountryFieldFixture_enterSearch(newValue, fixture) {
|
|
362
|
-
const inputElement = __classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_getInputElement).call(this);
|
|
363
|
-
inputElement.value = newValue;
|
|
364
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'focus');
|
|
365
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'keyup');
|
|
366
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'input');
|
|
367
|
-
fixture.detectChanges();
|
|
368
|
-
return fixture.whenStable();
|
|
369
|
-
}, _SkyCountryFieldFixture_searchAndGetResults = async function _SkyCountryFieldFixture_searchAndGetResults(newValue, fixture) {
|
|
370
|
-
await __classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_enterSearch).call(this, newValue, fixture);
|
|
371
|
-
fixture.detectChanges();
|
|
372
|
-
await fixture.whenStable();
|
|
373
|
-
return __classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_getAutocompleteElement).call(this).querySelectorAll('.sky-autocomplete-result');
|
|
374
|
-
}, _SkyCountryFieldFixture_searchAndSelect = async function _SkyCountryFieldFixture_searchAndSelect(newValue, index, fixture) {
|
|
375
|
-
const inputElement = __classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_getInputElement).call(this);
|
|
376
|
-
const searchResults = await __classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_searchAndGetResults).call(this, newValue, fixture);
|
|
377
|
-
if (searchResults.length < index + 1) {
|
|
378
|
-
throw new Error('Index out of range for results');
|
|
379
|
-
}
|
|
380
|
-
// Note: the ordering of these events is important!
|
|
381
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'change');
|
|
382
|
-
SkyAppTestUtility.fireDomEvent(searchResults[index], 'mousedown');
|
|
383
|
-
__classPrivateFieldGet(this, _SkyCountryFieldFixture_instances, "m", _SkyCountryFieldFixture_blurInput).call(this, fixture);
|
|
384
|
-
};
|
|
385
384
|
|
|
386
385
|
/**
|
|
387
386
|
* @internal
|
|
388
387
|
*/
|
|
389
388
|
class SkyCountryFieldTestingModule {
|
|
389
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
390
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldTestingModule, exports: [SkyCountryFieldModule] }); }
|
|
391
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldTestingModule, imports: [SkyCountryFieldModule] }); }
|
|
390
392
|
}
|
|
391
|
-
|
|
392
|
-
SkyCountryFieldTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyCountryFieldTestingModule, exports: [SkyCountryFieldModule] });
|
|
393
|
-
SkyCountryFieldTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyCountryFieldTestingModule, imports: [SkyCountryFieldModule] });
|
|
394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyCountryFieldTestingModule, decorators: [{
|
|
393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldTestingModule, decorators: [{
|
|
395
394
|
type: NgModule,
|
|
396
395
|
args: [{
|
|
397
396
|
exports: [SkyCountryFieldModule],
|
|
@@ -423,18 +422,17 @@ class SkyLookupSelectionsListHarness extends SkyTokensHarness {
|
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
424
|
|
|
426
|
-
var _SkySearchHarness_instances, _SkySearchHarness_getInput, _SkySearchHarness_getSubmitButton, _SkySearchHarness_clickSubmitButton;
|
|
427
425
|
/**
|
|
428
426
|
* Harness for interacting with an search component in tests.
|
|
429
427
|
* @internal
|
|
430
428
|
*/
|
|
431
429
|
class SkySearchHarness extends SkyComponentHarness {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
static { this.hostSelector = 'sky-search'; }
|
|
434
|
+
#getInput = this.locatorFor('input.sky-search-input');
|
|
435
|
+
#getSubmitButton = this.locatorFor('button.sky-search-btn-apply');
|
|
438
436
|
/**
|
|
439
437
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
440
438
|
* `SkySearchHarness` that meets certain criteria.
|
|
@@ -446,93 +444,89 @@ class SkySearchHarness extends SkyComponentHarness {
|
|
|
446
444
|
* Blurs the input.
|
|
447
445
|
*/
|
|
448
446
|
async blur() {
|
|
449
|
-
await (await
|
|
447
|
+
await (await this.#getInput()).blur();
|
|
450
448
|
}
|
|
451
449
|
/**
|
|
452
450
|
* Clears the input.
|
|
453
451
|
*/
|
|
454
452
|
async clear() {
|
|
455
|
-
const input = await
|
|
453
|
+
const input = await this.#getInput();
|
|
456
454
|
await input.focus();
|
|
457
455
|
await input.clear();
|
|
458
|
-
await
|
|
456
|
+
await this.#clickSubmitButton();
|
|
459
457
|
}
|
|
460
458
|
/**
|
|
461
459
|
* Enters text into the input and performs a search.
|
|
462
460
|
*/
|
|
463
461
|
async enterText(value) {
|
|
464
|
-
const input = await
|
|
462
|
+
const input = await this.#getInput();
|
|
465
463
|
await input.clear();
|
|
466
464
|
await input.focus();
|
|
467
465
|
await input.sendKeys(value);
|
|
468
|
-
await
|
|
466
|
+
await this.#clickSubmitButton();
|
|
469
467
|
}
|
|
470
468
|
/**
|
|
471
469
|
* Focuses the input.
|
|
472
470
|
*/
|
|
473
471
|
async focus() {
|
|
474
|
-
await (await
|
|
472
|
+
await (await this.#getInput()).focus();
|
|
475
473
|
}
|
|
476
474
|
/**
|
|
477
475
|
* Gets the value of the input's placeholder attribute.
|
|
478
476
|
*/
|
|
479
477
|
async getPlaceholderText() {
|
|
480
|
-
return (await
|
|
478
|
+
return (await this.#getInput()).getAttribute('placeholder');
|
|
481
479
|
}
|
|
482
480
|
/**
|
|
483
481
|
* Gets the value of the input.
|
|
484
482
|
*/
|
|
485
483
|
async getValue() {
|
|
486
|
-
return (await
|
|
484
|
+
return (await this.#getInput()).getProperty('value');
|
|
487
485
|
}
|
|
488
486
|
/**
|
|
489
487
|
* Whether the input is disabled.
|
|
490
488
|
*/
|
|
491
489
|
async isDisabled() {
|
|
492
|
-
const disabled = await (await
|
|
490
|
+
const disabled = await (await this.#getInput()).getAttribute('disabled');
|
|
493
491
|
return disabled !== null;
|
|
494
492
|
}
|
|
495
493
|
/**
|
|
496
494
|
* Whether the input is focused.
|
|
497
495
|
*/
|
|
498
496
|
async isFocused() {
|
|
499
|
-
return (await
|
|
497
|
+
return (await this.#getInput()).isFocused();
|
|
498
|
+
}
|
|
499
|
+
async #clickSubmitButton() {
|
|
500
|
+
return (await this.#getSubmitButton()).click();
|
|
500
501
|
}
|
|
501
502
|
}
|
|
502
|
-
_SkySearchHarness_getInput = new WeakMap(), _SkySearchHarness_getSubmitButton = new WeakMap(), _SkySearchHarness_instances = new WeakSet(), _SkySearchHarness_clickSubmitButton = async function _SkySearchHarness_clickSubmitButton() {
|
|
503
|
-
return (await __classPrivateFieldGet(this, _SkySearchHarness_getSubmitButton, "f").call(this)).click();
|
|
504
|
-
};
|
|
505
|
-
/**
|
|
506
|
-
* @internal
|
|
507
|
-
*/
|
|
508
|
-
SkySearchHarness.hostSelector = 'sky-search';
|
|
509
503
|
|
|
510
|
-
var _SkySelectionModalHarness_getCancelButton, _SkySelectionModalHarness_getClearAllButton, _SkySelectionModalHarness_getInfiniteScroll, _SkySelectionModalHarness_getSaveButton, _SkySelectionModalHarness_getSearchHarness, _SkySelectionModalHarness_getSelectAllButton, _SkySelectionModalHarness_getAddButton;
|
|
511
504
|
/**
|
|
512
505
|
* Harness for interacting with a selection modal in tests.
|
|
513
506
|
*/
|
|
514
507
|
class SkySelectionModalHarness extends ComponentHarness {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
508
|
+
/**
|
|
509
|
+
* @internal
|
|
510
|
+
*/
|
|
511
|
+
static { this.hostSelector = '.sky-lookup-show-more-modal'; }
|
|
512
|
+
#getCancelButton = this.locatorFor('button.sky-lookup-show-more-modal-close');
|
|
513
|
+
#getClearAllButton = this.locatorForOptional('button.sky-lookup-show-more-modal-clear-all-btn');
|
|
514
|
+
#getInfiniteScroll = this.locatorFor(SkyInfiniteScrollHarness);
|
|
515
|
+
#getSaveButton = this.locatorFor('button.sky-lookup-show-more-modal-save');
|
|
516
|
+
#getSearchHarness = this.locatorFor(SkySearchHarness);
|
|
517
|
+
#getSelectAllButton = this.locatorForOptional('button.sky-lookup-show-more-modal-select-all-btn');
|
|
518
|
+
#getAddButton = this.locatorForOptional('button.sky-lookup-show-more-modal-add');
|
|
525
519
|
/**
|
|
526
520
|
* Clears the text of the search input.
|
|
527
521
|
*/
|
|
528
522
|
async clearSearchText() {
|
|
529
|
-
return (await
|
|
523
|
+
return (await this.#getSearchHarness()).clear();
|
|
530
524
|
}
|
|
531
525
|
/**
|
|
532
526
|
* Enters text into the search input and performs a search.
|
|
533
527
|
*/
|
|
534
528
|
async enterSearchText(value) {
|
|
535
|
-
return (await
|
|
529
|
+
return (await this.#getSearchHarness()).enterText(value);
|
|
536
530
|
}
|
|
537
531
|
/**
|
|
538
532
|
* Selects multiple search results based on a set of criteria.
|
|
@@ -553,13 +547,13 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
553
547
|
* Saves any selections made and closes the modal.
|
|
554
548
|
*/
|
|
555
549
|
async saveAndClose() {
|
|
556
|
-
return (await
|
|
550
|
+
return (await this.#getSaveButton()).click();
|
|
557
551
|
}
|
|
558
552
|
/**
|
|
559
553
|
* Closes the picker without saving any selections made.
|
|
560
554
|
*/
|
|
561
555
|
async cancel() {
|
|
562
|
-
return (await
|
|
556
|
+
return (await this.#getCancelButton()).click();
|
|
563
557
|
}
|
|
564
558
|
/**
|
|
565
559
|
* Gets a list of search results.
|
|
@@ -579,7 +573,7 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
579
573
|
* Clears all selections made.
|
|
580
574
|
*/
|
|
581
575
|
async clearAll() {
|
|
582
|
-
const button = await
|
|
576
|
+
const button = await this.#getClearAllButton();
|
|
583
577
|
if (!button) {
|
|
584
578
|
throw new Error('Could not clear all selections because the "Clear all" button could not be found.');
|
|
585
579
|
}
|
|
@@ -595,7 +589,7 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
595
589
|
* Selects all search results.
|
|
596
590
|
*/
|
|
597
591
|
async selectAll() {
|
|
598
|
-
const button = await
|
|
592
|
+
const button = await this.#getSelectAllButton();
|
|
599
593
|
if (!button) {
|
|
600
594
|
throw new Error('Could not select all selections because the "Select all" button could not be found.');
|
|
601
595
|
}
|
|
@@ -605,31 +599,26 @@ class SkySelectionModalHarness extends ComponentHarness {
|
|
|
605
599
|
* Loads more results in the picker.
|
|
606
600
|
*/
|
|
607
601
|
async loadMore() {
|
|
608
|
-
return (await
|
|
602
|
+
return (await this.#getInfiniteScroll()).loadMore();
|
|
609
603
|
}
|
|
610
604
|
/**
|
|
611
605
|
* Whether the selection modal is configured to show the add button.
|
|
612
606
|
*/
|
|
613
607
|
async hasAddButton() {
|
|
614
|
-
const button = await
|
|
608
|
+
const button = await this.#getAddButton();
|
|
615
609
|
return !!button;
|
|
616
610
|
}
|
|
617
611
|
/**
|
|
618
612
|
* Clicks the add button.
|
|
619
613
|
*/
|
|
620
614
|
async clickAddButton() {
|
|
621
|
-
const button = await
|
|
615
|
+
const button = await this.#getAddButton();
|
|
622
616
|
if (!button) {
|
|
623
617
|
throw new Error('Could not click the add button because the button could not be found.');
|
|
624
618
|
}
|
|
625
619
|
await button.click();
|
|
626
620
|
}
|
|
627
621
|
}
|
|
628
|
-
_SkySelectionModalHarness_getCancelButton = new WeakMap(), _SkySelectionModalHarness_getClearAllButton = new WeakMap(), _SkySelectionModalHarness_getInfiniteScroll = new WeakMap(), _SkySelectionModalHarness_getSaveButton = new WeakMap(), _SkySelectionModalHarness_getSearchHarness = new WeakMap(), _SkySelectionModalHarness_getSelectAllButton = new WeakMap(), _SkySelectionModalHarness_getAddButton = new WeakMap();
|
|
629
|
-
/**
|
|
630
|
-
* @internal
|
|
631
|
-
*/
|
|
632
|
-
SkySelectionModalHarness.hostSelector = '.sky-lookup-show-more-modal';
|
|
633
622
|
|
|
634
623
|
/**
|
|
635
624
|
* Harness for interacting with a lookup's "Show more" picker in tests.
|
|
@@ -657,18 +646,21 @@ class SkyLookupShowMorePickerHarness extends SkySelectionModalHarness {
|
|
|
657
646
|
}
|
|
658
647
|
}
|
|
659
648
|
|
|
660
|
-
var _SkyLookupHarness_documentRootLocator, _SkyLookupHarness_getAutocompleteHarness, _SkyLookupHarness_getSelectionsListHarness, _SkyLookupHarness_getWrapper;
|
|
661
649
|
/**
|
|
662
650
|
* Harness for interacting with a lookup component in tests.
|
|
663
651
|
*/
|
|
664
652
|
class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
653
|
+
/**
|
|
654
|
+
* Finds a standard lookup component, or a lookup component that is wrapped by an input box component.
|
|
655
|
+
* For input box implementations, we need to use the `.sky-input-box` selector since the `sky-lookup`
|
|
656
|
+
* element is removed from the DOM.
|
|
657
|
+
* @internal
|
|
658
|
+
*/
|
|
659
|
+
static { this.hostSelector = 'sky-lookup,.sky-input-box'; }
|
|
660
|
+
#documentRootLocator = this.documentRootLocatorFactory();
|
|
661
|
+
#getAutocompleteHarness = this.locatorFor(SkyAutocompleteHarness);
|
|
662
|
+
#getSelectionsListHarness = this.locatorFor(SkyLookupSelectionsListHarness);
|
|
663
|
+
#getWrapper = this.locatorFor('.sky-lookup');
|
|
672
664
|
/**
|
|
673
665
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
674
666
|
* `SkyLookupHarness` that meets certain criteria.
|
|
@@ -694,14 +686,14 @@ class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
|
694
686
|
* Dismisses the selections made with a multiselect lookup.
|
|
695
687
|
*/
|
|
696
688
|
async dismissSelections() {
|
|
697
|
-
return (await
|
|
689
|
+
return (await this.#getSelectionsListHarness()).dismissSelections();
|
|
698
690
|
}
|
|
699
691
|
/**
|
|
700
692
|
* Gets the "Show more" picker harness.
|
|
701
693
|
*/
|
|
702
694
|
async getShowMorePicker() {
|
|
703
|
-
const pickerId = await (await (await
|
|
704
|
-
const defaultPicker = await
|
|
695
|
+
const pickerId = await (await (await this.#getAutocompleteHarness()).host()).getAttribute('data-sky-lookup-show-more-picker-id');
|
|
696
|
+
const defaultPicker = await this.#documentRootLocator.locatorForOptional(SkyLookupShowMorePickerHarness.with({ selector: `#${pickerId}` }))();
|
|
705
697
|
if (!defaultPicker) {
|
|
706
698
|
throw new Error('Cannot get the "Show more" picker because it is not open.');
|
|
707
699
|
}
|
|
@@ -711,29 +703,21 @@ class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
|
711
703
|
* Gets a list of selections made with a multiselect lookup.
|
|
712
704
|
*/
|
|
713
705
|
async getSelections() {
|
|
714
|
-
return (await
|
|
706
|
+
return (await this.#getSelectionsListHarness()).getSelections();
|
|
715
707
|
}
|
|
716
708
|
/**
|
|
717
709
|
* Gets the text content of all selections made with a multiselect lookup.
|
|
718
710
|
*/
|
|
719
711
|
async getSelectionsText() {
|
|
720
|
-
return (await
|
|
712
|
+
return (await this.#getSelectionsListHarness()).getSelectionsText();
|
|
721
713
|
}
|
|
722
714
|
/**
|
|
723
715
|
* Whether the lookup allows for multiple selections.
|
|
724
716
|
*/
|
|
725
717
|
async isMultiselect() {
|
|
726
|
-
return !(await (await
|
|
718
|
+
return !(await (await this.#getWrapper()).hasClass('sky-lookup-single'));
|
|
727
719
|
}
|
|
728
720
|
}
|
|
729
|
-
_SkyLookupHarness_documentRootLocator = new WeakMap(), _SkyLookupHarness_getAutocompleteHarness = new WeakMap(), _SkyLookupHarness_getSelectionsListHarness = new WeakMap(), _SkyLookupHarness_getWrapper = new WeakMap();
|
|
730
|
-
/**
|
|
731
|
-
* Finds a standard lookup component, or a lookup component that is wrapped by an input box component.
|
|
732
|
-
* For input box implementations, we need to use the `.sky-input-box` selector since the `sky-lookup`
|
|
733
|
-
* element is removed from the DOM.
|
|
734
|
-
* @internal
|
|
735
|
-
*/
|
|
736
|
-
SkyLookupHarness.hostSelector = 'sky-lookup,.sky-input-box';
|
|
737
721
|
|
|
738
722
|
/**
|
|
739
723
|
* Harness for interacting with a multiselect lookup selection in tests.
|
|
@@ -755,7 +739,6 @@ class SkySelectionModalSearchResultHarness extends SkyRepeaterItemHarness {
|
|
|
755
739
|
class SkyLookupShowMorePickerSearchResultHarness extends SkySelectionModalSearchResultHarness {
|
|
756
740
|
}
|
|
757
741
|
|
|
758
|
-
var _SkySearchFixture_instances, _SkySearchFixture_debugEl, _SkySearchFixture_getApplyBtnEl, _SkySearchFixture_getClearBtnEl, _SkySearchFixture_getInputEl;
|
|
759
742
|
/**
|
|
760
743
|
* Allows interaction with a SKY UX search component.
|
|
761
744
|
* @deprecated Use `SkySearchHarness` instead.
|
|
@@ -766,18 +749,17 @@ class SkySearchFixture {
|
|
|
766
749
|
* Gets the search's current text.
|
|
767
750
|
*/
|
|
768
751
|
get searchText() {
|
|
769
|
-
return
|
|
752
|
+
return this.#getInputEl().nativeElement.value;
|
|
770
753
|
}
|
|
771
754
|
/**
|
|
772
755
|
* Gets the search's current placeholder text.
|
|
773
756
|
*/
|
|
774
757
|
get placeholderText() {
|
|
775
|
-
return
|
|
758
|
+
return this.#getInputEl().nativeElement.placeholder;
|
|
776
759
|
}
|
|
760
|
+
#debugEl;
|
|
777
761
|
constructor(fixture, skyTestId) {
|
|
778
|
-
|
|
779
|
-
_SkySearchFixture_debugEl.set(this, void 0);
|
|
780
|
-
__classPrivateFieldSet(this, _SkySearchFixture_debugEl, SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-search'), "f");
|
|
762
|
+
this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-search');
|
|
781
763
|
}
|
|
782
764
|
/**
|
|
783
765
|
* Applies the specified search text, invoking the search.
|
|
@@ -786,9 +768,9 @@ class SkySearchFixture {
|
|
|
786
768
|
*/
|
|
787
769
|
apply(searchText) {
|
|
788
770
|
if (searchText) {
|
|
789
|
-
SkyAppTestUtility.setInputValue(
|
|
771
|
+
SkyAppTestUtility.setInputValue(this.#getInputEl().nativeElement, searchText);
|
|
790
772
|
}
|
|
791
|
-
const btnEl =
|
|
773
|
+
const btnEl = this.#getApplyBtnEl();
|
|
792
774
|
btnEl.triggerEventHandler('click', {});
|
|
793
775
|
}
|
|
794
776
|
/**
|
|
@@ -796,32 +778,34 @@ class SkySearchFixture {
|
|
|
796
778
|
* not currently applied, an error is thrown.
|
|
797
779
|
*/
|
|
798
780
|
clear() {
|
|
799
|
-
const clearEl =
|
|
781
|
+
const clearEl = this.#debugEl.query(By.css('.sky-input-group-clear'));
|
|
800
782
|
if (!SkyAppTestUtility.isVisible(clearEl)) {
|
|
801
783
|
throw new Error('There currently is no search text or the current search text has not been applied, ' +
|
|
802
784
|
'so the clear button is not visible.');
|
|
803
785
|
}
|
|
804
|
-
const btnEl =
|
|
786
|
+
const btnEl = this.#getClearBtnEl();
|
|
805
787
|
btnEl.triggerEventHandler('click', {});
|
|
806
788
|
}
|
|
789
|
+
#getApplyBtnEl() {
|
|
790
|
+
return this.#debugEl.query(By.css('.sky-search-btn-apply'));
|
|
791
|
+
}
|
|
792
|
+
#getClearBtnEl() {
|
|
793
|
+
return this.#debugEl.query(By.css('.sky-search-btn-clear'));
|
|
794
|
+
}
|
|
795
|
+
#getInputEl() {
|
|
796
|
+
return this.#debugEl.query(By.css('.sky-search-input'));
|
|
797
|
+
}
|
|
807
798
|
}
|
|
808
|
-
_SkySearchFixture_debugEl = new WeakMap(), _SkySearchFixture_instances = new WeakSet(), _SkySearchFixture_getApplyBtnEl = function _SkySearchFixture_getApplyBtnEl() {
|
|
809
|
-
return __classPrivateFieldGet(this, _SkySearchFixture_debugEl, "f").query(By.css('.sky-search-btn-apply'));
|
|
810
|
-
}, _SkySearchFixture_getClearBtnEl = function _SkySearchFixture_getClearBtnEl() {
|
|
811
|
-
return __classPrivateFieldGet(this, _SkySearchFixture_debugEl, "f").query(By.css('.sky-search-btn-clear'));
|
|
812
|
-
}, _SkySearchFixture_getInputEl = function _SkySearchFixture_getInputEl() {
|
|
813
|
-
return __classPrivateFieldGet(this, _SkySearchFixture_debugEl, "f").query(By.css('.sky-search-input'));
|
|
814
|
-
};
|
|
815
799
|
|
|
816
800
|
/**
|
|
817
801
|
* @internal
|
|
818
802
|
*/
|
|
819
803
|
class SkySearchTestingModule {
|
|
804
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
805
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkySearchTestingModule, exports: [NoopAnimationsModule, SkySearchModule] }); }
|
|
806
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchTestingModule, imports: [NoopAnimationsModule, SkySearchModule] }); }
|
|
820
807
|
}
|
|
821
|
-
|
|
822
|
-
SkySearchTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkySearchTestingModule, exports: [NoopAnimationsModule, SkySearchModule] });
|
|
823
|
-
SkySearchTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkySearchTestingModule, imports: [NoopAnimationsModule, SkySearchModule] });
|
|
824
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkySearchTestingModule, decorators: [{
|
|
808
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchTestingModule, decorators: [{
|
|
825
809
|
type: NgModule,
|
|
826
810
|
args: [{
|
|
827
811
|
exports: [NoopAnimationsModule, SkySearchModule],
|