@skyux/lists 13.2.0 → 13.3.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.
@@ -7,7 +7,8 @@ import { By } from '@angular/platform-browser';
7
7
  import { SkyAppTestUtility } from '@skyux-sdk/testing';
8
8
  import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
9
9
  import { SkyCheckboxHarness } from '@skyux/forms/testing';
10
- import { SkyDropdownItemHarness, SkyDropdownHarness } from '@skyux/popovers/testing';
10
+ import { SkyInlineFormHarness } from '@skyux/inline-form/testing';
11
+ import { SkyDropdownHarness, SkyDropdownItemHarness } from '@skyux/popovers/testing';
11
12
 
12
13
  /**
13
14
  * @internal
@@ -427,6 +428,17 @@ class SkyPagingHarness extends SkyComponentHarness {
427
428
  }
428
429
  }
429
430
 
431
+ /**
432
+ * Harness to query inside a repeater item context menu component in tests.
433
+ * @internal
434
+ */
435
+ class SkyRepeaterItemContextMenuHarness extends SkyQueryableComponentHarness {
436
+ /**
437
+ * @internal
438
+ */
439
+ static { this.hostSelector = 'sky-repeater-item-context-menu'; }
440
+ }
441
+
430
442
  /**
431
443
  * Harness for interacting with a repeater item component in tests.
432
444
  */
