@skyux/lookup 6.13.0 → 6.16.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/documentation.json +716 -627
- package/esm2020/lib/modules/autocomplete/autocomplete-input.directive.mjs +9 -1
- package/esm2020/lib/modules/autocomplete/autocomplete.component.mjs +10 -4
- package/esm2020/lib/modules/lookup/lookup-show-more-async-modal.component.mjs +8 -7
- package/esm2020/lib/modules/lookup/lookup-show-more-modal.component.mjs +20 -14
- package/esm2020/lib/modules/lookup/lookup.component.mjs +7 -3
- package/esm2020/testing/autocomplete/autocomplete-harness-filters.mjs +2 -0
- package/esm2020/testing/autocomplete/autocomplete-harness.mjs +157 -0
- package/esm2020/testing/autocomplete/autocomplete-input-harness.mjs +60 -0
- package/esm2020/testing/autocomplete/autocomplete-search-result-harness-filters.mjs +2 -0
- package/esm2020/testing/autocomplete/autocomplete-search-result-harness.mjs +40 -0
- package/esm2020/testing/lookup/lookup-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-harness.mjs +81 -0
- package/esm2020/testing/lookup/lookup-selection-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-selection-harness.mjs +7 -0
- package/esm2020/testing/lookup/lookup-selections-list-harness.mjs +25 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-harness.mjs +118 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-search-result-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-search-result-harness.mjs +7 -0
- package/esm2020/testing/public-api.mjs +16 -1
- package/esm2020/testing/search/search-fixture.mjs +2 -1
- package/esm2020/testing/search/search-harness-filters.mjs +2 -0
- package/esm2020/testing/search/search-harness.mjs +82 -0
- package/esm2020/testing/search/search-testing.module.mjs +5 -4
- package/fesm2015/skyux-lookup-testing.mjs +691 -5
- package/fesm2015/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2015/skyux-lookup.mjs +54 -29
- package/fesm2015/skyux-lookup.mjs.map +1 -1
- package/fesm2020/skyux-lookup-testing.mjs +569 -4
- package/fesm2020/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2020/skyux-lookup.mjs +53 -29
- package/fesm2020/skyux-lookup.mjs.map +1 -1
- package/lib/modules/autocomplete/autocomplete-input.directive.d.ts +1 -0
- package/lib/modules/lookup/lookup-show-more-async-modal.component.d.ts +6 -2
- package/lib/modules/lookup/lookup-show-more-modal.component.d.ts +6 -1
- package/lib/modules/lookup/lookup.component.d.ts +1 -0
- package/package.json +11 -10
- package/testing/autocomplete/autocomplete-harness-filters.d.ts +6 -0
- package/testing/autocomplete/autocomplete-harness.d.ts +79 -0
- package/testing/autocomplete/autocomplete-input-harness.d.ts +39 -0
- package/testing/autocomplete/autocomplete-search-result-harness-filters.d.ts +10 -0
- package/testing/autocomplete/autocomplete-search-result-harness.d.ts +30 -0
- package/testing/lookup/lookup-harness-filters.d.ts +6 -0
- package/testing/lookup/lookup-harness.d.ts +50 -0
- package/testing/lookup/lookup-selection-harness-filters.d.ts +6 -0
- package/testing/lookup/lookup-selection-harness.d.ts +6 -0
- package/testing/lookup/lookup-selections-list-harness.d.ts +19 -0
- package/testing/lookup/lookup-show-more-picker-harness-filters.d.ts +6 -0
- package/testing/lookup/lookup-show-more-picker-harness.d.ts +60 -0
- package/testing/lookup/lookup-show-more-picker-search-result-harness-filters.d.ts +6 -0
- package/testing/lookup/lookup-show-more-picker-search-result-harness.d.ts +6 -0
- package/testing/public-api.d.ts +15 -0
- package/testing/search/search-fixture.d.ts +1 -0
- package/testing/search/search-harness-filters.d.ts +6 -0
- package/testing/search/search-harness.d.ts +47 -0
- package/testing/search/search-testing.module.d.ts +3 -2
|
@@ -1,8 +1,265 @@
|
|
|
1
|
+
import { __classPrivateFieldGet } from 'tslib';
|
|
2
|
+
import { SkyComponentHarness, SkyOverlayHarness } from '@skyux/core/testing';
|
|
3
|
+
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
1
4
|
import { By } from '@angular/platform-browser';
|
|
2
5
|
import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
3
6
|
import * as i0 from '@angular/core';
|
|
4
7
|
import { NgModule } from '@angular/core';
|
|
5
8
|
import { SkyCountryFieldModule, SkySearchModule } from '@skyux/lookup';
|
|
9
|
+
import { SkyTokensHarness, SkyTokenHarness } from '@skyux/indicators/testing';
|
|
10
|
+
import { SkyInfiniteScrollHarness, SkyRepeaterItemHarness } from '@skyux/lists/testing';
|
|
11
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class SkyAutocompleteInputHarness extends ComponentHarness {
|
|
17
|
+
/**
|
|
18
|
+
* Blurs the input.
|
|
19
|
+
*/
|
|
20
|
+
async blur() {
|
|
21
|
+
return (await this.host()).blur();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Clears the input value.
|
|
25
|
+
*/
|
|
26
|
+
async clear() {
|
|
27
|
+
return (await this.host()).clear();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Enters text into the input.
|
|
31
|
+
*/
|
|
32
|
+
async enterText(value) {
|
|
33
|
+
const el = await this.host();
|
|
34
|
+
await el.focus();
|
|
35
|
+
await el.clear();
|
|
36
|
+
await el.sendKeys(value);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Focuses the input.
|
|
40
|
+
*/
|
|
41
|
+
async focus() {
|
|
42
|
+
return (await this.host()).focus();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the value of the input.
|
|
46
|
+
*/
|
|
47
|
+
async getValue() {
|
|
48
|
+
return (await this.host()).getProperty('value');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is disabled.
|
|
52
|
+
*/
|
|
53
|
+
async isDisabled() {
|
|
54
|
+
const disabled = await (await this.host()).getAttribute('disabled');
|
|
55
|
+
return disabled !== null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether the input is focused.
|
|
59
|
+
*/
|
|
60
|
+
async isFocused() {
|
|
61
|
+
return (await this.host()).isFocused();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the value of the input's `aria-owns` attribute.
|
|
65
|
+
*/
|
|
66
|
+
async getAriaOwns() {
|
|
67
|
+
return (await this.host()).getAttribute('aria-owns');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
SkyAutocompleteInputHarness.hostSelector = '[skyAutocomplete]';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Harness for interacting with an autocomplete search results in tests.
|
|
74
|
+
*/
|
|
75
|
+
class SkyAutocompleteSearchResultHarness extends ComponentHarness {
|
|
76
|
+
/**
|
|
77
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
78
|
+
* `SkyAutocompleteSearchResultHarness` that meets certain criteria.
|
|
79
|
+
*/
|
|
80
|
+
static with(filters) {
|
|
81
|
+
return new HarnessPredicate(SkyAutocompleteSearchResultHarness, filters).addOption('textContent', filters.textContent, async (harness, text) => HarnessPredicate.stringMatches(await harness.textContent(), text));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns the value of the search result's descriptor property.
|
|
85
|
+
* This value is set by the autocomplete's `descriptorProperty` input.
|
|
86
|
+
*/
|
|
87
|
+
async getDescriptorValue() {
|
|
88
|
+
return (await (await this.host()).getAttribute('data-descriptor-value'));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns a child harness.
|
|
92
|
+
*/
|
|
93
|
+
async queryHarness(query) {
|
|
94
|
+
return this.locatorForOptional(query)();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Selects the search result.
|
|
98
|
+
*/
|
|
99
|
+
async select() {
|
|
100
|
+
return (await this.host()).click();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns the text content of the search result.
|
|
104
|
+
*/
|
|
105
|
+
async textContent() {
|
|
106
|
+
return (await this.host()).text();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
SkyAutocompleteSearchResultHarness.hostSelector = '.sky-autocomplete-result';
|
|
110
|
+
|
|
111
|
+
var _SkyAutocompleteHarness_instances, _SkyAutocompleteHarness_documentRootLocator, _SkyAutocompleteHarness_getInput, _SkyAutocompleteHarness_getOverlay;
|
|
112
|
+
/**
|
|
113
|
+
* Harness for interacting with an autocomplete component in tests.
|
|
114
|
+
*/
|
|
115
|
+
class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
116
|
+
constructor() {
|
|
117
|
+
super(...arguments);
|
|
118
|
+
_SkyAutocompleteHarness_instances.add(this);
|
|
119
|
+
_SkyAutocompleteHarness_documentRootLocator.set(this, this.documentRootLocatorFactory());
|
|
120
|
+
_SkyAutocompleteHarness_getInput.set(this, this.locatorFor(SkyAutocompleteInputHarness));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
124
|
+
* `SkyAutocompleteHarness` that meets certain criteria.
|
|
125
|
+
*/
|
|
126
|
+
static with(filters) {
|
|
127
|
+
return SkyAutocompleteHarness.getDataSkyIdPredicate(filters);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Blurs the autocomplete input.
|
|
131
|
+
*/
|
|
132
|
+
async blur() {
|
|
133
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).blur();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Clears the input value.
|
|
137
|
+
*/
|
|
138
|
+
async clear() {
|
|
139
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).clear();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Enters text into the autocomplete input.
|
|
143
|
+
*/
|
|
144
|
+
async enterText(value) {
|
|
145
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).enterText(value);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Focuses the autocomplete input.
|
|
149
|
+
*/
|
|
150
|
+
async focus() {
|
|
151
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).focus();
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Returns search result harnesses.
|
|
155
|
+
*/
|
|
156
|
+
async getSearchResults(filters) {
|
|
157
|
+
const overlay = await __classPrivateFieldGet(this, _SkyAutocompleteHarness_instances, "m", _SkyAutocompleteHarness_getOverlay).call(this);
|
|
158
|
+
if (!overlay) {
|
|
159
|
+
throw new Error('Unable to retrieve search results. The autocomplete is closed.');
|
|
160
|
+
}
|
|
161
|
+
const harnesses = await overlay.queryHarnesses(SkyAutocompleteSearchResultHarness.with(filters || {}));
|
|
162
|
+
if (filters && harnesses.length === 0) {
|
|
163
|
+
// Stringify the regular expression so that it's readable in the console log.
|
|
164
|
+
if (filters.textContent instanceof RegExp) {
|
|
165
|
+
filters.textContent = filters.textContent.toString();
|
|
166
|
+
}
|
|
167
|
+
throw new Error(`Could not find search results matching filter(s): ${JSON.stringify(filters)}`);
|
|
168
|
+
}
|
|
169
|
+
return harnesses;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Returns the text content for each search result.
|
|
173
|
+
*/
|
|
174
|
+
async getSearchResultsText(filters) {
|
|
175
|
+
const harnesses = await this.getSearchResults(filters);
|
|
176
|
+
const text = [];
|
|
177
|
+
for (const harness of harnesses) {
|
|
178
|
+
text.push(await harness.textContent());
|
|
179
|
+
}
|
|
180
|
+
return text;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets the value of the autocomplete input.
|
|
184
|
+
*/
|
|
185
|
+
async getValue() {
|
|
186
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).getValue();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Whether the autocomplete input is disabled.
|
|
190
|
+
*/
|
|
191
|
+
async isDisabled() {
|
|
192
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).isDisabled();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether the autocomplete input is focused.
|
|
196
|
+
*/
|
|
197
|
+
async isFocused() {
|
|
198
|
+
return (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).isFocused();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Whether the autocomplete is open.
|
|
202
|
+
*/
|
|
203
|
+
async isOpen() {
|
|
204
|
+
const overlay = await __classPrivateFieldGet(this, _SkyAutocompleteHarness_instances, "m", _SkyAutocompleteHarness_getOverlay).call(this);
|
|
205
|
+
return !!overlay;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Selects a search result.
|
|
209
|
+
*/
|
|
210
|
+
async selectSearchResult(filters) {
|
|
211
|
+
const results = await this.getSearchResults(filters);
|
|
212
|
+
if (results && results.length > 0) {
|
|
213
|
+
await results[0].select();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Clicks the "Add" button in the autocomplete search results panel.
|
|
218
|
+
* (The "Add" functionality is not included in the public API
|
|
219
|
+
* of a "vanilla" autocomplete component, so this method is protected
|
|
220
|
+
* to prevent consumers of the autocomplete harness from calling it.
|
|
221
|
+
* The lookup harness, which extends the autocomplete harness, may
|
|
222
|
+
* still access this feature, however.)
|
|
223
|
+
*/
|
|
224
|
+
async clickAddButton() {
|
|
225
|
+
const overlay = await __classPrivateFieldGet(this, _SkyAutocompleteHarness_instances, "m", _SkyAutocompleteHarness_getOverlay).call(this);
|
|
226
|
+
if (!overlay) {
|
|
227
|
+
throw new Error('Unable to find the "Add" button. The autocomplete is closed.');
|
|
228
|
+
}
|
|
229
|
+
const button = await overlay.querySelector('button.sky-autocomplete-action-add');
|
|
230
|
+
if (!button) {
|
|
231
|
+
throw new Error('The "Add" button cannot be clicked because it does not exist.');
|
|
232
|
+
}
|
|
233
|
+
await button.click();
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Clicks the "Show more" button.
|
|
237
|
+
* (The "Show more" functionality is not included in the public API
|
|
238
|
+
* of a "vanilla" autocomplete component, so this method is protected
|
|
239
|
+
* to prevent consumers of the autocomplete harness from calling it.
|
|
240
|
+
* The lookup harness, which extends the autocomplete harness, may
|
|
241
|
+
* still access this feature, however.)
|
|
242
|
+
*/
|
|
243
|
+
async clickShowMoreButton() {
|
|
244
|
+
const overlay = await __classPrivateFieldGet(this, _SkyAutocompleteHarness_instances, "m", _SkyAutocompleteHarness_getOverlay).call(this);
|
|
245
|
+
if (!overlay) {
|
|
246
|
+
throw new Error('Unable to find the "Show more" button. ' +
|
|
247
|
+
'The autocomplete is closed.');
|
|
248
|
+
}
|
|
249
|
+
const button = await overlay.querySelector('button.sky-autocomplete-action-more');
|
|
250
|
+
if (!button) {
|
|
251
|
+
throw new Error('The "Show more" button cannot be clicked because it does not exist.');
|
|
252
|
+
}
|
|
253
|
+
await button.click();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
_SkyAutocompleteHarness_documentRootLocator = new WeakMap(), _SkyAutocompleteHarness_getInput = new WeakMap(), _SkyAutocompleteHarness_instances = new WeakSet(), _SkyAutocompleteHarness_getOverlay = async function _SkyAutocompleteHarness_getOverlay() {
|
|
257
|
+
const overlayId = await (await __classPrivateFieldGet(this, _SkyAutocompleteHarness_getInput, "f").call(this)).getAriaOwns();
|
|
258
|
+
return overlayId
|
|
259
|
+
? __classPrivateFieldGet(this, _SkyAutocompleteHarness_documentRootLocator, "f").locatorForOptional(SkyOverlayHarness.with({ selector: `#${overlayId}` }))()
|
|
260
|
+
: null;
|
|
261
|
+
};
|
|
262
|
+
SkyAutocompleteHarness.hostSelector = 'sky-autocomplete';
|
|
6
263
|
|
|
7
264
|
/**
|
|
8
265
|
* Allows interaction with a SKY UX country field component.
|
|
@@ -128,8 +385,316 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
128
385
|
}]
|
|
129
386
|
}] });
|
|
130
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Harness for interacting with multiselect lookup selections in tests.
|
|
390
|
+
*/
|
|
391
|
+
class SkyLookupSelectionsListHarness extends SkyTokensHarness {
|
|
392
|
+
/**
|
|
393
|
+
* Gets a list of selections.
|
|
394
|
+
*/
|
|
395
|
+
async getSelections() {
|
|
396
|
+
return super.getTokens();
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Dismisses the selections in the list.
|
|
400
|
+
*/
|
|
401
|
+
async dismissSelections() {
|
|
402
|
+
return super.dismissTokens();
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Gets the text content of all selections in the list.
|
|
406
|
+
*/
|
|
407
|
+
async getSelectionsText() {
|
|
408
|
+
return super.getTokensText();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
var _SkySearchHarness_instances, _SkySearchHarness_getInput, _SkySearchHarness_getSubmitButton, _SkySearchHarness_clickSubmitButton;
|
|
413
|
+
/**
|
|
414
|
+
* Harness for interacting with an search component in tests.
|
|
415
|
+
*/
|
|
416
|
+
class SkySearchHarness extends SkyComponentHarness {
|
|
417
|
+
constructor() {
|
|
418
|
+
super(...arguments);
|
|
419
|
+
_SkySearchHarness_instances.add(this);
|
|
420
|
+
_SkySearchHarness_getInput.set(this, this.locatorFor('input.sky-search-input'));
|
|
421
|
+
_SkySearchHarness_getSubmitButton.set(this, this.locatorFor('button.sky-search-btn-apply'));
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
425
|
+
* `SkySearchHarness` that meets certain criteria.
|
|
426
|
+
*/
|
|
427
|
+
static with(filters) {
|
|
428
|
+
return this.getDataSkyIdPredicate(filters);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Blurs the input.
|
|
432
|
+
*/
|
|
433
|
+
async blur() {
|
|
434
|
+
await (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).blur();
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Clears the input.
|
|
438
|
+
*/
|
|
439
|
+
async clear() {
|
|
440
|
+
const input = await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this);
|
|
441
|
+
await input.focus();
|
|
442
|
+
await input.clear();
|
|
443
|
+
await __classPrivateFieldGet(this, _SkySearchHarness_instances, "m", _SkySearchHarness_clickSubmitButton).call(this);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Enters text into the input and performs a search.
|
|
447
|
+
*/
|
|
448
|
+
async enterText(value) {
|
|
449
|
+
const input = await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this);
|
|
450
|
+
await input.clear();
|
|
451
|
+
await input.focus();
|
|
452
|
+
await input.sendKeys(value);
|
|
453
|
+
await __classPrivateFieldGet(this, _SkySearchHarness_instances, "m", _SkySearchHarness_clickSubmitButton).call(this);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Focuses the input.
|
|
457
|
+
*/
|
|
458
|
+
async focus() {
|
|
459
|
+
await (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).focus();
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Gets the value of the input's placeholder attribute.
|
|
463
|
+
*/
|
|
464
|
+
async getPlaceholderText() {
|
|
465
|
+
return (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getAttribute('placeholder');
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Gets the value of the input.
|
|
469
|
+
*/
|
|
470
|
+
async getValue() {
|
|
471
|
+
return (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getProperty('value');
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Whether the input is disabled.
|
|
475
|
+
*/
|
|
476
|
+
async isDisabled() {
|
|
477
|
+
const disabled = await (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getAttribute('disabled');
|
|
478
|
+
return disabled !== null;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Whether the input is focused.
|
|
482
|
+
*/
|
|
483
|
+
async isFocused() {
|
|
484
|
+
return (await __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).isFocused();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
_SkySearchHarness_getInput = new WeakMap(), _SkySearchHarness_getSubmitButton = new WeakMap(), _SkySearchHarness_instances = new WeakSet(), _SkySearchHarness_clickSubmitButton = async function _SkySearchHarness_clickSubmitButton() {
|
|
488
|
+
return (await __classPrivateFieldGet(this, _SkySearchHarness_getSubmitButton, "f").call(this)).click();
|
|
489
|
+
};
|
|
490
|
+
SkySearchHarness.hostSelector = 'sky-search';
|
|
491
|
+
|
|
492
|
+
var _SkyLookupShowMorePickerHarness_getCancelButton, _SkyLookupShowMorePickerHarness_getClearAllButton, _SkyLookupShowMorePickerHarness_getInfiniteScroll, _SkyLookupShowMorePickerHarness_getSaveButton, _SkyLookupShowMorePickerHarness_getSearchHarness, _SkyLookupShowMorePickerHarness_getSelectAllButton;
|
|
493
|
+
/**
|
|
494
|
+
* Harness for interacting with a lookup's "Show more" picker in tests.
|
|
495
|
+
*/
|
|
496
|
+
class SkyLookupShowMorePickerHarness extends ComponentHarness {
|
|
497
|
+
constructor() {
|
|
498
|
+
super(...arguments);
|
|
499
|
+
_SkyLookupShowMorePickerHarness_getCancelButton.set(this, this.locatorFor('button.sky-lookup-show-more-modal-close'));
|
|
500
|
+
_SkyLookupShowMorePickerHarness_getClearAllButton.set(this, this.locatorForOptional('button.sky-lookup-show-more-modal-clear-all-btn'));
|
|
501
|
+
_SkyLookupShowMorePickerHarness_getInfiniteScroll.set(this, this.locatorFor(SkyInfiniteScrollHarness));
|
|
502
|
+
_SkyLookupShowMorePickerHarness_getSaveButton.set(this, this.locatorFor('button.sky-lookup-show-more-modal-save'));
|
|
503
|
+
_SkyLookupShowMorePickerHarness_getSearchHarness.set(this, this.locatorFor(SkySearchHarness));
|
|
504
|
+
_SkyLookupShowMorePickerHarness_getSelectAllButton.set(this, this.locatorForOptional('button.sky-lookup-show-more-modal-select-all-btn'));
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
508
|
+
* `SkyLookupShowMorePickerHarness` that meets certain criteria.
|
|
509
|
+
*/
|
|
510
|
+
static with(filters) {
|
|
511
|
+
return new HarnessPredicate(SkyLookupShowMorePickerHarness, filters);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Clears the text of the search input.
|
|
515
|
+
*/
|
|
516
|
+
async clearSearchText() {
|
|
517
|
+
return (await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSearchHarness, "f").call(this)).clear();
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Enters text into the search input and performs a search.
|
|
521
|
+
*/
|
|
522
|
+
async enterSearchText(value) {
|
|
523
|
+
return (await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSearchHarness, "f").call(this)).enterText(value);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Selects multiple search results based on a set of criteria.
|
|
527
|
+
*/
|
|
528
|
+
async selectSearchResult(filters) {
|
|
529
|
+
const harnesses = await this.getSearchResults(filters);
|
|
530
|
+
if (await this.isMultiselect()) {
|
|
531
|
+
for (const harness of harnesses) {
|
|
532
|
+
await harness.select();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
// Click on the item directly because we've added a custom click event in the picker's template.
|
|
537
|
+
await (await harnesses[0].host()).click();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Saves any selections made and closes the picker.
|
|
542
|
+
*/
|
|
543
|
+
async saveAndClose() {
|
|
544
|
+
return (await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSaveButton, "f").call(this)).click();
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Closes the picker without saving any selections made.
|
|
548
|
+
*/
|
|
549
|
+
async cancel() {
|
|
550
|
+
return (await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getCancelButton, "f").call(this)).click();
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Gets a list of search results.
|
|
554
|
+
*/
|
|
555
|
+
async getSearchResults(filters) {
|
|
556
|
+
const pickerId = (await (await this.host()).getAttribute('id'));
|
|
557
|
+
const harnesses = await this.locatorForAll(SkyRepeaterItemHarness.with({
|
|
558
|
+
...(filters || {}),
|
|
559
|
+
ancestor: `#${pickerId}`,
|
|
560
|
+
}))();
|
|
561
|
+
if (filters && harnesses.length === 0) {
|
|
562
|
+
throw new Error(`Could not find search results in the picker matching filter(s): ${JSON.stringify(filters)}`);
|
|
563
|
+
}
|
|
564
|
+
return harnesses;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Clears all selections made.
|
|
568
|
+
*/
|
|
569
|
+
async clearAll() {
|
|
570
|
+
const button = await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getClearAllButton, "f").call(this);
|
|
571
|
+
if (!button) {
|
|
572
|
+
throw new Error('Could not clear all selections because the "Clear all" button could not be found.');
|
|
573
|
+
}
|
|
574
|
+
await button.click();
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Whether the picker is configured to allow multiple selections.
|
|
578
|
+
*/
|
|
579
|
+
async isMultiselect() {
|
|
580
|
+
return !(await (await this.host()).hasClass('sky-lookup-show-more-modal-single'));
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Selects all search results.
|
|
584
|
+
*/
|
|
585
|
+
async selectAll() {
|
|
586
|
+
const button = await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSelectAllButton, "f").call(this);
|
|
587
|
+
if (!button) {
|
|
588
|
+
throw new Error('Could not select all selections because the "Select all" button could not be found.');
|
|
589
|
+
}
|
|
590
|
+
await button.click();
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Loads more results in the picker.
|
|
594
|
+
*/
|
|
595
|
+
async loadMore() {
|
|
596
|
+
return (await __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getInfiniteScroll, "f").call(this)).loadMore();
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
_SkyLookupShowMorePickerHarness_getCancelButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getClearAllButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getInfiniteScroll = new WeakMap(), _SkyLookupShowMorePickerHarness_getSaveButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getSearchHarness = new WeakMap(), _SkyLookupShowMorePickerHarness_getSelectAllButton = new WeakMap();
|
|
600
|
+
/**
|
|
601
|
+
* Use the class name since the async and non-async pickers use different
|
|
602
|
+
* host components but share the same wrapper CSS class.
|
|
603
|
+
*/
|
|
604
|
+
SkyLookupShowMorePickerHarness.hostSelector = '.sky-lookup-show-more-modal';
|
|
605
|
+
|
|
606
|
+
var _SkyLookupHarness_documentRootLocator, _SkyLookupHarness_getAutocompleteHarness, _SkyLookupHarness_getSelectionsListHarness, _SkyLookupHarness_getWrapper;
|
|
607
|
+
/**
|
|
608
|
+
* Harness for interacting with a lookup component in tests.
|
|
609
|
+
*/
|
|
610
|
+
class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
611
|
+
constructor() {
|
|
612
|
+
super(...arguments);
|
|
613
|
+
_SkyLookupHarness_documentRootLocator.set(this, this.documentRootLocatorFactory());
|
|
614
|
+
_SkyLookupHarness_getAutocompleteHarness.set(this, this.locatorFor(SkyAutocompleteHarness));
|
|
615
|
+
_SkyLookupHarness_getSelectionsListHarness.set(this, this.locatorFor(SkyLookupSelectionsListHarness));
|
|
616
|
+
_SkyLookupHarness_getWrapper.set(this, this.locatorFor('.sky-lookup'));
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
620
|
+
* `SkyLookupHarness` that meets certain criteria.
|
|
621
|
+
*/
|
|
622
|
+
static with(filters) {
|
|
623
|
+
return SkyLookupHarness.getDataSkyIdPredicate(filters);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Clicks the "Add" button on the search results panel.
|
|
627
|
+
*/
|
|
628
|
+
async clickAddButton() {
|
|
629
|
+
await this.focus();
|
|
630
|
+
await super.clickAddButton();
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Clicks the "Show more" button on the search results panel.
|
|
634
|
+
*/
|
|
635
|
+
async clickShowMoreButton() {
|
|
636
|
+
await this.focus();
|
|
637
|
+
await super.clickShowMoreButton();
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Dismisses the selections made with a multiselect lookup.
|
|
641
|
+
*/
|
|
642
|
+
async dismissSelections() {
|
|
643
|
+
return (await __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).dismissSelections();
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Gets the "Show more" picker harness.
|
|
647
|
+
*/
|
|
648
|
+
async getShowMorePicker() {
|
|
649
|
+
const pickerId = await (await (await __classPrivateFieldGet(this, _SkyLookupHarness_getAutocompleteHarness, "f").call(this)).host()).getAttribute('data-sky-lookup-show-more-picker-id');
|
|
650
|
+
const defaultPicker = await __classPrivateFieldGet(this, _SkyLookupHarness_documentRootLocator, "f").locatorForOptional(SkyLookupShowMorePickerHarness.with({ selector: `#${pickerId}` }))();
|
|
651
|
+
if (!defaultPicker) {
|
|
652
|
+
throw new Error('Cannot get the "Show more" picker because it is not open.');
|
|
653
|
+
}
|
|
654
|
+
return defaultPicker;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Gets a list of selections made with a multiselect lookup.
|
|
658
|
+
*/
|
|
659
|
+
async getSelections() {
|
|
660
|
+
return (await __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).getSelections();
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Gets the text content of all selections made with a multiselect lookup.
|
|
664
|
+
*/
|
|
665
|
+
async getSelectionsText() {
|
|
666
|
+
return (await __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).getSelectionsText();
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Whether the lookup allows for multiple selections.
|
|
670
|
+
*/
|
|
671
|
+
async isMultiselect() {
|
|
672
|
+
return !(await (await __classPrivateFieldGet(this, _SkyLookupHarness_getWrapper, "f").call(this)).hasClass('sky-lookup-single'));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
_SkyLookupHarness_documentRootLocator = new WeakMap(), _SkyLookupHarness_getAutocompleteHarness = new WeakMap(), _SkyLookupHarness_getSelectionsListHarness = new WeakMap(), _SkyLookupHarness_getWrapper = new WeakMap();
|
|
676
|
+
/**
|
|
677
|
+
* Finds a standard lookup component, or a lookup component that is wrapped by an input box component.
|
|
678
|
+
* For input box implementations, we need to use the `.sky-input-box` selector since the `sky-lookup`
|
|
679
|
+
* element is removed from the DOM.
|
|
680
|
+
*/
|
|
681
|
+
SkyLookupHarness.hostSelector = 'sky-lookup,.sky-input-box';
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Harness for interacting with a multiselect lookup selection in tests.
|
|
685
|
+
*/
|
|
686
|
+
class SkyLookupSelectionHarness extends SkyTokenHarness {
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Harness for interacting with a lookup's "Show more" picker search results in tests.
|
|
691
|
+
*/
|
|
692
|
+
class SkyLookupShowMorePickerSearchResultHarness extends SkyRepeaterItemHarness {
|
|
693
|
+
}
|
|
694
|
+
|
|
131
695
|
/**
|
|
132
696
|
* Allows interaction with a SKY UX search component.
|
|
697
|
+
* @deprecated Use `SkySearchHarness` instead.
|
|
133
698
|
*/
|
|
134
699
|
class SkySearchFixture {
|
|
135
700
|
constructor(fixture, skyTestId) {
|
|
@@ -186,12 +751,12 @@ class SkySearchFixture {
|
|
|
186
751
|
class SkySearchTestingModule {
|
|
187
752
|
}
|
|
188
753
|
SkySearchTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
189
|
-
SkySearchTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, exports: [SkySearchModule] });
|
|
190
|
-
SkySearchTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, imports: [SkySearchModule] });
|
|
754
|
+
SkySearchTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, exports: [NoopAnimationsModule, SkySearchModule] });
|
|
755
|
+
SkySearchTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, imports: [NoopAnimationsModule, SkySearchModule] });
|
|
191
756
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, decorators: [{
|
|
192
757
|
type: NgModule,
|
|
193
758
|
args: [{
|
|
194
|
-
exports: [SkySearchModule],
|
|
759
|
+
exports: [NoopAnimationsModule, SkySearchModule],
|
|
195
760
|
}]
|
|
196
761
|
}] });
|
|
197
762
|
|
|
@@ -199,5 +764,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
199
764
|
* Generated bundle index. Do not edit.
|
|
200
765
|
*/
|
|
201
766
|
|
|
202
|
-
export { SkyCountryFieldFixture, SkyCountryFieldTestingModule, SkySearchFixture, SkySearchTestingModule };
|
|
767
|
+
export { SkyAutocompleteHarness, SkyAutocompleteSearchResultHarness, SkyCountryFieldFixture, SkyCountryFieldTestingModule, SkyLookupHarness, SkyLookupSelectionHarness, SkyLookupSelectionsListHarness, SkyLookupShowMorePickerHarness, SkyLookupShowMorePickerSearchResultHarness, SkySearchFixture, SkySearchHarness, SkySearchTestingModule };
|
|
203
768
|
//# sourceMappingURL=skyux-lookup-testing.mjs.map
|