@skyux/lookup 6.14.0 → 6.17.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 +737 -735
- package/esm2020/lib/modules/autocomplete/autocomplete-input.directive.mjs +12 -12
- 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 +1 -1
- package/esm2020/testing/autocomplete/autocomplete-harness.mjs +2 -1
- package/esm2020/testing/autocomplete/autocomplete-search-result-harness-filters.mjs +1 -1
- package/esm2020/testing/autocomplete/autocomplete-search-result-harness.mjs +2 -1
- package/esm2020/testing/country-field/country-field-fixture.mjs +2 -1
- package/esm2020/testing/country-field/country-field-testing.module.mjs +4 -1
- package/esm2020/testing/lookup/lookup-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-harness.mjs +82 -0
- package/esm2020/testing/lookup/lookup-selection-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-selection-harness.mjs +8 -0
- package/esm2020/testing/lookup/lookup-selections-list-harness.mjs +26 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-harness-filters.mjs +2 -0
- package/esm2020/testing/lookup/lookup-show-more-picker-harness.mjs +119 -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 +8 -0
- package/esm2020/testing/public-api.mjs +12 -1
- package/esm2020/testing/search/search-fixture.mjs +3 -1
- package/esm2020/testing/search/search-harness-filters.mjs +2 -0
- package/esm2020/testing/search/search-harness.mjs +83 -0
- package/esm2020/testing/search/search-testing.module.mjs +8 -4
- package/fesm2015/skyux-lookup-testing.mjs +401 -4
- package/fesm2015/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2015/skyux-lookup.mjs +48 -38
- package/fesm2015/skyux-lookup.mjs.map +1 -1
- package/fesm2020/skyux-lookup-testing.mjs +331 -4
- package/fesm2020/skyux-lookup-testing.mjs.map +1 -1
- package/fesm2020/skyux-lookup.mjs +48 -38
- package/fesm2020/skyux-lookup.mjs.map +1 -1
- 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 +10 -10
- package/testing/autocomplete/autocomplete-harness-filters.d.ts +1 -0
- package/testing/autocomplete/autocomplete-harness.d.ts +1 -0
- package/testing/autocomplete/autocomplete-search-result-harness-filters.d.ts +1 -0
- package/testing/autocomplete/autocomplete-search-result-harness.d.ts +1 -0
- package/testing/country-field/country-field-fixture.d.ts +1 -0
- package/testing/country-field/country-field-testing.module.d.ts +3 -0
- package/testing/lookup/lookup-harness-filters.d.ts +7 -0
- package/testing/lookup/lookup-harness.d.ts +51 -0
- package/testing/lookup/lookup-selection-harness-filters.d.ts +7 -0
- package/testing/lookup/lookup-selection-harness.d.ts +7 -0
- package/testing/lookup/lookup-selections-list-harness.d.ts +20 -0
- package/testing/lookup/lookup-show-more-picker-harness-filters.d.ts +7 -0
- package/testing/lookup/lookup-show-more-picker-harness.d.ts +61 -0
- package/testing/lookup/lookup-show-more-picker-search-result-harness-filters.d.ts +7 -0
- package/testing/lookup/lookup-show-more-picker-search-result-harness.d.ts +7 -0
- package/testing/public-api.d.ts +11 -0
- package/testing/search/search-fixture.d.ts +2 -0
- package/testing/search/search-harness-filters.d.ts +7 -0
- package/testing/search/search-harness.d.ts +48 -0
- package/testing/search/search-testing.module.d.ts +6 -2
|
@@ -6,6 +6,9 @@ import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
7
|
import { NgModule } from '@angular/core';
|
|
8
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';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @internal
|
|
@@ -84,6 +87,7 @@ SkyAutocompleteInputHarness.hostSelector = '[skyAutocomplete]';
|
|
|
84
87
|
|
|
85
88
|
/**
|
|
86
89
|
* Harness for interacting with an autocomplete search results in tests.
|
|
90
|
+
* @internal
|
|
87
91
|
*/
|
|
88
92
|
class SkyAutocompleteSearchResultHarness extends ComponentHarness {
|
|
89
93
|
/**
|
|
@@ -132,6 +136,7 @@ SkyAutocompleteSearchResultHarness.hostSelector = '.sky-autocomplete-result';
|
|
|
132
136
|
var _SkyAutocompleteHarness_instances, _SkyAutocompleteHarness_documentRootLocator, _SkyAutocompleteHarness_getInput, _SkyAutocompleteHarness_getOverlay;
|
|
133
137
|
/**
|
|
134
138
|
* Harness for interacting with an autocomplete component in tests.
|
|
139
|
+
* @internal
|
|
135
140
|
*/
|
|
136
141
|
class SkyAutocompleteHarness extends SkyComponentHarness {
|
|
137
142
|
constructor() {
|
|
@@ -312,6 +317,7 @@ SkyAutocompleteHarness.hostSelector = 'sky-autocomplete';
|
|
|
312
317
|
|
|
313
318
|
/**
|
|
314
319
|
* Allows interaction with a SKY UX country field component.
|
|
320
|
+
* @internal
|
|
315
321
|
*/
|
|
316
322
|
class SkyCountryFieldFixture {
|
|
317
323
|
constructor(fixture, skyTestId) {
|
|
@@ -430,6 +436,9 @@ class SkyCountryFieldFixture {
|
|
|
430
436
|
}
|
|
431
437
|
}
|
|
432
438
|
|
|
439
|
+
/**
|
|
440
|
+
* @internal
|
|
441
|
+
*/
|
|
433
442
|
class SkyCountryFieldTestingModule {
|
|
434
443
|
}
|
|
435
444
|
SkyCountryFieldTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCountryFieldTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -442,8 +451,393 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
442
451
|
}]
|
|
443
452
|
}] });
|
|
444
453
|
|
|
454
|
+
/**
|
|
455
|
+
* Harness for interacting with multiselect lookup selections in tests.
|
|
456
|
+
* @internal
|
|
457
|
+
*/
|
|
458
|
+
class SkyLookupSelectionsListHarness extends SkyTokensHarness {
|
|
459
|
+
/**
|
|
460
|
+
* Gets a list of selections.
|
|
461
|
+
*/
|
|
462
|
+
getSelections() {
|
|
463
|
+
const _super = Object.create(null, {
|
|
464
|
+
getTokens: { get: () => super.getTokens }
|
|
465
|
+
});
|
|
466
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
467
|
+
return _super.getTokens.call(this);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Dismisses the selections in the list.
|
|
472
|
+
*/
|
|
473
|
+
dismissSelections() {
|
|
474
|
+
const _super = Object.create(null, {
|
|
475
|
+
dismissTokens: { get: () => super.dismissTokens }
|
|
476
|
+
});
|
|
477
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
478
|
+
return _super.dismissTokens.call(this);
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Gets the text content of all selections in the list.
|
|
483
|
+
*/
|
|
484
|
+
getSelectionsText() {
|
|
485
|
+
const _super = Object.create(null, {
|
|
486
|
+
getTokensText: { get: () => super.getTokensText }
|
|
487
|
+
});
|
|
488
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
489
|
+
return _super.getTokensText.call(this);
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
var _SkySearchHarness_instances, _SkySearchHarness_getInput, _SkySearchHarness_getSubmitButton, _SkySearchHarness_clickSubmitButton;
|
|
495
|
+
/**
|
|
496
|
+
* Harness for interacting with an search component in tests.
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
class SkySearchHarness extends SkyComponentHarness {
|
|
500
|
+
constructor() {
|
|
501
|
+
super(...arguments);
|
|
502
|
+
_SkySearchHarness_instances.add(this);
|
|
503
|
+
_SkySearchHarness_getInput.set(this, this.locatorFor('input.sky-search-input'));
|
|
504
|
+
_SkySearchHarness_getSubmitButton.set(this, this.locatorFor('button.sky-search-btn-apply'));
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
508
|
+
* `SkySearchHarness` that meets certain criteria.
|
|
509
|
+
*/
|
|
510
|
+
static with(filters) {
|
|
511
|
+
return this.getDataSkyIdPredicate(filters);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Blurs the input.
|
|
515
|
+
*/
|
|
516
|
+
blur() {
|
|
517
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
518
|
+
yield (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).blur();
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Clears the input.
|
|
523
|
+
*/
|
|
524
|
+
clear() {
|
|
525
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
526
|
+
const input = yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this);
|
|
527
|
+
yield input.focus();
|
|
528
|
+
yield input.clear();
|
|
529
|
+
yield __classPrivateFieldGet(this, _SkySearchHarness_instances, "m", _SkySearchHarness_clickSubmitButton).call(this);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Enters text into the input and performs a search.
|
|
534
|
+
*/
|
|
535
|
+
enterText(value) {
|
|
536
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
537
|
+
const input = yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this);
|
|
538
|
+
yield input.clear();
|
|
539
|
+
yield input.focus();
|
|
540
|
+
yield input.sendKeys(value);
|
|
541
|
+
yield __classPrivateFieldGet(this, _SkySearchHarness_instances, "m", _SkySearchHarness_clickSubmitButton).call(this);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Focuses the input.
|
|
546
|
+
*/
|
|
547
|
+
focus() {
|
|
548
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
549
|
+
yield (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).focus();
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Gets the value of the input's placeholder attribute.
|
|
554
|
+
*/
|
|
555
|
+
getPlaceholderText() {
|
|
556
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
557
|
+
return (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getAttribute('placeholder');
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Gets the value of the input.
|
|
562
|
+
*/
|
|
563
|
+
getValue() {
|
|
564
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
565
|
+
return (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getProperty('value');
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Whether the input is disabled.
|
|
570
|
+
*/
|
|
571
|
+
isDisabled() {
|
|
572
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
573
|
+
const disabled = yield (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).getAttribute('disabled');
|
|
574
|
+
return disabled !== null;
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Whether the input is focused.
|
|
579
|
+
*/
|
|
580
|
+
isFocused() {
|
|
581
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
582
|
+
return (yield __classPrivateFieldGet(this, _SkySearchHarness_getInput, "f").call(this)).isFocused();
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
_SkySearchHarness_getInput = new WeakMap(), _SkySearchHarness_getSubmitButton = new WeakMap(), _SkySearchHarness_instances = new WeakSet(), _SkySearchHarness_clickSubmitButton = function _SkySearchHarness_clickSubmitButton() {
|
|
587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
588
|
+
return (yield __classPrivateFieldGet(this, _SkySearchHarness_getSubmitButton, "f").call(this)).click();
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
SkySearchHarness.hostSelector = 'sky-search';
|
|
592
|
+
|
|
593
|
+
var _SkyLookupShowMorePickerHarness_getCancelButton, _SkyLookupShowMorePickerHarness_getClearAllButton, _SkyLookupShowMorePickerHarness_getInfiniteScroll, _SkyLookupShowMorePickerHarness_getSaveButton, _SkyLookupShowMorePickerHarness_getSearchHarness, _SkyLookupShowMorePickerHarness_getSelectAllButton;
|
|
594
|
+
/**
|
|
595
|
+
* Harness for interacting with a lookup's "Show more" picker in tests.
|
|
596
|
+
* @internal
|
|
597
|
+
*/
|
|
598
|
+
class SkyLookupShowMorePickerHarness extends ComponentHarness {
|
|
599
|
+
constructor() {
|
|
600
|
+
super(...arguments);
|
|
601
|
+
_SkyLookupShowMorePickerHarness_getCancelButton.set(this, this.locatorFor('button.sky-lookup-show-more-modal-close'));
|
|
602
|
+
_SkyLookupShowMorePickerHarness_getClearAllButton.set(this, this.locatorForOptional('button.sky-lookup-show-more-modal-clear-all-btn'));
|
|
603
|
+
_SkyLookupShowMorePickerHarness_getInfiniteScroll.set(this, this.locatorFor(SkyInfiniteScrollHarness));
|
|
604
|
+
_SkyLookupShowMorePickerHarness_getSaveButton.set(this, this.locatorFor('button.sky-lookup-show-more-modal-save'));
|
|
605
|
+
_SkyLookupShowMorePickerHarness_getSearchHarness.set(this, this.locatorFor(SkySearchHarness));
|
|
606
|
+
_SkyLookupShowMorePickerHarness_getSelectAllButton.set(this, this.locatorForOptional('button.sky-lookup-show-more-modal-select-all-btn'));
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
610
|
+
* `SkyLookupShowMorePickerHarness` that meets certain criteria.
|
|
611
|
+
*/
|
|
612
|
+
static with(filters) {
|
|
613
|
+
return new HarnessPredicate(SkyLookupShowMorePickerHarness, filters);
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Clears the text of the search input.
|
|
617
|
+
*/
|
|
618
|
+
clearSearchText() {
|
|
619
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
620
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSearchHarness, "f").call(this)).clear();
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Enters text into the search input and performs a search.
|
|
625
|
+
*/
|
|
626
|
+
enterSearchText(value) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
628
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSearchHarness, "f").call(this)).enterText(value);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Selects multiple search results based on a set of criteria.
|
|
633
|
+
*/
|
|
634
|
+
selectSearchResult(filters) {
|
|
635
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
636
|
+
const harnesses = yield this.getSearchResults(filters);
|
|
637
|
+
if (yield this.isMultiselect()) {
|
|
638
|
+
for (const harness of harnesses) {
|
|
639
|
+
yield harness.select();
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
// Click on the item directly because we've added a custom click event in the picker's template.
|
|
644
|
+
yield (yield harnesses[0].host()).click();
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Saves any selections made and closes the picker.
|
|
650
|
+
*/
|
|
651
|
+
saveAndClose() {
|
|
652
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
653
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSaveButton, "f").call(this)).click();
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Closes the picker without saving any selections made.
|
|
658
|
+
*/
|
|
659
|
+
cancel() {
|
|
660
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
661
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getCancelButton, "f").call(this)).click();
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Gets a list of search results.
|
|
666
|
+
*/
|
|
667
|
+
getSearchResults(filters) {
|
|
668
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
669
|
+
const pickerId = (yield (yield this.host()).getAttribute('id'));
|
|
670
|
+
const harnesses = yield this.locatorForAll(SkyRepeaterItemHarness.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: `#${pickerId}` })))();
|
|
671
|
+
if (filters && harnesses.length === 0) {
|
|
672
|
+
throw new Error(`Could not find search results in the picker matching filter(s): ${JSON.stringify(filters)}`);
|
|
673
|
+
}
|
|
674
|
+
return harnesses;
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Clears all selections made.
|
|
679
|
+
*/
|
|
680
|
+
clearAll() {
|
|
681
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
682
|
+
const button = yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getClearAllButton, "f").call(this);
|
|
683
|
+
if (!button) {
|
|
684
|
+
throw new Error('Could not clear all selections because the "Clear all" button could not be found.');
|
|
685
|
+
}
|
|
686
|
+
yield button.click();
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Whether the picker is configured to allow multiple selections.
|
|
691
|
+
*/
|
|
692
|
+
isMultiselect() {
|
|
693
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
694
|
+
return !(yield (yield this.host()).hasClass('sky-lookup-show-more-modal-single'));
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Selects all search results.
|
|
699
|
+
*/
|
|
700
|
+
selectAll() {
|
|
701
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
702
|
+
const button = yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getSelectAllButton, "f").call(this);
|
|
703
|
+
if (!button) {
|
|
704
|
+
throw new Error('Could not select all selections because the "Select all" button could not be found.');
|
|
705
|
+
}
|
|
706
|
+
yield button.click();
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Loads more results in the picker.
|
|
711
|
+
*/
|
|
712
|
+
loadMore() {
|
|
713
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
714
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupShowMorePickerHarness_getInfiniteScroll, "f").call(this)).loadMore();
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
_SkyLookupShowMorePickerHarness_getCancelButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getClearAllButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getInfiniteScroll = new WeakMap(), _SkyLookupShowMorePickerHarness_getSaveButton = new WeakMap(), _SkyLookupShowMorePickerHarness_getSearchHarness = new WeakMap(), _SkyLookupShowMorePickerHarness_getSelectAllButton = new WeakMap();
|
|
719
|
+
/**
|
|
720
|
+
* Use the class name since the async and non-async pickers use different
|
|
721
|
+
* host components but share the same wrapper CSS class.
|
|
722
|
+
*/
|
|
723
|
+
SkyLookupShowMorePickerHarness.hostSelector = '.sky-lookup-show-more-modal';
|
|
724
|
+
|
|
725
|
+
var _SkyLookupHarness_documentRootLocator, _SkyLookupHarness_getAutocompleteHarness, _SkyLookupHarness_getSelectionsListHarness, _SkyLookupHarness_getWrapper;
|
|
726
|
+
/**
|
|
727
|
+
* Harness for interacting with a lookup component in tests.
|
|
728
|
+
* @internal
|
|
729
|
+
*/
|
|
730
|
+
class SkyLookupHarness extends SkyAutocompleteHarness {
|
|
731
|
+
constructor() {
|
|
732
|
+
super(...arguments);
|
|
733
|
+
_SkyLookupHarness_documentRootLocator.set(this, this.documentRootLocatorFactory());
|
|
734
|
+
_SkyLookupHarness_getAutocompleteHarness.set(this, this.locatorFor(SkyAutocompleteHarness));
|
|
735
|
+
_SkyLookupHarness_getSelectionsListHarness.set(this, this.locatorFor(SkyLookupSelectionsListHarness));
|
|
736
|
+
_SkyLookupHarness_getWrapper.set(this, this.locatorFor('.sky-lookup'));
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
740
|
+
* `SkyLookupHarness` that meets certain criteria.
|
|
741
|
+
*/
|
|
742
|
+
static with(filters) {
|
|
743
|
+
return SkyLookupHarness.getDataSkyIdPredicate(filters);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Clicks the "Add" button on the search results panel.
|
|
747
|
+
*/
|
|
748
|
+
clickAddButton() {
|
|
749
|
+
const _super = Object.create(null, {
|
|
750
|
+
clickAddButton: { get: () => super.clickAddButton }
|
|
751
|
+
});
|
|
752
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
753
|
+
yield this.focus();
|
|
754
|
+
yield _super.clickAddButton.call(this);
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Clicks the "Show more" button on the search results panel.
|
|
759
|
+
*/
|
|
760
|
+
clickShowMoreButton() {
|
|
761
|
+
const _super = Object.create(null, {
|
|
762
|
+
clickShowMoreButton: { get: () => super.clickShowMoreButton }
|
|
763
|
+
});
|
|
764
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
765
|
+
yield this.focus();
|
|
766
|
+
yield _super.clickShowMoreButton.call(this);
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Dismisses the selections made with a multiselect lookup.
|
|
771
|
+
*/
|
|
772
|
+
dismissSelections() {
|
|
773
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
774
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).dismissSelections();
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Gets the "Show more" picker harness.
|
|
779
|
+
*/
|
|
780
|
+
getShowMorePicker() {
|
|
781
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
782
|
+
const pickerId = yield (yield (yield __classPrivateFieldGet(this, _SkyLookupHarness_getAutocompleteHarness, "f").call(this)).host()).getAttribute('data-sky-lookup-show-more-picker-id');
|
|
783
|
+
const defaultPicker = yield __classPrivateFieldGet(this, _SkyLookupHarness_documentRootLocator, "f").locatorForOptional(SkyLookupShowMorePickerHarness.with({ selector: `#${pickerId}` }))();
|
|
784
|
+
if (!defaultPicker) {
|
|
785
|
+
throw new Error('Cannot get the "Show more" picker because it is not open.');
|
|
786
|
+
}
|
|
787
|
+
return defaultPicker;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Gets a list of selections made with a multiselect lookup.
|
|
792
|
+
*/
|
|
793
|
+
getSelections() {
|
|
794
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
795
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).getSelections();
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Gets the text content of all selections made with a multiselect lookup.
|
|
800
|
+
*/
|
|
801
|
+
getSelectionsText() {
|
|
802
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
+
return (yield __classPrivateFieldGet(this, _SkyLookupHarness_getSelectionsListHarness, "f").call(this)).getSelectionsText();
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Whether the lookup allows for multiple selections.
|
|
808
|
+
*/
|
|
809
|
+
isMultiselect() {
|
|
810
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
811
|
+
return !(yield (yield __classPrivateFieldGet(this, _SkyLookupHarness_getWrapper, "f").call(this)).hasClass('sky-lookup-single'));
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
_SkyLookupHarness_documentRootLocator = new WeakMap(), _SkyLookupHarness_getAutocompleteHarness = new WeakMap(), _SkyLookupHarness_getSelectionsListHarness = new WeakMap(), _SkyLookupHarness_getWrapper = new WeakMap();
|
|
816
|
+
/**
|
|
817
|
+
* Finds a standard lookup component, or a lookup component that is wrapped by an input box component.
|
|
818
|
+
* For input box implementations, we need to use the `.sky-input-box` selector since the `sky-lookup`
|
|
819
|
+
* element is removed from the DOM.
|
|
820
|
+
*/
|
|
821
|
+
SkyLookupHarness.hostSelector = 'sky-lookup,.sky-input-box';
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Harness for interacting with a multiselect lookup selection in tests.
|
|
825
|
+
* @internal
|
|
826
|
+
*/
|
|
827
|
+
class SkyLookupSelectionHarness extends SkyTokenHarness {
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Harness for interacting with a lookup's "Show more" picker search results in tests.
|
|
832
|
+
* @internal
|
|
833
|
+
*/
|
|
834
|
+
class SkyLookupShowMorePickerSearchResultHarness extends SkyRepeaterItemHarness {
|
|
835
|
+
}
|
|
836
|
+
|
|
445
837
|
/**
|
|
446
838
|
* Allows interaction with a SKY UX search component.
|
|
839
|
+
* @deprecated Use `SkySearchHarness` instead.
|
|
840
|
+
* @internal
|
|
447
841
|
*/
|
|
448
842
|
class SkySearchFixture {
|
|
449
843
|
constructor(fixture, skyTestId) {
|
|
@@ -497,15 +891,18 @@ class SkySearchFixture {
|
|
|
497
891
|
}
|
|
498
892
|
}
|
|
499
893
|
|
|
894
|
+
/**
|
|
895
|
+
* @internal
|
|
896
|
+
*/
|
|
500
897
|
class SkySearchTestingModule {
|
|
501
898
|
}
|
|
502
899
|
SkySearchTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
503
|
-
SkySearchTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, exports: [SkySearchModule] });
|
|
504
|
-
SkySearchTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, imports: [SkySearchModule] });
|
|
900
|
+
SkySearchTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, exports: [NoopAnimationsModule, SkySearchModule] });
|
|
901
|
+
SkySearchTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, imports: [NoopAnimationsModule, SkySearchModule] });
|
|
505
902
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkySearchTestingModule, decorators: [{
|
|
506
903
|
type: NgModule,
|
|
507
904
|
args: [{
|
|
508
|
-
exports: [SkySearchModule],
|
|
905
|
+
exports: [NoopAnimationsModule, SkySearchModule],
|
|
509
906
|
}]
|
|
510
907
|
}] });
|
|
511
908
|
|
|
@@ -513,5 +910,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
513
910
|
* Generated bundle index. Do not edit.
|
|
514
911
|
*/
|
|
515
912
|
|
|
516
|
-
export { SkyAutocompleteHarness, SkyAutocompleteSearchResultHarness, SkyCountryFieldFixture, SkyCountryFieldTestingModule, SkySearchFixture, SkySearchTestingModule };
|
|
913
|
+
export { SkyAutocompleteHarness, SkyAutocompleteSearchResultHarness, SkyCountryFieldFixture, SkyCountryFieldTestingModule, SkyLookupHarness, SkyLookupSelectionHarness, SkyLookupSelectionsListHarness, SkyLookupShowMorePickerHarness, SkyLookupShowMorePickerSearchResultHarness, SkySearchFixture, SkySearchHarness, SkySearchTestingModule };
|
|
517
914
|
//# sourceMappingURL=skyux-lookup-testing.mjs.map
|