@@ -439,6 +451,7 @@ class SkyRepeaterItemHarness extends SkyQueryableComponentHarness {
439
451
  #getCheckbox = this.locatorForOptional(SkyCheckboxHarness);
440
452
  #getChevron = this.locatorForOptional(SkyChevronHarness);
441
453
  #getContent = this.locatorFor('.sky-repeater-item-content');
454
+ #getContext = this.locatorFor(SkyRepeaterItemContextMenuHarness);
442
455
  #getItem = this.locatorFor('.sky-repeater-item');
443
456
  #getReorderHandle = this.locatorForOptional('button.sky-repeater-item-grab-handle');
444
457
  #getTitle = this.locatorFor('.sky-repeater-item-title');
@@ -464,40 +477,46 @@ class SkyRepeaterItemHarness extends SkyQueryableComponentHarness {
464
477
  await (await this.#getItem()).click();
465
478
  }
466
479
  /**
467
- * Whether the repeater item is selectable.
480
+ * Collapses the repeater item, or does nothing if already collapsed.
468
481
  */
469
- async isSelectable() {
470
- return !!(await this.#getCheckbox());
482
+ async collapse() {
483
+ const chevron = await this.#getChevron();
484
+ if (chevron) {
485
+ if ((await chevron.getDirection()) === 'up') {
486
+ await chevron.toggle();
487
+ }
488
+ return;
489
+ }
490
+ throw new Error('Could not collapse the repeater item because it is not collapsible.');
471
491
  }
472
492
  /**
473
- * Whether the repeater item is selected.
493
+ * Deselects the repeater item.
474
494
  */
475
- async isSelected() {
495
+ async deselect() {
476
496
  const checkbox = await this.#getCheckbox();
477
497
  if (!checkbox) {
478
- throw new Error('Could not determine if repeater item is selected because it is not selectable.');
498
+ throw new Error('Could not deselect the repeater item because it is not selectable.');
479
499
  }
480
- return await checkbox.isChecked();
500
+ await checkbox.uncheck();
481
501
  }
482
502
  /**
483
- * Selects the repeater item.
503
+ * Expands the repeater item, or does nothing if already expanded.
484
504
  */
485
- async select() {
486
- const checkbox = await this.#getCheckbox();
487
- if (!checkbox) {
488
- throw new Error('Could not select the repeater item because it is not selectable.');
505
+ async expand() {
506
+ const chevron = await this.#getChevron();
507
+ if (chevron) {
508
+ if ((await chevron.getDirection()) === 'down') {
509
+ await chevron.toggle();
510
+ }
511
+ return;
489
512
  }
490
- await checkbox.check();
513
+ throw new Error('Could not expand the repeater item because it is not collapsible.');
491
514
  }
492
515
  /**
493
- * Deselects the repeater item.
516
+ * Gets a harness for the dropdown inside the context menu.
494
517
  */
495
- async deselect() {
496
- const checkbox = await this.#getCheckbox();
497
- if (!checkbox) {
498
- throw new Error('Could not deselect the repeater item because it is not selectable.');
499
- }
500
- await checkbox.uncheck();
518
+ async getContextMenuDropdown(filters) {
519
+ return await (await this.#getContext()).queryHarness(SkyDropdownHarness.with(filters || {}));
501
520
  }
502
521
  /**
503
522
  * Gets the text of the repeater item content.
@@ -505,6 +524,18 @@ class SkyRepeaterItemHarness extends SkyQueryableComponentHarness {
505
524
  async getContentText() {
506
525
  return await (await this.#getContent()).text();
507
526
  }
527
+ /**
528
+ * Gets the inline form harness.
529
+ */
530
+ async getInlineForm() {
531
+ return await this.locatorFor(SkyInlineFormHarness)();
532
+ }
533
+ /**
534
+ * Gets the item name.
535
+ */
536
+ async getItemName() {
537
+ return await (await this.#getItem()).getAttribute('aria-label');
538
+ }
508
539
  /**
509
540
  * Gets the text of the repeater item title.
510
541
  */
@@ -517,6 +548,12 @@ class SkyRepeaterItemHarness extends SkyQueryableComponentHarness {
517
548
  async isCollapsible() {
518
549
  return !!(await this.#getChevron());
519
550
  }
551
+ /**
552
+ * Whether a selectable repeater item is disabled.
553
+ */
554
+ async isDisabled() {
555
+ return (await (await this.#getCheckbox())?.isDisabled()) || false;
556
+ }
520
557
  /**
521
558
  * Whether the repeater item is expanded, or throws an error informing of the lack of collapsibility.
522
559
  */
@@ -528,36 +565,36 @@ class SkyRepeaterItemHarness extends SkyQueryableComponentHarness {
528
565
  throw new Error('Could not determine if repeater item is expanded because it is not collapsible.');
529
566
  }
530
567
  /**
531
- * Expands the repeater item, or does nothing if already expanded.
568
+ * Whether the repeater item is reorderable.
532
569
  */
533
- async expand() {
534
- const chevron = await this.#getChevron();
535
- if (chevron) {
536
- if ((await chevron.getDirection()) === 'down') {
537
- await chevron.toggle();
538
- }
539
- return;
540
- }
541
- throw new Error('Could not expand the repeater item because it is not collapsible.');
570
+ async isReorderable() {
571
+ return !!(await this.#getReorderHandle());
542
572
  }
543
573
  /**
544
- * Collapses the repeater item, or does nothing if already collapsed.
574
+ * Whether a repeater item has selection enabled.
545
575
  */
546
- async collapse() {
547
- const chevron = await this.#getChevron();
548
- if (chevron) {
549
- if ((await chevron.getDirection()) === 'up') {
550
- await chevron.toggle();
551
- }
552
- return;
576
+ async isSelectable() {
577
+ return !!(await this.#getCheckbox());
578
+ }
579
+ /**
580
+ * Whether a selectable repeater item is selected. Throws an error if the item is not selectable.
581
+ */
582
+ async isSelected() {
583
+ const checkbox = await this.#getCheckbox();
584
+ if (!checkbox) {
585
+ throw new Error('Could not determine if repeater item is selected because it is not selectable.');
553
586
  }
554
- throw new Error('Could not collapse the repeater item because it is not collapsible.');
587
+ return await checkbox.isChecked();
555
588
  }
556
589
  /**
557
- * Whether the repeater item is reorderable.
590
+ * Selects the repeater item.
558
591
  */
559
- async isReorderable() {
560
- return !!(await this.#getReorderHandle());
592
+ async select() {
593
+ const checkbox = await this.#getCheckbox();
594
+ if (!checkbox) {
595
+ throw new Error('Could not select the repeater item because it is not selectable.');
596
+ }
597
+ await checkbox.check();
561
598
  }
562
599
  /**
563
600
  * Moves the repeater item to the top of the list
@@ -580,6 +617,7 @@ class SkyRepeaterHarness extends SkyComponentHarness {
580
617
  * @internal
581
618
  */
582
619
  static { this.hostSelector = 'sky-repeater'; }
620
+ #getRepeater = this.locatorFor('.sky-repeater');
583
621
  /**
584
622
  * Gets a `HarnessPredicate` that can be used to search for a
585
623
  * `SkyRepeaterHarness` that meets certain criteria.
@@ -602,6 +640,12 @@ class SkyRepeaterHarness extends SkyComponentHarness {
602
640
  async getRepeaterItems(filters) {
603
641
  return await this.locatorForAll(SkyRepeaterItemHarness.with(filters || {}))();
604
642
  }
643
+ /**
644
+ * Gets the aria-label for the repeater list
645
+ */
646
+ async getAriaLabel() {
647
+ return await (await this.#getRepeater()).getAttribute('aria-label');
648
+ }
605
649
  }
606
650
 
607
651
  /**
@@ -954,5 +998,5 @@ class SkyInfiniteScrollHarness extends SkyComponentHarness {
954
998
  * Generated bundle index. Do not edit.
955
999
  */
956
1000
 
957
- export { SkyFilterButtonHarness, SkyFilterInlineHarness, SkyFilterInlineItemHarness, SkyFilterSummaryHarness, SkyFilterSummaryItemHarness, SkyFilterTestingModule, SkyInfiniteScrollFixture, SkyInfiniteScrollHarness, SkyInfiniteScrollTestingModule, SkyPagingContentHarness, SkyPagingFixture, SkyPagingHarness, SkyRepeaterHarness, SkyRepeaterItemHarness, SkySortFixture, SkySortHarness, SkySortItemHarness };
1001
+ export { SkyFilterButtonHarness, SkyFilterInlineHarness, SkyFilterInlineItemHarness, SkyFilterSummaryHarness, SkyFilterSummaryItemHarness, SkyFilterTestingModule, SkyInfiniteScrollFixture, SkyInfiniteScrollHarness, SkyInfiniteScrollTestingModule, SkyPagingContentHarness, SkyPagingFixture, SkyPagingHarness, SkyRepeaterHarness, SkyRepeaterItemContextMenuHarness, SkyRepeaterItemHarness, SkySortFixture, SkySortHarness, SkySortItemHarness };
958
1002
  //# sourceMappingURL=skyux-lists-testing.mjs.map