@skyux/tabs 13.0.0-alpha.1 → 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.
@@ -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
- const sections = await this.locatorForAll(SkySectionedFormSectionHarness.with(filters || {}))();
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 SkyComponentHarness {
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(tabHeading);
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 harness with the given `tabHeading`
639
+ * Gets a specific tab button based on the filter criteria.
640
+ * @param filters The filter criteria.
633
641
  */
634
- async getTabButtonHarness(tabHeading) {
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({ tabHeading: tabHeading }));
645
+ return await menu.queryHarness(SkyTabButtonHarness.with(filters));
638
646
  }
639
- return await this.locatorFor(SkyTabButtonHarness.with({ tabHeading: tabHeading }))();
647
+ return await this.locatorFor(SkyTabButtonHarness.with(filters))();
640
648
  }
641
649
  /**
642
- * Gets an array of all tab button harnesses.
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(tabHeading);
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 the `SkyVerticalTabButtonHarness` for a specific tab under this group based on filters.
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 the `SkyVerticalTabButtonHarness` for all tabs under this group.
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
- * Get the vertical tabset group by `SkyVerticalTabsetGroupHarnessFilters`
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 `SkyVerticalTabsetGroupHarness` in this tabset.
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 `SkyVerticalTabButtonHarness` that matches the filter.
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 `SkyVerticalTabButtonHarness` in this tabset.
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.