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