@skyux/tabs 13.0.0-alpha.8 → 13.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/skyux-tabs-testing.mjs +52 -30
- package/fesm2022/skyux-tabs-testing.mjs.map +1 -1
- package/fesm2022/skyux-tabs.mjs +23 -8
- package/fesm2022/skyux-tabs.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/package.json +10 -10
- package/testing/index.d.ts +38 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { By } from '@angular/platform-browser';
|
|
2
2
|
import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
3
3
|
import { SkyQueryableComponentHarness, SkyComponentHarness } from '@skyux/core/testing';
|
|
4
|
-
import { HarnessPredicate } from '@angular/cdk/testing';
|
|
4
|
+
import { HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
|
|
5
5
|
import { SkyDropdownHarness } from '@skyux/popovers/testing';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -378,18 +378,23 @@ class SkySectionedFormHarness extends SkyComponentHarness {
|
|
|
378
378
|
}
|
|
379
379
|
throw new Error('Unable to find active content because it is not visible.');
|
|
380
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Gets a specific section based on the filter criteria.
|
|
383
|
+
* @param filters The filter criteria.
|
|
384
|
+
*/
|
|
381
385
|
async getSection(filters) {
|
|
382
386
|
return await this.locatorFor(SkySectionedFormSectionHarness.with(filters))();
|
|
383
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Gets an array of sections based on the filter criteria.
|
|
390
|
+
* If no filter is provided, returns all sections.
|
|
391
|
+
* @param filters The optional filter criteria.
|
|
392
|
+
*/
|
|
384
393
|
async getSections(filters) {
|
|
385
394
|
if (!(await this.isSectionsVisible())) {
|
|
386
395
|
throw new Error('Unable to find any sectioned form sections because they are not visible.');
|
|
387
396
|
}
|
|
388
|
-
|
|
389
|
-
if (filters && sections.length === 0) {
|
|
390
|
-
throw new Error(`Unable to find any sectioned form sections with filter(s): ${JSON.stringify(filters)}`);
|
|
391
|
-
}
|
|
392
|
-
return sections;
|
|
397
|
+
return await this.locatorForAll(SkySectionedFormSectionHarness.with(filters || {}))();
|
|
393
398
|
}
|
|
394
399
|
/**
|
|
395
400
|
* Whether the section tabs are visible.
|
|
@@ -447,7 +452,7 @@ class SkyTabContentHarness extends SkyQueryableComponentHarness {
|
|
|
447
452
|
/**
|
|
448
453
|
* Harness for interacting with a tab button component in tests.
|
|
449
454
|
*/
|
|
450
|
-
class SkyTabButtonHarness extends
|
|
455
|
+
class SkyTabButtonHarness extends ComponentHarness {
|
|
451
456
|
/**
|
|
452
457
|
* @internal
|
|
453
458
|
*/
|
|
@@ -543,7 +548,6 @@ class SkyTabsetHarness extends SkyComponentHarness {
|
|
|
543
548
|
*/
|
|
544
549
|
static { this.hostSelector = 'sky-tabset'; }
|
|
545
550
|
#getTabset = this.locatorFor('.sky-tabset');
|
|
546
|
-
#getTabButtons = this.locatorForAll(SkyTabButtonHarness);
|
|
547
551
|
#getTabDropdown = this.locatorFor(SkyDropdownHarness);
|
|
548
552
|
/**
|
|
549
553
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
@@ -592,7 +596,9 @@ class SkyTabsetHarness extends SkyComponentHarness {
|
|
|
592
596
|
* Clicks a tab button with a `tabHeading` matching the input.
|
|
593
597
|
*/
|
|
594
598
|
async clickTabButton(tabHeading) {
|
|
595
|
-
const tabButton = await this.getTabButtonHarness(
|
|
599
|
+
const tabButton = await this.getTabButtonHarness({
|
|
600
|
+
tabHeading: tabHeading,
|
|
601
|
+
});
|
|
596
602
|
return await tabButton.click();
|
|
597
603
|
}
|
|
598
604
|
/**
|
|
@@ -630,30 +636,37 @@ class SkyTabsetHarness extends SkyComponentHarness {
|
|
|
630
636
|
return 'dropdown';
|
|
631
637
|
}
|
|
632
638
|
/**
|
|
633
|
-
* Gets a tab button
|
|
639
|
+
* Gets a specific tab button based on the filter criteria.
|
|
640
|
+
* @param filters The filter criteria.
|
|
634
641
|
*/
|
|
635
|
-
async getTabButtonHarness(
|
|
642
|
+
async getTabButtonHarness(filters) {
|
|
636
643
|
if ((await this.getMode()) === 'dropdown') {
|
|
637
644
|
const menu = await this.#getDropdownMenu();
|
|
638
|
-
return await menu.queryHarness(SkyTabButtonHarness.with(
|
|
645
|
+
return await menu.queryHarness(SkyTabButtonHarness.with(filters));
|
|
639
646
|
}
|
|
640
|
-
return await this.locatorFor(SkyTabButtonHarness.with(
|
|
647
|
+
return await this.locatorFor(SkyTabButtonHarness.with(filters))();
|
|
641
648
|
}
|
|
642
649
|
/**
|
|
643
|
-
* Gets an array of
|
|
650
|
+
* Gets an array of tab button harnesses based on the filter criteria.
|
|
651
|
+
* If no filter is provided, returns all tab button harnesses.
|
|
652
|
+
* @param filters The optional filter criteria.
|
|
644
653
|
*/
|
|
645
|
-
async getTabButtonHarnesses() {
|
|
654
|
+
async getTabButtonHarnesses(filters) {
|
|
646
655
|
if ((await this.getMode()) === 'dropdown') {
|
|
647
656
|
const menu = await this.#getDropdownMenu();
|
|
648
|
-
return await menu.queryHarnesses(SkyTabButtonHarness);
|
|
657
|
+
return await menu.queryHarnesses(SkyTabButtonHarness.with(filters || {}));
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
return await this.locatorForAll(SkyTabButtonHarness.with(filters || {}))();
|
|
649
661
|
}
|
|
650
|
-
return await this.#getTabButtons();
|
|
651
662
|
}
|
|
652
663
|
/**
|
|
653
664
|
* Gets a tab content harness for the tab with the given `tabHeading`.
|
|
654
665
|
*/
|
|
655
666
|
async getTabContentHarness(tabHeading) {
|
|
656
|
-
const tabButton = await this.getTabButtonHarness(
|
|
667
|
+
const tabButton = await this.getTabButtonHarness({
|
|
668
|
+
tabHeading: tabHeading,
|
|
669
|
+
});
|
|
657
670
|
const id = await tabButton.getTabId();
|
|
658
671
|
return await this.locatorFor(SkyTabContentHarness.with({ tabId: id }))();
|
|
659
672
|
}
|
|
@@ -749,16 +762,19 @@ class SkyVerticalTabsetGroupHarness extends SkyComponentHarness {
|
|
|
749
762
|
return (await (await this.#button()).text()).trim();
|
|
750
763
|
}
|
|
751
764
|
/**
|
|
752
|
-
* Gets
|
|
765
|
+
* Gets a specific vertical tab based on the filter criteria.
|
|
766
|
+
* @param filters The filter criteria.
|
|
753
767
|
*/
|
|
754
768
|
async getVerticalTab(filters) {
|
|
755
769
|
return await this.locatorFor(SkyVerticalTabButtonHarness.with(filters))();
|
|
756
770
|
}
|
|
757
771
|
/**
|
|
758
|
-
* Gets
|
|
772
|
+
* Gets an array of vertical tab buttons based on the filter criteria.
|
|
773
|
+
* If no filter is provided, returns all vertical tab buttons.
|
|
774
|
+
* @param filters The optional filter criteria.
|
|
759
775
|
*/
|
|
760
|
-
async getVerticalTabs() {
|
|
761
|
-
return await this.locatorForAll(SkyVerticalTabButtonHarness)();
|
|
776
|
+
async getVerticalTabs(filters) {
|
|
777
|
+
return await this.locatorForAll(SkyVerticalTabButtonHarness.with(filters || {}))();
|
|
762
778
|
}
|
|
763
779
|
/**
|
|
764
780
|
* Whether a tab under this group is active.
|
|
@@ -851,20 +867,23 @@ class SkyVerticalTabsetHarness extends SkyComponentHarness {
|
|
|
851
867
|
return await (await this.locatorFor('span.sky-vertical-tabset-tablist')()).getAttribute('aria-labelledby');
|
|
852
868
|
}
|
|
853
869
|
/**
|
|
854
|
-
*
|
|
870
|
+
* Gets a specific vertical tabset group based on the filter criteria.
|
|
871
|
+
* @param filters The filter criteria.
|
|
855
872
|
*/
|
|
856
873
|
async getGroup(filters) {
|
|
857
874
|
return await this.locatorFor(SkyVerticalTabsetGroupHarness.with(filters))();
|
|
858
875
|
}
|
|
859
876
|
/**
|
|
860
|
-
* Gets an array of
|
|
877
|
+
* Gets an array of vertical tabset groups based on the filter criteria.
|
|
878
|
+
* If no filter is provided, returns all vertical tabset groups.
|
|
879
|
+
* @param filters The optional filter criteria.
|
|
861
880
|
*/
|
|
862
|
-
async getGroups() {
|
|
881
|
+
async getGroups(filters) {
|
|
863
882
|
// open tablist if in mobile view
|
|
864
883
|
if (!(await this.isTabsVisible())) {
|
|
865
884
|
await this.clickShowTabsButton();
|
|
866
885
|
}
|
|
867
|
-
return await this.locatorForAll(SkyVerticalTabsetGroupHarness)();
|
|
886
|
+
return await this.locatorForAll(SkyVerticalTabsetGroupHarness.with(filters || {}))();
|
|
868
887
|
}
|
|
869
888
|
/**
|
|
870
889
|
* Gets the text in the show tabs button in mobile view.
|
|
@@ -878,20 +897,23 @@ class SkyVerticalTabsetHarness extends SkyComponentHarness {
|
|
|
878
897
|
return undefined;
|
|
879
898
|
}
|
|
880
899
|
/**
|
|
881
|
-
* Gets a
|
|
900
|
+
* Gets a specific vertical tab button based on the filter criteria.
|
|
901
|
+
* @param filters The filter criteria.
|
|
882
902
|
*/
|
|
883
903
|
async getTab(filters) {
|
|
884
904
|
return await this.locatorFor(SkyVerticalTabButtonHarness.with(filters))();
|
|
885
905
|
}
|
|
886
906
|
/**
|
|
887
|
-
* Gets an array of
|
|
907
|
+
* Gets an array of vertical tab buttons based on the filter criteria.
|
|
908
|
+
* If no filter is provided, returns all vertical tab buttons.
|
|
909
|
+
* @param filters The optional filter criteria.
|
|
888
910
|
*/
|
|
889
|
-
async getTabs() {
|
|
911
|
+
async getTabs(filters) {
|
|
890
912
|
// open tablist if in mobile view
|
|
891
913
|
if (!(await this.isTabsVisible())) {
|
|
892
914
|
await this.clickShowTabsButton();
|
|
893
915
|
}
|
|
894
|
-
return await this.locatorForAll(SkyVerticalTabButtonHarness)();
|
|
916
|
+
return await this.locatorForAll(SkyVerticalTabButtonHarness.with(filters || {}))();
|
|
895
917
|
}
|
|
896
918
|
/**
|
|
897
919
|
* Whether the tabs are visible.
|