@skyux/lookup 13.0.0-alpha.4 → 13.0.0-alpha.6
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SkyInputHarness, SkyQueryableComponentHarness, SkyComponentHarness, SkyOverlayHarness } from '@skyux/core/testing';
|
|
2
2
|
import { HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
|
|
3
|
+
import { SkyTokensHarness, SkyTokenHarness } from '@skyux/indicators/testing';
|
|
4
|
+
import { SkyCheckboxHarness } from '@skyux/forms/testing';
|
|
5
|
+
import { SkyInfiniteScrollHarness, SkyRepeaterItemHarness } from '@skyux/lists/testing';
|
|
3
6
|
import { By } from '@angular/platform-browser';
|
|
4
7
|
import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
5
8
|
import * as i0 from '@angular/core';
|
|
6
9
|
import { NgModule } from '@angular/core';
|
|
7
|
-
import { SkyCountryFieldModule, SkySearchModule } from '@skyux/lookup';
|
|
8
|
-
import { SkyTokensHarness, SkyTokenHarness } from '@skyux/indicators/testing';
|
|
9
|
-
import { SkyCheckboxHarness } from '@skyux/forms/testing';
|
|
10
|
-
import { SkyInfiniteScrollHarness, SkyRepeaterItemHarness } from '@skyux/lists/testing';
|
|
11
10
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
11
|
+
import { SkySearchModule } from '@skyux/lookup';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Harness to interact with the autocomplete input harness.
|
|
@@ -251,128 +251,6 @@ class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
/**
|
|
255
|
-
* Allows interaction with a SKY UX country field component.
|
|
256
|
-
* @internal
|
|
257
|
-
*/
|
|
258
|
-
class SkyCountryFieldFixture {
|
|
259
|
-
#debugEl;
|
|
260
|
-
/**
|
|
261
|
-
* The value of the input field's autocomplete attribute.
|
|
262
|
-
* @deprecated The country field component's `autocompleteAttribute` is deprecated.
|
|
263
|
-
*/
|
|
264
|
-
get autocompleteAttribute() {
|
|
265
|
-
return this.#getInputElement().getAttribute('autocomplete');
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* A flag indicating whether or not the input has been disabled.
|
|
269
|
-
*/
|
|
270
|
-
get disabled() {
|
|
271
|
-
return this.#getInputElement().disabled;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* The value of the input field.
|
|
275
|
-
*/
|
|
276
|
-
get searchText() {
|
|
277
|
-
return this.#getInputElement().value;
|
|
278
|
-
}
|
|
279
|
-
#fixture;
|
|
280
|
-
constructor(fixture, skyTestId) {
|
|
281
|
-
this.#fixture = fixture;
|
|
282
|
-
this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-country-field');
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Enters the search text into the input field displaying search results, but making no selection.
|
|
286
|
-
* @param searchText The name of the country to select.
|
|
287
|
-
* @returns The list of country names matching the search text.
|
|
288
|
-
*/
|
|
289
|
-
async search(searchText) {
|
|
290
|
-
const resultNodes = await this.#searchAndGetResults(searchText, this.#fixture);
|
|
291
|
-
const resultArray = Array.prototype.slice.call(resultNodes);
|
|
292
|
-
const results = resultArray
|
|
293
|
-
.map((result) => {
|
|
294
|
-
const countryNameEl = result.querySelector('.sky-highlight-mark');
|
|
295
|
-
const countryName = SkyAppTestUtility.getText(countryNameEl);
|
|
296
|
-
return countryName;
|
|
297
|
-
})
|
|
298
|
-
.filter((result) => result !== undefined);
|
|
299
|
-
this.#fixture.detectChanges();
|
|
300
|
-
await this.#fixture.whenStable();
|
|
301
|
-
return results;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Enters the search text into the input field and selects the first result (if any).
|
|
305
|
-
* @param searchText The name of the country to select.
|
|
306
|
-
*/
|
|
307
|
-
async searchAndSelectFirstResult(searchText) {
|
|
308
|
-
await this.#searchAndSelect(searchText, 0, this.#fixture);
|
|
309
|
-
this.#fixture.detectChanges();
|
|
310
|
-
await this.#fixture.whenStable();
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Clears the country selection and input field.
|
|
314
|
-
*/
|
|
315
|
-
async clear() {
|
|
316
|
-
await this.#enterSearch('', this.#fixture);
|
|
317
|
-
this.#fixture.detectChanges();
|
|
318
|
-
await this.#fixture.whenStable();
|
|
319
|
-
}
|
|
320
|
-
//#region helpers
|
|
321
|
-
#getAutocompleteElement() {
|
|
322
|
-
return document.querySelector('.sky-autocomplete-results');
|
|
323
|
-
}
|
|
324
|
-
#getInputElement() {
|
|
325
|
-
const debugEl = this.#debugEl.query(By.css('textarea'));
|
|
326
|
-
return debugEl.nativeElement;
|
|
327
|
-
}
|
|
328
|
-
async #blurInput(fixture) {
|
|
329
|
-
SkyAppTestUtility.fireDomEvent(this.#getInputElement(), 'blur');
|
|
330
|
-
fixture.detectChanges();
|
|
331
|
-
await fixture.whenStable();
|
|
332
|
-
}
|
|
333
|
-
async #enterSearch(newValue, fixture) {
|
|
334
|
-
const inputElement = this.#getInputElement();
|
|
335
|
-
inputElement.value = newValue;
|
|
336
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'focus');
|
|
337
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'keyup');
|
|
338
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'input');
|
|
339
|
-
fixture.detectChanges();
|
|
340
|
-
await fixture.whenStable();
|
|
341
|
-
}
|
|
342
|
-
async #searchAndGetResults(newValue, fixture) {
|
|
343
|
-
await this.#enterSearch(newValue, fixture);
|
|
344
|
-
fixture.detectChanges();
|
|
345
|
-
await fixture.whenStable();
|
|
346
|
-
return this.#getAutocompleteElement().querySelectorAll('.sky-autocomplete-result');
|
|
347
|
-
}
|
|
348
|
-
async #searchAndSelect(newValue, index, fixture) {
|
|
349
|
-
const inputElement = this.#getInputElement();
|
|
350
|
-
const searchResults = await this.#searchAndGetResults(newValue, fixture);
|
|
351
|
-
if (searchResults.length < index + 1) {
|
|
352
|
-
throw new Error('Index out of range for results');
|
|
353
|
-
}
|
|
354
|
-
// Note: the ordering of these events is important!
|
|
355
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'change');
|
|
356
|
-
SkyAppTestUtility.fireDomEvent(searchResults[index], 'click');
|
|
357
|
-
await this.#blurInput(fixture);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* @internal
|
|
363
|
-
*/
|
|
364
|
-
class SkyCountryFieldTestingModule {
|
|
365
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: SkyCountryFieldTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
366
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.5", ngImport: i0, type: SkyCountryFieldTestingModule, exports: [SkyCountryFieldModule] }); }
|
|
367
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: SkyCountryFieldTestingModule, imports: [SkyCountryFieldModule] }); }
|
|
368
|
-
}
|
|
369
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: SkyCountryFieldTestingModule, decorators: [{
|
|
370
|
-
type: NgModule,
|
|
371
|
-
args: [{
|
|
372
|
-
exports: [SkyCountryFieldModule],
|
|
373
|
-
}]
|
|
374
|
-
}] });
|
|
375
|
-
|
|
376
254
|
/**
|
|
377
255
|
* Harness for interacting with an autocomplete search result in tests.
|
|
378
256
|
*/
|
|
@@ -1200,5 +1078,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
|
|
|
1200
1078
|
* Generated bundle index. Do not edit.
|
|
1201
1079
|
*/
|
|
1202
1080
|
|
|
1203
|
-
export { SkyAutocompleteHarness, SkyAutocompleteInputHarness, SkyAutocompleteSearchResultHarness,
|
|
1081
|
+
export { SkyAutocompleteHarness, SkyAutocompleteInputHarness, SkyAutocompleteSearchResultHarness, SkyCountryFieldHarness, SkyCountryFieldSearchResultHarness, SkyLookupHarness, SkyLookupSearchResultHarness, SkyLookupSelectionHarness, SkyLookupSelectionsListHarness, SkyLookupShowMorePickerHarness, SkyLookupShowMorePickerSearchResultHarness, SkySearchFixture, SkySearchHarness, SkySearchTestingModule, SkySelectionModalHarness, SkySelectionModalSearchResultHarness };
|
|
1204
1082
|
//# sourceMappingURL=skyux-lookup-testing.mjs.map
|