@patternfly/elements 3.0.1 → 4.0.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/custom-elements.json +8857 -8783
- package/form-control.css +127 -0
- package/package.json +12 -25
- package/pf-accordion/pf-accordion-header.css +23 -0
- package/pf-accordion/pf-accordion-header.d.ts +52 -43
- package/pf-accordion/pf-accordion-header.js +130 -87
- package/pf-accordion/pf-accordion-header.js.map +1 -1
- package/pf-accordion/pf-accordion-panel.css +15 -0
- package/pf-accordion/pf-accordion-panel.d.ts +27 -25
- package/pf-accordion/pf-accordion-panel.js +29 -43
- package/pf-accordion/pf-accordion-panel.js.map +1 -1
- package/pf-accordion/pf-accordion.d.ts +122 -65
- package/pf-accordion/pf-accordion.js +283 -94
- package/pf-accordion/pf-accordion.js.map +1 -1
- package/pf-accordion/test/pf-accordion.e2e.js +12 -0
- package/pf-accordion/test/pf-accordion.e2e.js.map +1 -1
- package/pf-accordion/test/pf-accordion.spec.js +366 -350
- package/pf-accordion/test/pf-accordion.spec.js.map +1 -1
- package/pf-avatar/pf-avatar.css +50 -24
- package/pf-avatar/pf-avatar.d.ts +29 -3
- package/pf-avatar/pf-avatar.js +51 -9
- package/pf-avatar/pf-avatar.js.map +1 -1
- package/pf-avatar/test/pf-avatar.e2e.js +12 -0
- package/pf-avatar/test/pf-avatar.e2e.js.map +1 -1
- package/pf-avatar/test/pf-avatar.spec.js +2 -3
- package/pf-avatar/test/pf-avatar.spec.js.map +1 -1
- package/pf-back-to-top/pf-back-to-top.css +10 -0
- package/pf-back-to-top/pf-back-to-top.d.ts +14 -18
- package/pf-back-to-top/pf-back-to-top.js +9 -30
- package/pf-back-to-top/pf-back-to-top.js.map +1 -1
- package/pf-back-to-top/test/pf-back-to-top.e2e.js +12 -0
- package/pf-back-to-top/test/pf-back-to-top.e2e.js.map +1 -1
- package/pf-background-image/pf-background-image.d.ts +4 -4
- package/pf-background-image/pf-background-image.js +1 -12
- package/pf-background-image/pf-background-image.js.map +1 -1
- package/pf-background-image/test/pf-background-image.e2e.js +12 -0
- package/pf-background-image/test/pf-background-image.e2e.js.map +1 -1
- package/pf-badge/pf-badge.css +4 -0
- package/pf-badge/pf-badge.d.ts +26 -22
- package/pf-badge/pf-badge.js +14 -27
- package/pf-badge/pf-badge.js.map +1 -1
- package/pf-badge/test/pf-badge.e2e.js +12 -0
- package/pf-badge/test/pf-badge.e2e.js.map +1 -1
- package/pf-banner/pf-banner.d.ts +16 -16
- package/pf-banner/pf-banner.js +1 -24
- package/pf-banner/pf-banner.js.map +1 -1
- package/pf-banner/test/pf-banner.e2e.js +12 -0
- package/pf-banner/test/pf-banner.e2e.js.map +1 -1
- package/pf-button/pf-button.css +22 -12
- package/pf-button/pf-button.d.ts +128 -122
- package/pf-button/pf-button.js +95 -172
- package/pf-button/pf-button.js.map +1 -1
- package/pf-button/test/pf-button.e2e.js +12 -0
- package/pf-button/test/pf-button.e2e.js.map +1 -1
- package/pf-card/pf-card.css +172 -43
- package/pf-card/pf-card.d.ts +41 -38
- package/pf-card/pf-card.js +37 -54
- package/pf-card/pf-card.js.map +1 -1
- package/pf-card/test/pf-card.e2e.js +12 -0
- package/pf-card/test/pf-card.e2e.js.map +1 -1
- package/pf-chip/pf-chip-group.css +9 -6
- package/pf-chip/pf-chip-group.d.ts +27 -14
- package/pf-chip/pf-chip-group.js +65 -94
- package/pf-chip/pf-chip-group.js.map +1 -1
- package/pf-chip/pf-chip.d.ts +20 -9
- package/pf-chip/pf-chip.js +1 -8
- package/pf-chip/pf-chip.js.map +1 -1
- package/pf-chip/test/pf-chip-group.spec.js +42 -22
- package/pf-chip/test/pf-chip-group.spec.js.map +1 -1
- package/pf-chip/test/pf-chip.e2e.js +12 -0
- package/pf-chip/test/pf-chip.e2e.js.map +1 -1
- package/pf-clipboard-copy/pf-clipboard-copy.css +83 -85
- package/pf-clipboard-copy/pf-clipboard-copy.d.ts +53 -18
- package/pf-clipboard-copy/pf-clipboard-copy.js +55 -44
- package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js +12 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js.map +1 -1
- package/pf-code-block/pf-code-block.css +7 -4
- package/pf-code-block/pf-code-block.d.ts +4 -25
- package/pf-code-block/pf-code-block.js +44 -23
- package/pf-code-block/pf-code-block.js.map +1 -1
- package/pf-code-block/test/pf-code-block.e2e.js +12 -0
- package/pf-code-block/test/pf-code-block.e2e.js.map +1 -1
- package/pf-dropdown/context.d.ts +2 -3
- package/pf-dropdown/context.js.map +1 -1
- package/pf-dropdown/pf-dropdown-group.d.ts +3 -9
- package/pf-dropdown/pf-dropdown-group.js +1 -5
- package/pf-dropdown/pf-dropdown-group.js.map +1 -1
- package/pf-dropdown/pf-dropdown-item.d.ts +21 -27
- package/pf-dropdown/pf-dropdown-item.js +1 -37
- package/pf-dropdown/pf-dropdown-item.js.map +1 -1
- package/pf-dropdown/pf-dropdown-menu.d.ts +4 -10
- package/pf-dropdown/pf-dropdown-menu.js +23 -23
- package/pf-dropdown/pf-dropdown-menu.js.map +1 -1
- package/pf-dropdown/pf-dropdown.d.ts +8 -24
- package/pf-dropdown/pf-dropdown.js +1 -26
- package/pf-dropdown/pf-dropdown.js.map +1 -1
- package/pf-dropdown/test/pf-dropdown.e2e.js +12 -0
- package/pf-dropdown/test/pf-dropdown.e2e.js.map +1 -1
- package/pf-icon/pf-icon.css +22 -0
- package/pf-icon/pf-icon.d.ts +93 -4
- package/pf-icon/pf-icon.js +191 -13
- package/pf-icon/pf-icon.js.map +1 -1
- package/pf-icon/test/pf-icon.e2e.js +12 -0
- package/pf-icon/test/pf-icon.e2e.js.map +1 -1
- package/pf-icon/test/pf-icon.spec.js +102 -88
- package/pf-icon/test/pf-icon.spec.js.map +1 -1
- package/pf-jump-links/pf-jump-links-item.d.ts +4 -11
- package/pf-jump-links/pf-jump-links-item.js +8 -15
- package/pf-jump-links/pf-jump-links-item.js.map +1 -1
- package/pf-jump-links/pf-jump-links-list.d.ts +2 -2
- package/pf-jump-links/pf-jump-links-list.js +1 -5
- package/pf-jump-links/pf-jump-links-list.js.map +1 -1
- package/pf-jump-links/pf-jump-links.d.ts +2 -2
- package/pf-jump-links/pf-jump-links.js +23 -62
- package/pf-jump-links/pf-jump-links.js.map +1 -1
- package/pf-jump-links/test/pf-jump-links.e2e.js +12 -0
- package/pf-jump-links/test/pf-jump-links.e2e.js.map +1 -1
- package/pf-label/pf-label.css +38 -5
- package/pf-label/pf-label.d.ts +65 -69
- package/pf-label/pf-label.js +49 -90
- package/pf-label/pf-label.js.map +1 -1
- package/pf-label/test/pf-label.e2e.js +12 -0
- package/pf-label/test/pf-label.e2e.js.map +1 -1
- package/pf-label/test/pf-label.spec.js +26 -16
- package/pf-label/test/pf-label.spec.js.map +1 -1
- package/pf-modal/pf-modal.d.ts +17 -22
- package/pf-modal/pf-modal.js +13 -39
- package/pf-modal/pf-modal.js.map +1 -1
- package/pf-modal/test/pf-modal.e2e.js +12 -0
- package/pf-modal/test/pf-modal.e2e.js.map +1 -1
- package/pf-panel/pf-panel.d.ts +31 -3
- package/pf-panel/pf-panel.js +1 -10
- package/pf-panel/pf-panel.js.map +1 -1
- package/pf-panel/test/pf-panel.e2e.js +12 -0
- package/pf-panel/test/pf-panel.e2e.js.map +1 -1
- package/pf-popover/pf-popover.d.ts +66 -84
- package/pf-popover/pf-popover.js +33 -150
- package/pf-popover/pf-popover.js.map +1 -1
- package/pf-popover/test/pf-popover.e2e.js +12 -0
- package/pf-popover/test/pf-popover.e2e.js.map +1 -1
- package/pf-popover/test/pf-popover.spec.js +0 -11
- package/pf-popover/test/pf-popover.spec.js.map +1 -1
- package/pf-progress/pf-progress.d.ts +40 -40
- package/pf-progress/pf-progress.js +1 -61
- package/pf-progress/pf-progress.js.map +1 -1
- package/pf-progress/test/pf-progress.e2e.js +12 -0
- package/pf-progress/test/pf-progress.e2e.js.map +1 -1
- package/pf-progress-stepper/pf-progress-step.d.ts +2 -3
- package/pf-progress-stepper/pf-progress-step.js +4 -14
- package/pf-progress-stepper/pf-progress-step.js.map +1 -1
- package/pf-progress-stepper/pf-progress-stepper.d.ts +118 -2
- package/pf-progress-stepper/pf-progress-stepper.js +10 -12
- package/pf-progress-stepper/pf-progress-stepper.js.map +1 -1
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js +12 -0
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js.map +1 -1
- package/pf-select/pf-option-group.d.ts +2 -2
- package/pf-select/pf-option-group.js +1 -5
- package/pf-select/pf-option-group.js.map +1 -1
- package/pf-select/pf-option.css +1 -1
- package/pf-select/pf-option.d.ts +4 -4
- package/pf-select/pf-option.js +20 -30
- package/pf-select/pf-option.js.map +1 -1
- package/pf-select/pf-select.css +14 -6
- package/pf-select/pf-select.d.ts +183 -40
- package/pf-select/pf-select.js +185 -260
- package/pf-select/pf-select.js.map +1 -1
- package/pf-select/test/pf-select.e2e.js +12 -0
- package/pf-select/test/pf-select.e2e.js.map +1 -1
- package/pf-select/test/pf-select.spec.js +1292 -613
- package/pf-select/test/pf-select.spec.js.map +1 -1
- package/pf-spinner/pf-spinner.css +27 -17
- package/pf-spinner/pf-spinner.d.ts +21 -17
- package/pf-spinner/pf-spinner.js +20 -24
- package/pf-spinner/pf-spinner.js.map +1 -1
- package/pf-spinner/test/pf-spinner.e2e.js +12 -0
- package/pf-spinner/test/pf-spinner.e2e.js.map +1 -1
- package/pf-switch/pf-switch.css +39 -13
- package/pf-switch/pf-switch.d.ts +48 -34
- package/pf-switch/pf-switch.js +114 -43
- package/pf-switch/pf-switch.js.map +1 -1
- package/pf-switch/test/pf-switch.e2e.js +12 -0
- package/pf-switch/test/pf-switch.e2e.js.map +1 -1
- package/pf-table/pf-caption.d.ts +2 -2
- package/pf-table/pf-caption.js +1 -4
- package/pf-table/pf-caption.js.map +1 -1
- package/pf-table/pf-table.d.ts +424 -424
- package/pf-table/pf-table.js +7 -645
- package/pf-table/pf-table.js.map +1 -1
- package/pf-table/pf-tbody.d.ts +2 -2
- package/pf-table/pf-tbody.js +1 -4
- package/pf-table/pf-tbody.js.map +1 -1
- package/pf-table/pf-td.d.ts +2 -2
- package/pf-table/pf-td.js +1 -4
- package/pf-table/pf-td.js.map +1 -1
- package/pf-table/pf-th.d.ts +2 -2
- package/pf-table/pf-th.js +1 -4
- package/pf-table/pf-th.js.map +1 -1
- package/pf-table/pf-thead.d.ts +2 -2
- package/pf-table/pf-thead.js +1 -4
- package/pf-table/pf-thead.js.map +1 -1
- package/pf-table/pf-tr.d.ts +1 -1
- package/pf-table/pf-tr.js +1 -4
- package/pf-table/pf-tr.js.map +1 -1
- package/pf-table/test/pf-table.e2e.js +12 -0
- package/pf-table/test/pf-table.e2e.js.map +1 -1
- package/pf-tabs/context.d.ts +2 -3
- package/pf-tabs/context.js.map +1 -1
- package/pf-tabs/pf-tab-panel.d.ts +3 -5
- package/pf-tabs/pf-tab-panel.js +1 -7
- package/pf-tabs/pf-tab-panel.js.map +1 -1
- package/pf-tabs/pf-tab.d.ts +37 -37
- package/pf-tabs/pf-tab.js +16 -54
- package/pf-tabs/pf-tab.js.map +1 -1
- package/pf-tabs/pf-tabs.d.ts +36 -37
- package/pf-tabs/pf-tabs.js +40 -78
- package/pf-tabs/pf-tabs.js.map +1 -1
- package/pf-tabs/test/pf-tabs.e2e.js +12 -0
- package/pf-tabs/test/pf-tabs.e2e.js.map +1 -1
- package/pf-tabs/test/pf-tabs.spec.js +11 -12
- package/pf-tabs/test/pf-tabs.spec.js.map +1 -1
- package/pf-text-area/pf-text-area.d.ts +128 -134
- package/pf-text-area/pf-text-area.js +7 -131
- package/pf-text-area/pf-text-area.js.map +1 -1
- package/pf-text-area/test/pf-text-area.e2e.js +12 -0
- package/pf-text-area/test/pf-text-area.e2e.js.map +1 -1
- package/pf-text-input/pf-text-input.d.ts +129 -135
- package/pf-text-input/pf-text-input.js +7 -132
- package/pf-text-input/pf-text-input.js.map +1 -1
- package/pf-text-input/test/pf-text-input.e2e.js +12 -0
- package/pf-text-input/test/pf-text-input.e2e.js.map +1 -1
- package/pf-tile/pf-tile.d.ts +21 -20
- package/pf-tile/pf-tile.js +18 -35
- package/pf-tile/pf-tile.js.map +1 -1
- package/pf-tile/test/pf-tile.e2e.js +12 -0
- package/pf-tile/test/pf-tile.e2e.js.map +1 -1
- package/pf-timestamp/pf-timestamp.d.ts +2 -2
- package/pf-timestamp/pf-timestamp.js +1 -3
- package/pf-timestamp/pf-timestamp.js.map +1 -1
- package/pf-timestamp/test/pf-timestamp.e2e.js +12 -0
- package/pf-timestamp/test/pf-timestamp.e2e.js.map +1 -1
- package/pf-tooltip/pf-tooltip.d.ts +51 -50
- package/pf-tooltip/pf-tooltip.js +26 -106
- package/pf-tooltip/pf-tooltip.js.map +1 -1
- package/pf-tooltip/test/pf-tooltip.e2e.js +12 -0
- package/pf-tooltip/test/pf-tooltip.e2e.js.map +1 -1
- package/pfe.min.js +1194 -1002
- package/pfe.min.js.map +4 -4
- package/react/pf-accordion/pf-accordion-header.js +2 -2
- package/react/pf-accordion/pf-accordion-panel.js +2 -2
- package/react/pf-accordion/pf-accordion.js +2 -2
- package/react/pf-avatar/pf-avatar.d.ts +1 -1
- package/react/pf-avatar/pf-avatar.js +5 -3
- package/react/pf-back-to-top/pf-back-to-top.js +2 -2
- package/react/pf-background-image/pf-background-image.js +2 -2
- package/react/pf-badge/pf-badge.js +2 -2
- package/react/pf-banner/pf-banner.js +2 -2
- package/react/pf-button/pf-button.js +2 -2
- package/react/pf-card/pf-card.js +2 -2
- package/react/pf-chip/pf-chip-group.js +2 -2
- package/react/pf-chip/pf-chip.js +2 -2
- package/react/pf-clipboard-copy/pf-clipboard-copy.d.ts +1 -1
- package/react/pf-clipboard-copy/pf-clipboard-copy.js +5 -3
- package/react/pf-code-block/pf-code-block.js +2 -2
- package/react/pf-dropdown/pf-dropdown-group.js +2 -2
- package/react/pf-dropdown/pf-dropdown-item.js +2 -2
- package/react/pf-dropdown/pf-dropdown-menu.js +2 -2
- package/react/pf-dropdown/pf-dropdown.js +2 -2
- package/react/pf-icon/pf-icon.js +2 -2
- package/react/pf-jump-links/pf-jump-links-item.js +2 -2
- package/react/pf-jump-links/pf-jump-links-list.js +2 -2
- package/react/pf-jump-links/pf-jump-links.js +2 -2
- package/react/pf-label/pf-label.js +2 -2
- package/react/pf-modal/pf-modal.js +2 -2
- package/react/pf-panel/pf-panel.js +2 -2
- package/react/pf-popover/pf-popover.js +2 -2
- package/react/pf-progress/pf-progress.js +2 -2
- package/react/pf-progress-stepper/pf-progress-step.js +2 -2
- package/react/pf-progress-stepper/pf-progress-stepper.js +2 -2
- package/react/pf-select/pf-option-group.js +2 -2
- package/react/pf-select/pf-option.js +2 -2
- package/react/pf-select/pf-select.d.ts +1 -1
- package/react/pf-select/pf-select.js +2 -3
- package/react/pf-spinner/pf-spinner.js +2 -2
- package/react/pf-switch/pf-switch.js +2 -2
- package/react/pf-table/pf-caption.js +2 -2
- package/react/pf-table/pf-table.js +2 -2
- package/react/pf-table/pf-tbody.js +2 -2
- package/react/pf-table/pf-td.js +2 -2
- package/react/pf-table/pf-th.js +2 -2
- package/react/pf-table/pf-thead.js +2 -2
- package/react/pf-table/pf-tr.js +2 -2
- package/react/pf-tabs/pf-tab-panel.js +2 -2
- package/react/pf-tabs/pf-tab.js +2 -2
- package/react/pf-tabs/pf-tabs.js +2 -2
- package/react/pf-text-area/pf-text-area.js +2 -2
- package/react/pf-text-input/pf-text-input.js +2 -2
- package/react/pf-tile/pf-tile.js +2 -2
- package/react/pf-timestamp/pf-timestamp.js +2 -2
- package/react/pf-tooltip/pf-tooltip.js +2 -2
- package/pf-accordion/BaseAccordion.d.ts +0 -61
- package/pf-accordion/BaseAccordion.js +0 -269
- package/pf-accordion/BaseAccordion.js.map +0 -1
- package/pf-accordion/BaseAccordionHeader.css +0 -39
- package/pf-accordion/BaseAccordionHeader.d.ts +0 -29
- package/pf-accordion/BaseAccordionHeader.js +0 -128
- package/pf-accordion/BaseAccordionHeader.js.map +0 -1
- package/pf-accordion/BaseAccordionPanel.css +0 -27
- package/pf-accordion/BaseAccordionPanel.d.ts +0 -7
- package/pf-accordion/BaseAccordionPanel.js +0 -33
- package/pf-accordion/BaseAccordionPanel.js.map +0 -1
- package/pf-avatar/BaseAvatar.css +0 -13
- package/pf-avatar/BaseAvatar.d.ts +0 -23
- package/pf-avatar/BaseAvatar.js +0 -62
- package/pf-avatar/BaseAvatar.js.map +0 -1
- package/pf-back-to-top/demo/demo.css +0 -25
- package/pf-badge/BaseBadge.css +0 -6
- package/pf-badge/BaseBadge.d.ts +0 -18
- package/pf-badge/BaseBadge.js +0 -16
- package/pf-badge/BaseBadge.js.map +0 -1
- package/pf-button/BaseButton.css +0 -68
- package/pf-button/BaseButton.d.ts +0 -51
- package/pf-button/BaseButton.js +0 -84
- package/pf-button/BaseButton.js.map +0 -1
- package/pf-card/BaseCard.css +0 -36
- package/pf-card/BaseCard.d.ts +0 -24
- package/pf-card/BaseCard.js +0 -51
- package/pf-card/BaseCard.js.map +0 -1
- package/pf-clipboard-copy/BaseClipboardCopy.css +0 -6
- package/pf-clipboard-copy/BaseClipboardCopy.d.ts +0 -18
- package/pf-clipboard-copy/BaseClipboardCopy.js +0 -25
- package/pf-clipboard-copy/BaseClipboardCopy.js.map +0 -1
- package/pf-code-block/BaseCodeBlock.css +0 -7
- package/pf-code-block/BaseCodeBlock.d.ts +0 -8
- package/pf-code-block/BaseCodeBlock.js +0 -22
- package/pf-code-block/BaseCodeBlock.js.map +0 -1
- package/pf-icon/BaseIcon.css +0 -22
- package/pf-icon/BaseIcon.d.ts +0 -41
- package/pf-icon/BaseIcon.js +0 -144
- package/pf-icon/BaseIcon.js.map +0 -1
- package/pf-label/BaseLabel.css +0 -44
- package/pf-label/BaseLabel.d.ts +0 -30
- package/pf-label/BaseLabel.js +0 -29
- package/pf-label/BaseLabel.js.map +0 -1
- package/pf-spinner/BaseSpinner.css +0 -20
- package/pf-spinner/BaseSpinner.d.ts +0 -27
- package/pf-spinner/BaseSpinner.js +0 -45
- package/pf-spinner/BaseSpinner.js.map +0 -1
- package/pf-switch/BaseSwitch.css +0 -36
- package/pf-switch/BaseSwitch.d.ts +0 -19
- package/pf-switch/BaseSwitch.js +0 -109
- package/pf-switch/BaseSwitch.js.map +0 -1
- package/pf-tabs/BaseTab.css +0 -60
- package/pf-tabs/BaseTab.d.ts +0 -32
- package/pf-tabs/BaseTab.js +0 -83
- package/pf-tabs/BaseTab.js.map +0 -1
- package/pf-tabs/BaseTabPanel.css +0 -7
- package/pf-tabs/BaseTabPanel.d.ts +0 -7
- package/pf-tabs/BaseTabPanel.js +0 -36
- package/pf-tabs/BaseTabPanel.js.map +0 -1
- package/pf-tabs/BaseTabs.css +0 -86
- package/pf-tabs/BaseTabs.d.ts +0 -38
- package/pf-tabs/BaseTabs.js +0 -221
- package/pf-tabs/BaseTabs.js.map +0 -1
- package/pf-tile/BaseTile.d.ts +0 -13
- package/pf-tile/BaseTile.js +0 -28
- package/pf-tile/BaseTile.js.map +0 -1
- package/pf-tooltip/BaseTooltip.css +0 -70
- package/pf-tooltip/BaseTooltip.d.ts +0 -16
- package/pf-tooltip/BaseTooltip.js +0 -54
- package/pf-tooltip/BaseTooltip.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { expect, html, aTimeout, nextFrame } from '@open-wc/testing';
|
|
2
|
-
import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
|
|
1
|
+
import { expect, fixture, html, aTimeout, nextFrame } from '@open-wc/testing';
|
|
3
2
|
import { sendKeys } from '@web/test-runner-commands';
|
|
3
|
+
import { allUpdates, clickElementAtCenter } from '@patternfly/pfe-tools/test/utils.js';
|
|
4
|
+
import { a11ySnapshot, querySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';
|
|
4
5
|
// Import the element we're testing.
|
|
5
6
|
import { PfAccordion, PfAccordionPanel, PfAccordionHeader } from '@patternfly/elements/pf-accordion/pf-accordion.js';
|
|
6
7
|
import { PfSwitch } from '@patternfly/elements/pf-switch/pf-switch.js';
|
|
7
8
|
import { Logger } from '@patternfly/pfe-core/controllers/logger.js';
|
|
8
9
|
import '@patternfly/pfe-tools/test/stub-logger.js';
|
|
9
|
-
import { allUpdates } from '@patternfly/pfe-tools/test/utils.js';
|
|
10
10
|
describe('<pf-accordion>', function () {
|
|
11
11
|
let element;
|
|
12
12
|
let headers;
|
|
@@ -16,11 +16,11 @@ describe('<pf-accordion>', function () {
|
|
|
16
16
|
let secondHeader;
|
|
17
17
|
let secondPanel;
|
|
18
18
|
async function clickFirstHeader() {
|
|
19
|
-
header
|
|
19
|
+
await clickElementAtCenter(header);
|
|
20
20
|
await allUpdates(element);
|
|
21
21
|
}
|
|
22
22
|
async function clickSecondHeader() {
|
|
23
|
-
secondHeader
|
|
23
|
+
await clickElementAtCenter(secondHeader);
|
|
24
24
|
await allUpdates(element);
|
|
25
25
|
}
|
|
26
26
|
async function callToggle(index) {
|
|
@@ -55,7 +55,7 @@ describe('<pf-accordion>', function () {
|
|
|
55
55
|
expect(document.createElement('pf-accordion-panel')).to.be.an.instanceof(PfAccordionPanel);
|
|
56
56
|
});
|
|
57
57
|
it('simply instantiating', async function () {
|
|
58
|
-
element = await
|
|
58
|
+
element = await fixture(html `<pf-accordion></pf-accordion>`);
|
|
59
59
|
expect(element, 'pf-accordion should be an instance of PfAccordion')
|
|
60
60
|
.to.be.an.instanceof(customElements.get('pf-accordion'))
|
|
61
61
|
.and
|
|
@@ -63,29 +63,29 @@ describe('<pf-accordion>', function () {
|
|
|
63
63
|
});
|
|
64
64
|
describe('in typical usage', function () {
|
|
65
65
|
beforeEach(async function () {
|
|
66
|
-
element = await
|
|
66
|
+
element = await fixture(html `
|
|
67
67
|
<pf-accordion>
|
|
68
68
|
<pf-accordion-header id="header1" data-index="0">
|
|
69
|
-
<h3>Consetetur sadipscing elitr?</h3>
|
|
69
|
+
<h3>Header1 Consetetur sadipscing elitr?</h3>
|
|
70
70
|
</pf-accordion-header>
|
|
71
71
|
<pf-accordion-panel id="panel1" data-index="0">
|
|
72
|
-
<p
|
|
72
|
+
<p>Panel1 <a href="#">Panel1 link Lorem ipsum dolor</a>, sit amet consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
|
|
73
73
|
ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
|
|
74
74
|
rebum.</p>
|
|
75
75
|
</pf-accordion-panel>
|
|
76
76
|
<pf-accordion-header data-index="1">
|
|
77
|
-
<h3>Labore et dolore magna aliquyam erat?</h3>
|
|
77
|
+
<h3>Header2 Labore et dolore magna aliquyam erat?</h3>
|
|
78
78
|
</pf-accordion-header>
|
|
79
79
|
<pf-accordion-panel data-index="1">
|
|
80
|
-
<p
|
|
80
|
+
<p>Panel2 <a href="#">Panel2 link Lorem ipsum dolor</a> sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
|
|
81
81
|
ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
|
|
82
82
|
rebum.</p>
|
|
83
83
|
</pf-accordion-panel>
|
|
84
84
|
<pf-accordion-header data-index="2">
|
|
85
|
-
<h3>Incididunt in Lorem voluptate eiusmod dolor?</h3>
|
|
85
|
+
<h3>Header3 Incididunt in Lorem voluptate eiusmod dolor?</h3>
|
|
86
86
|
</pf-accordion-header>
|
|
87
87
|
<pf-accordion-panel data-index="2">
|
|
88
|
-
<p
|
|
88
|
+
<p>Panel3<a href="#">Panel3 link Lorem ipsum dolor</a> sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
|
|
89
89
|
ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
|
|
90
90
|
rebum.</p>
|
|
91
91
|
</pf-accordion-panel>
|
|
@@ -95,8 +95,8 @@ describe('<pf-accordion>', function () {
|
|
|
95
95
|
panels = Array.from(element.querySelectorAll('pf-accordion-panel'));
|
|
96
96
|
[header, secondHeader] = headers;
|
|
97
97
|
[panel, secondPanel] = panels;
|
|
98
|
-
await allUpdates(element);
|
|
99
98
|
});
|
|
99
|
+
beforeEach(() => allUpdates(element));
|
|
100
100
|
it('randomly generates ids on children', function () {
|
|
101
101
|
expect(secondHeader.id).to.match(/pf-/);
|
|
102
102
|
expect(secondPanel.id).to.match(/panel-/);
|
|
@@ -107,16 +107,22 @@ describe('<pf-accordion>', function () {
|
|
|
107
107
|
});
|
|
108
108
|
describe('clicking the first header', function () {
|
|
109
109
|
beforeEach(clickFirstHeader);
|
|
110
|
-
it('expands first pair', function () {
|
|
111
|
-
|
|
110
|
+
it('expands first pair', async function () {
|
|
111
|
+
const snapshot = await a11ySnapshot();
|
|
112
|
+
const expanded = querySnapshot(snapshot, { expanded: true });
|
|
113
|
+
const focused = querySnapshot(snapshot, { focused: true });
|
|
114
|
+
expect(expanded?.name).to.equal(header.textContent?.trim());
|
|
112
115
|
expect(header.expanded).to.be.true;
|
|
113
116
|
expect(panel.hasAttribute('expanded')).to.be.true;
|
|
114
117
|
expect(panel.expanded).to.be.true;
|
|
118
|
+
expect(expanded).to.equal(focused);
|
|
115
119
|
});
|
|
116
120
|
describe('then clicking first header again', function () {
|
|
117
121
|
beforeEach(clickFirstHeader);
|
|
118
|
-
it('collapses first pair', function () {
|
|
119
|
-
|
|
122
|
+
it('collapses first pair', async function () {
|
|
123
|
+
const snapshot = await a11ySnapshot();
|
|
124
|
+
const expanded = snapshot?.children?.find(x => x.expanded);
|
|
125
|
+
expect(expanded).to.not.be.ok;
|
|
120
126
|
expect(header.expanded).to.be.false;
|
|
121
127
|
expect(panel.hasAttribute('expanded')).to.be.false;
|
|
122
128
|
expect(panel.expanded).to.be.false;
|
|
@@ -189,11 +195,11 @@ describe('<pf-accordion>', function () {
|
|
|
189
195
|
/* ATTRIBUTE TESTS */
|
|
190
196
|
describe('setting expanded-index attribute', function () {
|
|
191
197
|
const indices = '1,2';
|
|
192
|
-
beforeEach(
|
|
198
|
+
beforeEach(function () {
|
|
193
199
|
element.setAttribute('expanded-index', indices);
|
|
194
|
-
await allUpdates(element);
|
|
195
|
-
await nextFrame();
|
|
196
200
|
});
|
|
201
|
+
beforeEach(() => allUpdates(element));
|
|
202
|
+
beforeEach(nextFrame);
|
|
197
203
|
it('expands the pairs listed in the expanded-index attribute', function () {
|
|
198
204
|
for (const idx of indices.split(',').map(x => parseInt(x))) {
|
|
199
205
|
const header = headers[idx];
|
|
@@ -206,7 +212,7 @@ describe('<pf-accordion>', function () {
|
|
|
206
212
|
});
|
|
207
213
|
});
|
|
208
214
|
describe('dynamically adding pairs', function () {
|
|
209
|
-
beforeEach(
|
|
215
|
+
beforeEach(function () {
|
|
210
216
|
const newHeader = document.createElement('pf-accordion-header');
|
|
211
217
|
newHeader.id = 'newHeader';
|
|
212
218
|
newHeader.innerHTML = `<h2>New Header</h2>`;
|
|
@@ -215,8 +221,8 @@ describe('<pf-accordion>', function () {
|
|
|
215
221
|
newPanel.innerHTML = `New Panel`;
|
|
216
222
|
element.appendChild(newHeader);
|
|
217
223
|
element.appendChild(newPanel);
|
|
218
|
-
await allUpdates(element);
|
|
219
224
|
});
|
|
225
|
+
beforeEach(() => allUpdates(element));
|
|
220
226
|
it('properly initializes new pairs', function () {
|
|
221
227
|
const newHeader = headers.at(-1);
|
|
222
228
|
const newPanel = panels.at(-1);
|
|
@@ -275,28 +281,27 @@ describe('<pf-accordion>', function () {
|
|
|
275
281
|
afterEach(async function () {
|
|
276
282
|
[header1, header2, header3] = [];
|
|
277
283
|
[panel1, panel2, panel3] = [];
|
|
284
|
+
await fixture('');
|
|
278
285
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
expect(panel3.hidden, 'panel3').to.be.true;
|
|
284
|
-
});
|
|
286
|
+
it('applies hidden attribute to all panels', function () {
|
|
287
|
+
expect(panel1.hidden, 'panel1').to.be.true;
|
|
288
|
+
expect(panel2.hidden, 'panel2').to.be.true;
|
|
289
|
+
expect(panel3.hidden, 'panel3').to.be.true;
|
|
285
290
|
});
|
|
286
|
-
describe('
|
|
291
|
+
describe('clicking every header', function () {
|
|
287
292
|
beforeEach(async function () {
|
|
288
293
|
for (const header of element.querySelectorAll('pf-accordion-header')) {
|
|
289
|
-
header
|
|
294
|
+
await clickElementAtCenter(header);
|
|
290
295
|
}
|
|
291
|
-
await nextFrame();
|
|
292
296
|
});
|
|
297
|
+
beforeEach(nextFrame);
|
|
293
298
|
it('removes hidden attribute from all panels', function () {
|
|
294
299
|
expect(panel1.hidden, 'panel1').to.be.false;
|
|
295
300
|
expect(panel2.hidden, 'panel2').to.be.false;
|
|
296
301
|
expect(panel3.hidden, 'panel3').to.be.false;
|
|
297
302
|
});
|
|
298
303
|
});
|
|
299
|
-
describe('
|
|
304
|
+
describe('calling focus() on the first header', function () {
|
|
300
305
|
beforeEach(function () {
|
|
301
306
|
header1.focus();
|
|
302
307
|
});
|
|
@@ -329,20 +334,20 @@ describe('<pf-accordion>', function () {
|
|
|
329
334
|
});
|
|
330
335
|
describe('Tab', function () {
|
|
331
336
|
beforeEach(press('Tab'));
|
|
332
|
-
it('
|
|
333
|
-
expect(
|
|
337
|
+
it('blurs out of the accordion', async function () {
|
|
338
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
334
339
|
});
|
|
335
340
|
});
|
|
336
341
|
describe('Shift+Tab', function () {
|
|
337
342
|
beforeEach(press('Shift+Tab'));
|
|
338
|
-
it('
|
|
339
|
-
expect(
|
|
343
|
+
it('blurs out of the accordion', async function () {
|
|
344
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
340
345
|
});
|
|
341
346
|
});
|
|
342
347
|
describe('ArrowDown', function () {
|
|
343
348
|
beforeEach(press('ArrowDown'));
|
|
344
|
-
it('moves focus to the second header', function () {
|
|
345
|
-
expect(
|
|
349
|
+
it('moves focus to the second header', async function () {
|
|
350
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header2);
|
|
346
351
|
});
|
|
347
352
|
it('does not open panels', function () {
|
|
348
353
|
expect(panel1.expanded).to.be.false;
|
|
@@ -352,8 +357,8 @@ describe('<pf-accordion>', function () {
|
|
|
352
357
|
});
|
|
353
358
|
describe('ArrowUp', function () {
|
|
354
359
|
beforeEach(press('ArrowUp'));
|
|
355
|
-
it('moves focus to the last header', function () {
|
|
356
|
-
expect(
|
|
360
|
+
it('moves focus to the last header', async function () {
|
|
361
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
357
362
|
});
|
|
358
363
|
it('does not open panels', function () {
|
|
359
364
|
expect(panel1.expanded).to.be.false;
|
|
@@ -363,8 +368,8 @@ describe('<pf-accordion>', function () {
|
|
|
363
368
|
});
|
|
364
369
|
describe('Home', function () {
|
|
365
370
|
beforeEach(press('Home'));
|
|
366
|
-
it('moves focus to the first header', function () {
|
|
367
|
-
expect(
|
|
371
|
+
it('moves focus to the first header', async function () {
|
|
372
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
368
373
|
});
|
|
369
374
|
it('does not open panels', function () {
|
|
370
375
|
expect(panel1.expanded).to.be.false;
|
|
@@ -374,8 +379,8 @@ describe('<pf-accordion>', function () {
|
|
|
374
379
|
});
|
|
375
380
|
describe('End', function () {
|
|
376
381
|
beforeEach(press('End'));
|
|
377
|
-
it('moves focus to the last header', function () {
|
|
378
|
-
expect(
|
|
382
|
+
it('moves focus to the last header', async function () {
|
|
383
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
379
384
|
});
|
|
380
385
|
it('does not open panels', function () {
|
|
381
386
|
expect(panel1.expanded).to.be.false;
|
|
@@ -384,11 +389,11 @@ describe('<pf-accordion>', function () {
|
|
|
384
389
|
});
|
|
385
390
|
});
|
|
386
391
|
});
|
|
387
|
-
describe('
|
|
388
|
-
beforeEach(
|
|
392
|
+
describe('calling focus() on the middle header', function () {
|
|
393
|
+
beforeEach(function () {
|
|
389
394
|
header2.focus();
|
|
390
|
-
await nextFrame();
|
|
391
395
|
});
|
|
396
|
+
beforeEach(nextFrame);
|
|
392
397
|
describe('Space', function () {
|
|
393
398
|
beforeEach(press(' '));
|
|
394
399
|
it('expands the middle panel', function () {
|
|
@@ -407,40 +412,40 @@ describe('<pf-accordion>', function () {
|
|
|
407
412
|
});
|
|
408
413
|
describe('Tab', function () {
|
|
409
414
|
beforeEach(press('Tab'));
|
|
410
|
-
it('moves focus to the body', function () {
|
|
411
|
-
expect(
|
|
415
|
+
it('moves focus to the body', async function () {
|
|
416
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
412
417
|
});
|
|
413
418
|
});
|
|
414
419
|
describe('ArrowDown', function () {
|
|
415
420
|
beforeEach(press('ArrowDown'));
|
|
416
|
-
it('moves focus to the last header', function () {
|
|
417
|
-
expect(
|
|
421
|
+
it('moves focus to the last header', async function () {
|
|
422
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
418
423
|
});
|
|
419
424
|
});
|
|
420
425
|
describe('ArrowUp', function () {
|
|
421
426
|
beforeEach(press('ArrowUp'));
|
|
422
|
-
it('moves focus to the first header', function () {
|
|
423
|
-
expect(
|
|
427
|
+
it('moves focus to the first header', async function () {
|
|
428
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
424
429
|
});
|
|
425
430
|
});
|
|
426
431
|
describe('Home', function () {
|
|
427
432
|
beforeEach(press('Home'));
|
|
428
|
-
it('moves focus to the first header', function () {
|
|
429
|
-
expect(
|
|
433
|
+
it('moves focus to the first header', async function () {
|
|
434
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
430
435
|
});
|
|
431
436
|
});
|
|
432
437
|
describe('End', function () {
|
|
433
438
|
beforeEach(press('End'));
|
|
434
|
-
it('moves focus to the last header', function () {
|
|
435
|
-
expect(
|
|
439
|
+
it('moves focus to the last header', async function () {
|
|
440
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
436
441
|
});
|
|
437
442
|
});
|
|
438
443
|
});
|
|
439
|
-
describe('
|
|
440
|
-
beforeEach(
|
|
444
|
+
describe('calling focus() on the last header', function () {
|
|
445
|
+
beforeEach(function () {
|
|
441
446
|
header3.focus();
|
|
442
|
-
await nextFrame();
|
|
443
447
|
});
|
|
448
|
+
beforeEach(nextFrame);
|
|
444
449
|
describe('Space', function () {
|
|
445
450
|
beforeEach(press(' '));
|
|
446
451
|
it('expands the last panel', function () {
|
|
@@ -475,43 +480,47 @@ describe('<pf-accordion>', function () {
|
|
|
475
480
|
});
|
|
476
481
|
describe('Shift+Tab', function () {
|
|
477
482
|
beforeEach(press('Shift+Tab'));
|
|
478
|
-
it('moves focus to the body', function () {
|
|
479
|
-
expect(
|
|
483
|
+
it('moves focus to the body', async function () {
|
|
484
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
480
485
|
});
|
|
481
486
|
});
|
|
482
487
|
describe('ArrowDown', function () {
|
|
483
488
|
beforeEach(press('ArrowDown'));
|
|
484
|
-
it('moves focus to the first header', function () {
|
|
485
|
-
expect(
|
|
489
|
+
it('moves focus to the first header', async function () {
|
|
490
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
486
491
|
});
|
|
487
492
|
});
|
|
488
493
|
describe('ArrowUp', function () {
|
|
489
494
|
beforeEach(press('ArrowUp'));
|
|
490
|
-
it('moves focus to the middle header', function () {
|
|
491
|
-
expect(
|
|
495
|
+
it('moves focus to the middle header', async function () {
|
|
496
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header2);
|
|
492
497
|
});
|
|
493
498
|
});
|
|
494
499
|
describe('Home', function () {
|
|
495
500
|
beforeEach(press('Home'));
|
|
496
|
-
it('moves focus to the first header', function () {
|
|
497
|
-
expect(
|
|
501
|
+
it('moves focus to the first header', async function () {
|
|
502
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
498
503
|
});
|
|
499
504
|
});
|
|
500
505
|
describe('End', function () {
|
|
501
506
|
beforeEach(press('End'));
|
|
502
|
-
it('moves focus to the last header', function () {
|
|
503
|
-
expect(
|
|
507
|
+
it('moves focus to the last header', async function () {
|
|
508
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
504
509
|
});
|
|
505
510
|
});
|
|
506
511
|
});
|
|
507
|
-
describe('
|
|
508
|
-
beforeEach(
|
|
512
|
+
describe('expand(0)', function () {
|
|
513
|
+
beforeEach(function () {
|
|
509
514
|
element.expand(0);
|
|
510
|
-
await aTimeout(500);
|
|
511
515
|
});
|
|
512
|
-
|
|
516
|
+
beforeEach(nextFrame);
|
|
517
|
+
describe('calling focus() on the first header', function () {
|
|
518
|
+
beforeEach(function () {
|
|
519
|
+
header1.focus();
|
|
520
|
+
});
|
|
513
521
|
describe('Space', function () {
|
|
514
522
|
beforeEach(press(' '));
|
|
523
|
+
beforeEach(nextFrame);
|
|
515
524
|
it('collapses the first panel', function () {
|
|
516
525
|
expect(panel1.expanded).to.be.false;
|
|
517
526
|
expect(panel2.expanded).to.be.false;
|
|
@@ -528,18 +537,18 @@ describe('<pf-accordion>', function () {
|
|
|
528
537
|
});
|
|
529
538
|
describe('Tab', function () {
|
|
530
539
|
beforeEach(press('Tab'));
|
|
531
|
-
it('moves focus to the link in the first panel', function () {
|
|
532
|
-
expect(
|
|
540
|
+
it('moves focus to the link in the first panel', async function () {
|
|
541
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
533
542
|
});
|
|
534
543
|
describe('Tab', function () {
|
|
535
544
|
beforeEach(press('Tab'));
|
|
536
|
-
it('moves focus to the body', function () {
|
|
537
|
-
expect(
|
|
545
|
+
it('moves focus to the body', async function () {
|
|
546
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
538
547
|
});
|
|
539
548
|
describe('Shift+Tab', function () {
|
|
540
549
|
beforeEach(press('Shift+Tab'));
|
|
541
|
-
it('keeps focus on the link in the first panel', function () {
|
|
542
|
-
expect(
|
|
550
|
+
it('keeps focus on the link in the first panel', async function () {
|
|
551
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
543
552
|
});
|
|
544
553
|
});
|
|
545
554
|
});
|
|
@@ -547,8 +556,8 @@ describe('<pf-accordion>', function () {
|
|
|
547
556
|
beforeEach(press(' '));
|
|
548
557
|
describe('ArrowDown', function () {
|
|
549
558
|
beforeEach(press('ArrowDown'));
|
|
550
|
-
it('keeps focus on the link in the first panel', function () {
|
|
551
|
-
expect(
|
|
559
|
+
it('keeps focus on the link in the first panel', async function () {
|
|
560
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
552
561
|
});
|
|
553
562
|
it('does not open other panels', function () {
|
|
554
563
|
expect(panel1.expanded).to.be.true;
|
|
@@ -558,8 +567,8 @@ describe('<pf-accordion>', function () {
|
|
|
558
567
|
});
|
|
559
568
|
describe('ArrowUp', function () {
|
|
560
569
|
beforeEach(press('ArrowUp'));
|
|
561
|
-
it('keeps focus on the link in the first panel', function () {
|
|
562
|
-
expect(
|
|
570
|
+
it('keeps focus on the link in the first panel', async function () {
|
|
571
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
563
572
|
});
|
|
564
573
|
it('does not open other panels', function () {
|
|
565
574
|
expect(panel1.expanded).to.be.true;
|
|
@@ -569,8 +578,8 @@ describe('<pf-accordion>', function () {
|
|
|
569
578
|
});
|
|
570
579
|
describe('Home', function () {
|
|
571
580
|
beforeEach(press('Home'));
|
|
572
|
-
it('keeps focus on the link in the first panel', function () {
|
|
573
|
-
expect(
|
|
581
|
+
it('keeps focus on the link in the first panel', async function () {
|
|
582
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
574
583
|
});
|
|
575
584
|
it('does not open other panels', function () {
|
|
576
585
|
expect(panel1.expanded).to.be.true;
|
|
@@ -580,8 +589,8 @@ describe('<pf-accordion>', function () {
|
|
|
580
589
|
});
|
|
581
590
|
describe('End', function () {
|
|
582
591
|
beforeEach(press('End'));
|
|
583
|
-
it('keeps focus on the link in the first panel', function () {
|
|
584
|
-
expect(
|
|
592
|
+
it('keeps focus on the link in the first panel', async function () {
|
|
593
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
585
594
|
});
|
|
586
595
|
it('does not open other panels', function () {
|
|
587
596
|
expect(panel1.expanded).to.be.true;
|
|
@@ -593,14 +602,15 @@ describe('<pf-accordion>', function () {
|
|
|
593
602
|
});
|
|
594
603
|
describe('Shift+Tab', function () {
|
|
595
604
|
beforeEach(press('Shift+Tab'));
|
|
596
|
-
it('moves focus to the body', function () {
|
|
597
|
-
|
|
605
|
+
it('moves focus to the body', async function () {
|
|
606
|
+
const snapshot = await a11ySnapshot();
|
|
607
|
+
expect(querySnapshot(snapshot, { focused: true })).to.not.be.ok;
|
|
598
608
|
});
|
|
599
609
|
});
|
|
600
610
|
describe('ArrowDown', function () {
|
|
601
611
|
beforeEach(press('ArrowDown'));
|
|
602
|
-
it('moves focus to the second header', function () {
|
|
603
|
-
expect(
|
|
612
|
+
it('moves focus to the second header', async function () {
|
|
613
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header2);
|
|
604
614
|
});
|
|
605
615
|
it('does not open other panels', function () {
|
|
606
616
|
expect(panel1.expanded).to.be.true;
|
|
@@ -610,8 +620,8 @@ describe('<pf-accordion>', function () {
|
|
|
610
620
|
});
|
|
611
621
|
describe('ArrowUp', function () {
|
|
612
622
|
beforeEach(press('ArrowUp'));
|
|
613
|
-
it('moves focus to the last header', function () {
|
|
614
|
-
expect(
|
|
623
|
+
it('moves focus to the last header', async function () {
|
|
624
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
615
625
|
});
|
|
616
626
|
it('does not open other panels', function () {
|
|
617
627
|
expect(panel1.expanded).to.be.true;
|
|
@@ -621,8 +631,8 @@ describe('<pf-accordion>', function () {
|
|
|
621
631
|
});
|
|
622
632
|
describe('Home', function () {
|
|
623
633
|
beforeEach(press('Home'));
|
|
624
|
-
it('moves focus to the first header', function () {
|
|
625
|
-
expect(
|
|
634
|
+
it('moves focus to the first header', async function () {
|
|
635
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
626
636
|
});
|
|
627
637
|
it('does not open other panels', function () {
|
|
628
638
|
expect(panel1.expanded).to.be.true;
|
|
@@ -632,8 +642,8 @@ describe('<pf-accordion>', function () {
|
|
|
632
642
|
});
|
|
633
643
|
describe('End', function () {
|
|
634
644
|
beforeEach(press('End'));
|
|
635
|
-
it('moves focus to the last header', function () {
|
|
636
|
-
expect(
|
|
645
|
+
it('moves focus to the last header', async function () {
|
|
646
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
637
647
|
});
|
|
638
648
|
it('does not open other panels', function () {
|
|
639
649
|
expect(panel1.expanded).to.be.true;
|
|
@@ -642,21 +652,25 @@ describe('<pf-accordion>', function () {
|
|
|
642
652
|
});
|
|
643
653
|
});
|
|
644
654
|
});
|
|
645
|
-
describe('
|
|
646
|
-
beforeEach(
|
|
647
|
-
|
|
655
|
+
describe('calling focus() on the middle header', function () {
|
|
656
|
+
beforeEach(function () {
|
|
657
|
+
header2.focus();
|
|
658
|
+
});
|
|
648
659
|
describe('Shift+Tab', function () {
|
|
649
660
|
beforeEach(press('Shift+Tab'));
|
|
661
|
+
beforeEach(nextFrame);
|
|
650
662
|
it('moves focus to the link in first panel', async function () {
|
|
651
|
-
expect(
|
|
663
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
|
|
652
664
|
});
|
|
653
665
|
});
|
|
654
666
|
});
|
|
655
667
|
});
|
|
656
|
-
describe('
|
|
657
|
-
beforeEach(
|
|
668
|
+
describe('expand(1)', function () {
|
|
669
|
+
beforeEach(function () {
|
|
658
670
|
element.expand(1);
|
|
659
|
-
|
|
671
|
+
});
|
|
672
|
+
beforeEach(nextFrame);
|
|
673
|
+
it('sets the expanded property on the second panel', function () {
|
|
660
674
|
expect(panel2.expanded).to.be.true;
|
|
661
675
|
});
|
|
662
676
|
it('applies hidden attribute to the middle panel', function () {
|
|
@@ -664,11 +678,11 @@ describe('<pf-accordion>', function () {
|
|
|
664
678
|
expect(panel2.hidden, 'panel2').to.be.false;
|
|
665
679
|
expect(panel3.hidden, 'panel3').to.be.true;
|
|
666
680
|
});
|
|
667
|
-
describe('
|
|
668
|
-
beforeEach(
|
|
681
|
+
describe('calling focus() on the middle header', function () {
|
|
682
|
+
beforeEach(function () {
|
|
669
683
|
header2.focus();
|
|
670
|
-
await nextFrame();
|
|
671
684
|
});
|
|
685
|
+
beforeEach(nextFrame);
|
|
672
686
|
describe('Space', function () {
|
|
673
687
|
beforeEach(press(' '));
|
|
674
688
|
it('collapses the second panel', function () {
|
|
@@ -687,57 +701,59 @@ describe('<pf-accordion>', function () {
|
|
|
687
701
|
});
|
|
688
702
|
describe('Tab', function () {
|
|
689
703
|
beforeEach(press('Tab'));
|
|
690
|
-
it('moves focus to the link in the second panel', function () {
|
|
691
|
-
expect(
|
|
704
|
+
it('moves focus to the link in the second panel', async function () {
|
|
705
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel2.querySelector('a'));
|
|
692
706
|
});
|
|
693
707
|
});
|
|
694
708
|
describe('Shift+Tab', function () {
|
|
695
709
|
beforeEach(press('Shift+Tab'));
|
|
696
|
-
it('moves focus to the body', function () {
|
|
697
|
-
expect(
|
|
710
|
+
it('moves focus to the body', async function () {
|
|
711
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
698
712
|
});
|
|
699
713
|
});
|
|
700
714
|
describe('ArrowUp', function () {
|
|
701
715
|
beforeEach(press('ArrowUp'));
|
|
702
|
-
it('moves focus to the first header', function () {
|
|
703
|
-
expect(
|
|
716
|
+
it('moves focus to the first header', async function () {
|
|
717
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header1);
|
|
704
718
|
});
|
|
705
719
|
});
|
|
706
720
|
describe('ArrowDown', function () {
|
|
707
721
|
beforeEach(press('ArrowDown'));
|
|
708
|
-
it('moves focus to the last header', function () {
|
|
709
|
-
expect(
|
|
722
|
+
it('moves focus to the last header', async function () {
|
|
723
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(header3);
|
|
710
724
|
});
|
|
711
725
|
});
|
|
712
726
|
});
|
|
713
|
-
describe('
|
|
714
|
-
beforeEach(
|
|
727
|
+
describe('calling focus() on the last header', function () {
|
|
728
|
+
beforeEach(function () {
|
|
715
729
|
header3.focus();
|
|
716
|
-
await nextFrame();
|
|
717
730
|
});
|
|
731
|
+
beforeEach(nextFrame);
|
|
718
732
|
describe('Shift+Tab', function () {
|
|
719
733
|
beforeEach(press('Shift+Tab'));
|
|
720
|
-
it('moves focus to the link in middle panel', function () {
|
|
721
|
-
expect(
|
|
734
|
+
it('moves focus to the link in middle panel', async function () {
|
|
735
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel2.querySelector('a'));
|
|
722
736
|
});
|
|
723
737
|
});
|
|
724
738
|
});
|
|
725
739
|
});
|
|
726
|
-
describe('
|
|
727
|
-
beforeEach(
|
|
740
|
+
describe('expand(2)', function () {
|
|
741
|
+
beforeEach(function () {
|
|
728
742
|
element.expand(2);
|
|
729
|
-
|
|
743
|
+
});
|
|
744
|
+
beforeEach(nextFrame);
|
|
745
|
+
it('sets the expanded property on the last panel', function () {
|
|
730
746
|
expect(panel3.expanded).to.be.true;
|
|
731
747
|
});
|
|
732
|
-
describe('
|
|
733
|
-
beforeEach(
|
|
748
|
+
describe('calling focus() is on the last header', function () {
|
|
749
|
+
beforeEach(function () {
|
|
734
750
|
header3.focus();
|
|
735
|
-
await nextFrame();
|
|
736
751
|
});
|
|
752
|
+
beforeEach(nextFrame);
|
|
737
753
|
describe('Tab', function () {
|
|
738
754
|
beforeEach(press('Tab'));
|
|
739
|
-
it('moves focus to the link in last panel', function () {
|
|
740
|
-
expect(
|
|
755
|
+
it('moves focus to the link in last panel', async function () {
|
|
756
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel3.querySelector('a'));
|
|
741
757
|
});
|
|
742
758
|
});
|
|
743
759
|
});
|
|
@@ -746,7 +762,7 @@ describe('<pf-accordion>', function () {
|
|
|
746
762
|
});
|
|
747
763
|
describe('with single attribute', function () {
|
|
748
764
|
beforeEach(async function () {
|
|
749
|
-
element = await
|
|
765
|
+
element = await fixture(html `
|
|
750
766
|
<pf-accordion single>
|
|
751
767
|
<pf-accordion-header id="header1" data-index="0">
|
|
752
768
|
<h3>Consetetur sadipscing elitr?</h3>
|
|
@@ -810,7 +826,7 @@ describe('<pf-accordion>', function () {
|
|
|
810
826
|
});
|
|
811
827
|
describe('with expanded attribute on two headers', function () {
|
|
812
828
|
beforeEach(async function () {
|
|
813
|
-
element = await
|
|
829
|
+
element = await fixture(html `
|
|
814
830
|
<pf-accordion>
|
|
815
831
|
<pf-accordion-header data-index="0" expanded><h2>h</h2></pf-accordion-header>
|
|
816
832
|
<pf-accordion-panel data-index="0"><p>p</p></pf-accordion-panel>
|
|
@@ -838,7 +854,7 @@ describe('<pf-accordion>', function () {
|
|
|
838
854
|
});
|
|
839
855
|
describe('with single attribute and expanded attribute on two headers', function () {
|
|
840
856
|
beforeEach(async function () {
|
|
841
|
-
element = await
|
|
857
|
+
element = await fixture(html `
|
|
842
858
|
<pf-accordion single>
|
|
843
859
|
<pf-accordion-header data-index="0" expanded><h2>h</h2></pf-accordion-header>
|
|
844
860
|
<pf-accordion-panel data-index="0"><p>p</p></pf-accordion-panel>
|
|
@@ -867,7 +883,7 @@ describe('<pf-accordion>', function () {
|
|
|
867
883
|
});
|
|
868
884
|
describe('with no h* tag in heading lightdom', function () {
|
|
869
885
|
beforeEach(async function () {
|
|
870
|
-
element = await
|
|
886
|
+
element = await fixture(html `
|
|
871
887
|
<pf-accordion id="badHeader">
|
|
872
888
|
<pf-accordion-header id="bad-header-element">
|
|
873
889
|
Bad Header
|
|
@@ -884,227 +900,233 @@ describe('<pf-accordion>', function () {
|
|
|
884
900
|
.to.have.been.calledOnceWith(`[pf-accordion-header#bad-header-element]`, 'Header should contain at least 1 heading tag for correct semantics.');
|
|
885
901
|
});
|
|
886
902
|
});
|
|
887
|
-
describe('with nested pf-accordion', function () {
|
|
888
|
-
let
|
|
889
|
-
let
|
|
890
|
-
let
|
|
891
|
-
let
|
|
892
|
-
let
|
|
893
|
-
let
|
|
894
|
-
let
|
|
895
|
-
let
|
|
896
|
-
let
|
|
897
|
-
let
|
|
898
|
-
let nestedPanelThree;
|
|
903
|
+
describe('with nested <pf-accordion>', function () {
|
|
904
|
+
let topLevelHeader1;
|
|
905
|
+
let topLevelHeader2;
|
|
906
|
+
let topLevelPanel1;
|
|
907
|
+
let topLevelPanel2;
|
|
908
|
+
let nestedHeader1;
|
|
909
|
+
let nestedHeader2;
|
|
910
|
+
let nestedHeader3;
|
|
911
|
+
let nestedPanel1;
|
|
912
|
+
let nestedPanel2;
|
|
913
|
+
let nestedPanel3;
|
|
899
914
|
beforeEach(async function () {
|
|
900
|
-
element = await
|
|
915
|
+
element = await fixture(html `
|
|
901
916
|
<pf-accordion>
|
|
902
|
-
<pf-accordion-header id="header-1" data-index="0"
|
|
917
|
+
<pf-accordion-header id="header-1" data-index="0">top-header-1</pf-accordion-header>
|
|
903
918
|
<pf-accordion-panel id="panel-1" data-index="0">
|
|
919
|
+
top-panel-1
|
|
904
920
|
<pf-accordion>
|
|
905
|
-
<pf-accordion-header id="header-1-1" data-index="0-1"
|
|
906
|
-
<pf-accordion-panel id="panel-1-1" data-index="0-1"
|
|
921
|
+
<pf-accordion-header id="header-1-1" data-index="0-1">nest-1-header-1</pf-accordion-header>
|
|
922
|
+
<pf-accordion-panel id="panel-1-1" data-index="0-1">nest-1-panel-1</pf-accordion-panel>
|
|
907
923
|
</pf-accordion>
|
|
908
924
|
</pf-accordion-panel>
|
|
909
|
-
<pf-accordion-header id="header-2" data-index="2"
|
|
925
|
+
<pf-accordion-header id="header-2" data-index="2">top-header-2</pf-accordion-header>
|
|
910
926
|
<pf-accordion-panel id="panel-2" data-panel="2">
|
|
927
|
+
top-panel-2
|
|
911
928
|
<pf-accordion single>
|
|
912
|
-
<pf-accordion-header id="header-2-1" data-index="1-0"
|
|
913
|
-
<pf-accordion-panel id="panel-2-1" data-index="1-0"
|
|
914
|
-
<pf-accordion-header id="header-2-2" data-index="1-1"
|
|
915
|
-
<pf-accordion-panel id="panel-2-2" data-index="1-1"
|
|
916
|
-
<pf-accordion-header id="header-2-3" data-index="1-2"
|
|
917
|
-
<pf-accordion-panel id="panel-2-3" data-index="1-2"
|
|
929
|
+
<pf-accordion-header id="header-2-1" data-index="1-0">nest-2-header-1</pf-accordion-header>
|
|
930
|
+
<pf-accordion-panel id="panel-2-1" data-index="1-0">nest-2-header-1</pf-accordion-panel>
|
|
931
|
+
<pf-accordion-header id="header-2-2" data-index="1-1">nest-2-header-2</pf-accordion-header>
|
|
932
|
+
<pf-accordion-panel id="panel-2-2" data-index="1-1">nest-2-panel-2</pf-accordion-panel>
|
|
933
|
+
<pf-accordion-header id="header-2-3" data-index="1-2">nest-2-header-3</pf-accordion-header>
|
|
934
|
+
<pf-accordion-panel id="panel-2-3" data-index="1-2">nest-2-panel-3</pf-accordion-panel>
|
|
918
935
|
</pf-accordion>
|
|
919
936
|
</pf-accordion-panel>
|
|
920
|
-
|
|
921
|
-
<pf-accordion-
|
|
922
|
-
<pf-accordion-panel id="panel-3" data-index="2"></pf-accordion-panel>
|
|
937
|
+
<pf-accordion-header id="header-3" data-index="2">top-header-3</pf-accordion-header>
|
|
938
|
+
<pf-accordion-panel id="panel-3" data-index="2">top-panel-3</pf-accordion-panel>
|
|
923
939
|
</pf-accordion>
|
|
924
940
|
`);
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
nestedPanelThree = document.getElementById('panel-2-3');
|
|
936
|
-
await allUpdates(element);
|
|
941
|
+
topLevelHeader1 = document.getElementById('header-1');
|
|
942
|
+
topLevelHeader2 = document.getElementById('header-2');
|
|
943
|
+
topLevelPanel1 = document.getElementById('panel-1');
|
|
944
|
+
topLevelPanel2 = document.getElementById('panel-2');
|
|
945
|
+
nestedHeader1 = document.getElementById('header-2-1');
|
|
946
|
+
nestedHeader2 = document.getElementById('header-2-2');
|
|
947
|
+
nestedHeader3 = document.getElementById('header-2-3');
|
|
948
|
+
nestedPanel1 = document.getElementById('panel-2-1');
|
|
949
|
+
nestedPanel2 = document.getElementById('panel-2-2');
|
|
950
|
+
nestedPanel3 = document.getElementById('panel-2-3');
|
|
937
951
|
});
|
|
952
|
+
beforeEach(() => allUpdates(element));
|
|
938
953
|
describe('clicking the first top-level heading', function () {
|
|
939
954
|
beforeEach(async function () {
|
|
940
|
-
|
|
941
|
-
await allUpdates(element);
|
|
955
|
+
await clickElementAtCenter(topLevelHeader1);
|
|
942
956
|
});
|
|
957
|
+
beforeEach(() => allUpdates(element));
|
|
943
958
|
describe('then clicking the second top-level heading', function () {
|
|
944
959
|
beforeEach(async function () {
|
|
945
|
-
|
|
946
|
-
await allUpdates(element);
|
|
960
|
+
await clickElementAtCenter(topLevelHeader2);
|
|
947
961
|
});
|
|
962
|
+
beforeEach(() => allUpdates(element));
|
|
948
963
|
describe('then clicking the first nested heading', function () {
|
|
949
964
|
beforeEach(async function () {
|
|
950
|
-
|
|
951
|
-
await allUpdates(element);
|
|
965
|
+
await clickElementAtCenter(nestedHeader1);
|
|
952
966
|
});
|
|
967
|
+
beforeEach(() => allUpdates(element));
|
|
953
968
|
describe('then clicking the second nested heading', function () {
|
|
954
969
|
beforeEach(async function () {
|
|
955
|
-
|
|
956
|
-
await allUpdates(element);
|
|
970
|
+
await clickElementAtCenter(nestedHeader2);
|
|
957
971
|
});
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
expect(
|
|
972
|
+
beforeEach(() => allUpdates(element));
|
|
973
|
+
it('expands the first top-level pair', async function () {
|
|
974
|
+
const snapshot = await a11ySnapshot();
|
|
975
|
+
const expanded = snapshot?.children?.find(x => x.expanded);
|
|
976
|
+
expect(expanded?.name).to.equal(topLevelHeader1.textContent?.trim());
|
|
977
|
+
expect(topLevelHeader1.expanded).to.be.true;
|
|
978
|
+
expect(topLevelPanel1.hasAttribute('expanded')).to.be.true;
|
|
979
|
+
expect(topLevelPanel1.expanded).to.be.true;
|
|
963
980
|
});
|
|
964
|
-
it('collapses the second top-level pair', function () {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
expect(
|
|
968
|
-
expect(topLevelPanelTwo.expanded, 'top level panel 2 expanded DOM property').to.be.true;
|
|
981
|
+
it('collapses the second top-level pair', async function () {
|
|
982
|
+
const snapshot = await a11ySnapshot();
|
|
983
|
+
const header2 = querySnapshot(snapshot, { name: 'top-header-2' });
|
|
984
|
+
expect(header2).to.have.property('expanded', true);
|
|
969
985
|
});
|
|
970
|
-
it('collapses the first nested pair', function () {
|
|
971
|
-
|
|
972
|
-
expect(
|
|
973
|
-
expect(nestedPanelOne.hasAttribute('expanded'), 'nested panel 1 expanded attr').to.be.false;
|
|
974
|
-
expect(nestedPanelOne.expanded, 'nested panel 1 expanded DOM property').to.be.false;
|
|
986
|
+
it('collapses the first nested pair', async function () {
|
|
987
|
+
const snapshot = await a11ySnapshot();
|
|
988
|
+
expect(querySnapshot(snapshot, { name: 'nest-1-header-1' })).to.not.have.property('expanded');
|
|
975
989
|
});
|
|
976
|
-
it('collapses the second nested pair', function () {
|
|
977
|
-
|
|
978
|
-
expect(
|
|
979
|
-
expect(nestedPanelTwo.hasAttribute('expanded'), 'nested panel 2 expanded attr').to.be.true;
|
|
980
|
-
expect(nestedPanelTwo.expanded, 'nested panel 2 expanded DOM property').to.be.true;
|
|
990
|
+
it('collapses the second nested pair', async function () {
|
|
991
|
+
const snapshot = await a11ySnapshot();
|
|
992
|
+
expect(querySnapshot(snapshot, { name: 'nest-2-header-1' })).to.not.have.property('expanded');
|
|
981
993
|
});
|
|
982
994
|
});
|
|
983
995
|
});
|
|
984
996
|
});
|
|
985
997
|
});
|
|
986
|
-
describe('
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
expect(nestedPanelThree.hidden, 'panel-2-3').to.be.true;
|
|
994
|
-
});
|
|
998
|
+
describe('with all panels closed', function () {
|
|
999
|
+
it('applies hidden attribute to all panels', function () {
|
|
1000
|
+
expect(topLevelPanel1.hidden, 'panel-1').to.be.true;
|
|
1001
|
+
expect(topLevelPanel2.hidden, 'panel-2').to.be.true;
|
|
1002
|
+
expect(nestedPanel1.hidden, 'panel-1-1').to.be.true;
|
|
1003
|
+
expect(nestedPanel2.hidden, 'panel-2-2').to.be.true;
|
|
1004
|
+
expect(nestedPanel3.hidden, 'panel-2-3').to.be.true;
|
|
995
1005
|
});
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1006
|
+
});
|
|
1007
|
+
describe('calling expandAll() on all accordions', function () {
|
|
1008
|
+
beforeEach(() => Promise.all(Array.from(document.querySelectorAll('pf-accordion'), a => a.expandAll())));
|
|
1009
|
+
beforeEach(nextFrame);
|
|
1010
|
+
it('removes hidden attribute from all panels', function () {
|
|
1011
|
+
expect(topLevelPanel1.hidden, 'panel-1').to.be.false;
|
|
1012
|
+
expect(topLevelPanel2.hidden, 'panel-2').to.be.false;
|
|
1013
|
+
expect(nestedPanel1.hidden, 'panel-1-1').to.be.false;
|
|
1014
|
+
expect(nestedPanel2.hidden, 'panel-2-2').to.be.false;
|
|
1015
|
+
expect(nestedPanel3.hidden, 'panel-2-3').to.be.false;
|
|
1016
|
+
});
|
|
1017
|
+
});
|
|
1018
|
+
describe('calling focus() on the first header of the parent accordion', function () {
|
|
1019
|
+
beforeEach(function () {
|
|
1020
|
+
topLevelHeader1.focus();
|
|
1021
|
+
});
|
|
1022
|
+
beforeEach(nextFrame);
|
|
1023
|
+
describe('Space', function () {
|
|
1024
|
+
beforeEach(press(' '));
|
|
1025
|
+
it('expands the first panel', function () {
|
|
1026
|
+
expect(topLevelPanel1.expanded).to.be.true;
|
|
1027
|
+
expect(topLevelPanel2.expanded).to.be.false;
|
|
1028
|
+
expect(nestedPanel1.expanded).to.be.false;
|
|
1029
|
+
expect(nestedPanel2.expanded).to.be.false;
|
|
1002
1030
|
});
|
|
1003
|
-
it('removes hidden attribute from
|
|
1004
|
-
expect(
|
|
1005
|
-
expect(
|
|
1006
|
-
expect(
|
|
1007
|
-
expect(
|
|
1008
|
-
expect(nestedPanelThree.hidden, 'panel-2-3').to.be.false;
|
|
1031
|
+
it('removes hidden attribute from the first panel', function () {
|
|
1032
|
+
expect(topLevelPanel1.hidden, 'panel-1').to.be.false;
|
|
1033
|
+
expect(topLevelPanel2.hidden, 'panel-2').to.be.true;
|
|
1034
|
+
expect(nestedPanel1.hidden, 'panel-1-1').to.be.true;
|
|
1035
|
+
expect(nestedPanel2.hidden, 'panel-2-2').to.be.true;
|
|
1009
1036
|
});
|
|
1010
1037
|
});
|
|
1011
|
-
describe('
|
|
1012
|
-
beforeEach(
|
|
1013
|
-
|
|
1014
|
-
await
|
|
1038
|
+
describe('Tab', function () {
|
|
1039
|
+
beforeEach(press('Tab'));
|
|
1040
|
+
it('moves focus to the body', async function () {
|
|
1041
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
1015
1042
|
});
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
expect(nestedPanelTwo.hidden, 'panel-2-2').to.be.true;
|
|
1029
|
-
});
|
|
1043
|
+
});
|
|
1044
|
+
});
|
|
1045
|
+
describe('calling focus() on the second header of the parent accordion', function () {
|
|
1046
|
+
beforeEach(function () {
|
|
1047
|
+
topLevelHeader2.focus();
|
|
1048
|
+
});
|
|
1049
|
+
beforeEach(nextFrame);
|
|
1050
|
+
describe('Space', function () {
|
|
1051
|
+
beforeEach(press(' '));
|
|
1052
|
+
beforeEach(nextFrame);
|
|
1053
|
+
it('expands the panel containing the nested <pf-accordion>', async function () {
|
|
1054
|
+
expect(await a11ySnapshot()).to.have.axContainName('nest-2-header-1');
|
|
1030
1055
|
});
|
|
1031
1056
|
describe('Tab', function () {
|
|
1032
1057
|
beforeEach(press('Tab'));
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
});
|
|
1037
|
-
});
|
|
1038
|
-
describe('when focus is on the last header of the parent accordion', function () {
|
|
1039
|
-
beforeEach(async function () {
|
|
1040
|
-
topLevelHeaderTwo.focus();
|
|
1041
|
-
await nextFrame();
|
|
1042
|
-
});
|
|
1043
|
-
describe('Space', function () {
|
|
1044
|
-
beforeEach(press(' '));
|
|
1045
|
-
it('expands the first panel', function () {
|
|
1046
|
-
expect(topLevelPanelOne.expanded).to.be.false;
|
|
1047
|
-
expect(topLevelPanelTwo.expanded).to.be.true;
|
|
1048
|
-
expect(nestedPanelOne.expanded).to.be.false;
|
|
1049
|
-
expect(nestedPanelTwo.expanded).to.be.false;
|
|
1050
|
-
});
|
|
1051
|
-
it('removes hidden attribute from the first panel', function () {
|
|
1052
|
-
expect(topLevelPanelOne.hidden, 'panel-2').to.be.true;
|
|
1053
|
-
expect(topLevelPanelTwo.hidden, 'panel-1').to.be.false;
|
|
1054
|
-
expect(nestedPanelOne.hidden, 'panel-1-1').to.be.true;
|
|
1055
|
-
expect(nestedPanelTwo.hidden, 'panel-2-2').to.be.true;
|
|
1058
|
+
beforeEach(nextFrame);
|
|
1059
|
+
it('moves focus to the first nested header', async function () {
|
|
1060
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(nestedHeader1);
|
|
1056
1061
|
});
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
it('moves focus to the nested accordion header', function () {
|
|
1063
|
-
expect(document.activeElement).to.equal(nestedHeaderOne);
|
|
1064
|
-
});
|
|
1065
|
-
describe('ArrowUp', function () {
|
|
1066
|
-
beforeEach(press('ArrowUp'));
|
|
1067
|
-
it('moves focus to the last header', function () {
|
|
1068
|
-
expect(document.activeElement).to.equal(nestedHeaderThree);
|
|
1069
|
-
});
|
|
1062
|
+
describe('ArrowUp', function () {
|
|
1063
|
+
beforeEach(press('ArrowUp'));
|
|
1064
|
+
beforeEach(nextFrame);
|
|
1065
|
+
it('moves focus to the last nested header', async function () {
|
|
1066
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(nestedHeader3);
|
|
1070
1067
|
});
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1068
|
+
});
|
|
1069
|
+
describe('ArrowLeft', function () {
|
|
1070
|
+
beforeEach(press('ArrowLeft'));
|
|
1071
|
+
beforeEach(nextFrame);
|
|
1072
|
+
it('moves focus to the last nested header', async function () {
|
|
1073
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(nestedHeader3);
|
|
1076
1074
|
});
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1075
|
+
});
|
|
1076
|
+
describe('ArrowDown', function () {
|
|
1077
|
+
beforeEach(press('ArrowDown'));
|
|
1078
|
+
beforeEach(nextFrame);
|
|
1079
|
+
it('moves focus to the second nested header', async function () {
|
|
1080
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(nestedHeader2);
|
|
1082
1081
|
});
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1082
|
+
});
|
|
1083
|
+
describe('ArrowRight', function () {
|
|
1084
|
+
beforeEach(press('ArrowRight'));
|
|
1085
|
+
beforeEach(nextFrame);
|
|
1086
|
+
it('moves focus to the second nested header', async function () {
|
|
1087
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(nestedHeader2);
|
|
1088
1088
|
});
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1089
|
+
});
|
|
1090
|
+
describe('Tab', function () {
|
|
1091
|
+
beforeEach(press('Tab'));
|
|
1092
|
+
beforeEach(nextFrame);
|
|
1093
|
+
it('should move focus back to the body', async function () {
|
|
1094
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(document.body);
|
|
1094
1095
|
});
|
|
1095
1096
|
});
|
|
1096
1097
|
});
|
|
1097
1098
|
});
|
|
1098
1099
|
});
|
|
1100
|
+
describe('calling focus() on the last header of the parent accordion', function () {
|
|
1101
|
+
beforeEach(function () {
|
|
1102
|
+
topLevelHeader2.focus();
|
|
1103
|
+
});
|
|
1104
|
+
beforeEach(nextFrame);
|
|
1105
|
+
describe('Space', function () {
|
|
1106
|
+
beforeEach(press(' '));
|
|
1107
|
+
it('expands the first panel', function () {
|
|
1108
|
+
expect(topLevelPanel1.expanded).to.be.false;
|
|
1109
|
+
expect(topLevelPanel2.expanded).to.be.true;
|
|
1110
|
+
expect(nestedPanel1.expanded).to.be.false;
|
|
1111
|
+
expect(nestedPanel2.expanded).to.be.false;
|
|
1112
|
+
});
|
|
1113
|
+
it('removes hidden attribute from the first panel', function () {
|
|
1114
|
+
expect(topLevelPanel1.hidden, 'panel-2').to.be.true;
|
|
1115
|
+
expect(topLevelPanel2.hidden, 'panel-1').to.be.false;
|
|
1116
|
+
expect(nestedPanel1.hidden, 'panel-1-1').to.be.true;
|
|
1117
|
+
expect(nestedPanel2.hidden, 'panel-2-2').to.be.true;
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
});
|
|
1099
1121
|
});
|
|
1100
|
-
describe('with multiple pf-accordion', function () {
|
|
1122
|
+
describe('with multiple <pf-accordion> elements', function () {
|
|
1101
1123
|
let multipleAccordionElements;
|
|
1102
|
-
let
|
|
1103
|
-
let
|
|
1104
|
-
let
|
|
1105
|
-
let
|
|
1124
|
+
let accordion1Header1;
|
|
1125
|
+
let accordion1Panel1;
|
|
1126
|
+
let accordion2Header1;
|
|
1127
|
+
let accordion2Panel1;
|
|
1106
1128
|
beforeEach(async function () {
|
|
1107
|
-
multipleAccordionElements = await
|
|
1129
|
+
multipleAccordionElements = await fixture(html `
|
|
1108
1130
|
<div>
|
|
1109
1131
|
<pf-accordion>
|
|
1110
1132
|
<pf-accordion-header id="header-1-1" data-index="0"></pf-accordion-header>
|
|
@@ -1116,56 +1138,52 @@ describe('<pf-accordion>', function () {
|
|
|
1116
1138
|
</pf-accordion>
|
|
1117
1139
|
</div>
|
|
1118
1140
|
`);
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1141
|
+
accordion1Header1 = document.getElementById('header-1-1');
|
|
1142
|
+
accordion1Panel1 = document.getElementById('panel-1-1');
|
|
1143
|
+
accordion2Header1 = document.getElementById('header-2-1');
|
|
1144
|
+
accordion2Panel1 = document.getElementById('panel-2-1');
|
|
1123
1145
|
});
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1146
|
+
it('applies hidden attribute to all panels', function () {
|
|
1147
|
+
expect(accordion1Panel1.hidden, 'panel-1-1').to.be.true;
|
|
1148
|
+
expect(accordion2Panel1.hidden, 'panel-2-1').to.be.true;
|
|
1149
|
+
});
|
|
1150
|
+
describe('clicking every header', function () {
|
|
1151
|
+
beforeEach(async function () {
|
|
1152
|
+
for (const header of multipleAccordionElements.querySelectorAll('pf-accordion-header')) {
|
|
1153
|
+
await clickElementAtCenter(header);
|
|
1154
|
+
}
|
|
1130
1155
|
});
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1156
|
+
beforeEach(nextFrame);
|
|
1157
|
+
it('removes hidden attribute from all panels', function () {
|
|
1158
|
+
expect(accordion1Panel1.hidden, 'panel-1-1').to.be.false;
|
|
1159
|
+
expect(accordion2Panel1.hidden, 'panel-2-1').to.be.false;
|
|
1160
|
+
});
|
|
1161
|
+
});
|
|
1162
|
+
describe('calling focus() on the first header of the first accordion', function () {
|
|
1163
|
+
beforeEach(function () {
|
|
1164
|
+
accordion1Header1.focus();
|
|
1165
|
+
});
|
|
1166
|
+
beforeEach(nextFrame);
|
|
1167
|
+
describe('Space', function () {
|
|
1168
|
+
beforeEach(press(' '));
|
|
1169
|
+
it('expands the first panel', function () {
|
|
1170
|
+
expect(accordion1Panel1.expanded).to.be.true;
|
|
1171
|
+
expect(accordion2Panel1.expanded).to.be.false;
|
|
1137
1172
|
});
|
|
1138
|
-
it('removes hidden attribute from
|
|
1139
|
-
expect(
|
|
1140
|
-
expect(
|
|
1173
|
+
it('removes hidden attribute from the first panel', function () {
|
|
1174
|
+
expect(accordion1Panel1.hidden, 'panel-1-1').to.be.false;
|
|
1175
|
+
expect(accordion2Panel1.hidden, 'panel-1-1').to.be.true;
|
|
1141
1176
|
});
|
|
1142
1177
|
});
|
|
1143
|
-
describe('
|
|
1144
|
-
beforeEach(
|
|
1145
|
-
|
|
1146
|
-
await
|
|
1178
|
+
describe('Tab', function () {
|
|
1179
|
+
beforeEach(press('Tab'));
|
|
1180
|
+
it('moves focus to the second accordion', async function () {
|
|
1181
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(accordion2Header1);
|
|
1147
1182
|
});
|
|
1148
|
-
describe('
|
|
1149
|
-
beforeEach(press('
|
|
1150
|
-
it('
|
|
1151
|
-
expect(
|
|
1152
|
-
expect(accordionTwoPanelOne.expanded).to.be.false;
|
|
1153
|
-
});
|
|
1154
|
-
it('removes hidden attribute from the first panel', function () {
|
|
1155
|
-
expect(accordionOnePanelOne.hidden, 'panel-1-1').to.be.false;
|
|
1156
|
-
expect(accordionTwoPanelOne.hidden, 'panel-1-1').to.be.true;
|
|
1157
|
-
});
|
|
1158
|
-
});
|
|
1159
|
-
describe('Tab', function () {
|
|
1160
|
-
beforeEach(press('Tab'));
|
|
1161
|
-
it('moves focus to the second accordion', function () {
|
|
1162
|
-
expect(document.activeElement).to.equal(accordionTwoHeaderOne);
|
|
1163
|
-
});
|
|
1164
|
-
describe('Shift+Tab', function () {
|
|
1165
|
-
beforeEach(press('Shift+Tab'));
|
|
1166
|
-
it('moves focus back to the first accordion', function () {
|
|
1167
|
-
expect(document.activeElement).to.equal(accordionOneHeaderOne);
|
|
1168
|
-
});
|
|
1183
|
+
describe('Shift+Tab', function () {
|
|
1184
|
+
beforeEach(press('Shift+Tab'));
|
|
1185
|
+
it('moves focus to the first accordion, first header', async function () {
|
|
1186
|
+
expect(await a11ySnapshot()).to.have.axTreeFocusOn(accordion1Header1);
|
|
1169
1187
|
});
|
|
1170
1188
|
});
|
|
1171
1189
|
});
|
|
@@ -1173,13 +1191,12 @@ describe('<pf-accordion>', function () {
|
|
|
1173
1191
|
});
|
|
1174
1192
|
describe('with a single expanded header and panel containing a checkbox and a switch', function () {
|
|
1175
1193
|
let element;
|
|
1176
|
-
let headers;
|
|
1177
1194
|
let panels;
|
|
1178
1195
|
let checkbox;
|
|
1179
1196
|
let pfswitch;
|
|
1180
1197
|
let accordionPanelOne;
|
|
1181
1198
|
beforeEach(async function () {
|
|
1182
|
-
element = await
|
|
1199
|
+
element = await fixture(html `
|
|
1183
1200
|
<pf-accordion>
|
|
1184
1201
|
<pf-accordion-header expanded id="header-1-1" data-index="0"></pf-accordion-header>
|
|
1185
1202
|
<pf-accordion-panel id="panel-1-1" data-index="0">
|
|
@@ -1188,7 +1205,6 @@ describe('<pf-accordion>', function () {
|
|
|
1188
1205
|
</pf-accordion-panel>
|
|
1189
1206
|
</pf-accordion>
|
|
1190
1207
|
`);
|
|
1191
|
-
headers = document.querySelectorAll('pf-accordion-header');
|
|
1192
1208
|
panels = document.querySelectorAll('pf-accordion-panel');
|
|
1193
1209
|
checkbox = element.querySelector('input');
|
|
1194
1210
|
pfswitch = element.querySelector('pf-switch');
|
|
@@ -1198,7 +1214,7 @@ describe('<pf-accordion>', function () {
|
|
|
1198
1214
|
});
|
|
1199
1215
|
describe('clicking the checkbox', function () {
|
|
1200
1216
|
beforeEach(async function () {
|
|
1201
|
-
checkbox
|
|
1217
|
+
await clickElementAtCenter(checkbox);
|
|
1202
1218
|
await element.updateComplete;
|
|
1203
1219
|
});
|
|
1204
1220
|
it('does not collapse the panel', function () {
|
|
@@ -1208,7 +1224,7 @@ describe('<pf-accordion>', function () {
|
|
|
1208
1224
|
describe('clicking the switch', function () {
|
|
1209
1225
|
beforeEach(async function () {
|
|
1210
1226
|
const { checked } = pfswitch;
|
|
1211
|
-
pfswitch
|
|
1227
|
+
await clickElementAtCenter(pfswitch);
|
|
1212
1228
|
await element.updateComplete;
|
|
1213
1229
|
await pfswitch.updateComplete;
|
|
1214
1230
|
expect(pfswitch.checked).to.not.equal(checked);
|