@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.
Files changed (371) hide show
  1. package/custom-elements.json +8857 -8783
  2. package/form-control.css +127 -0
  3. package/package.json +12 -25
  4. package/pf-accordion/pf-accordion-header.css +23 -0
  5. package/pf-accordion/pf-accordion-header.d.ts +52 -43
  6. package/pf-accordion/pf-accordion-header.js +130 -87
  7. package/pf-accordion/pf-accordion-header.js.map +1 -1
  8. package/pf-accordion/pf-accordion-panel.css +15 -0
  9. package/pf-accordion/pf-accordion-panel.d.ts +27 -25
  10. package/pf-accordion/pf-accordion-panel.js +29 -43
  11. package/pf-accordion/pf-accordion-panel.js.map +1 -1
  12. package/pf-accordion/pf-accordion.d.ts +122 -65
  13. package/pf-accordion/pf-accordion.js +283 -94
  14. package/pf-accordion/pf-accordion.js.map +1 -1
  15. package/pf-accordion/test/pf-accordion.e2e.js +12 -0
  16. package/pf-accordion/test/pf-accordion.e2e.js.map +1 -1
  17. package/pf-accordion/test/pf-accordion.spec.js +366 -350
  18. package/pf-accordion/test/pf-accordion.spec.js.map +1 -1
  19. package/pf-avatar/pf-avatar.css +50 -24
  20. package/pf-avatar/pf-avatar.d.ts +29 -3
  21. package/pf-avatar/pf-avatar.js +51 -9
  22. package/pf-avatar/pf-avatar.js.map +1 -1
  23. package/pf-avatar/test/pf-avatar.e2e.js +12 -0
  24. package/pf-avatar/test/pf-avatar.e2e.js.map +1 -1
  25. package/pf-avatar/test/pf-avatar.spec.js +2 -3
  26. package/pf-avatar/test/pf-avatar.spec.js.map +1 -1
  27. package/pf-back-to-top/pf-back-to-top.css +10 -0
  28. package/pf-back-to-top/pf-back-to-top.d.ts +14 -18
  29. package/pf-back-to-top/pf-back-to-top.js +9 -30
  30. package/pf-back-to-top/pf-back-to-top.js.map +1 -1
  31. package/pf-back-to-top/test/pf-back-to-top.e2e.js +12 -0
  32. package/pf-back-to-top/test/pf-back-to-top.e2e.js.map +1 -1
  33. package/pf-background-image/pf-background-image.d.ts +4 -4
  34. package/pf-background-image/pf-background-image.js +1 -12
  35. package/pf-background-image/pf-background-image.js.map +1 -1
  36. package/pf-background-image/test/pf-background-image.e2e.js +12 -0
  37. package/pf-background-image/test/pf-background-image.e2e.js.map +1 -1
  38. package/pf-badge/pf-badge.css +4 -0
  39. package/pf-badge/pf-badge.d.ts +26 -22
  40. package/pf-badge/pf-badge.js +14 -27
  41. package/pf-badge/pf-badge.js.map +1 -1
  42. package/pf-badge/test/pf-badge.e2e.js +12 -0
  43. package/pf-badge/test/pf-badge.e2e.js.map +1 -1
  44. package/pf-banner/pf-banner.d.ts +16 -16
  45. package/pf-banner/pf-banner.js +1 -24
  46. package/pf-banner/pf-banner.js.map +1 -1
  47. package/pf-banner/test/pf-banner.e2e.js +12 -0
  48. package/pf-banner/test/pf-banner.e2e.js.map +1 -1
  49. package/pf-button/pf-button.css +22 -12
  50. package/pf-button/pf-button.d.ts +128 -122
  51. package/pf-button/pf-button.js +95 -172
  52. package/pf-button/pf-button.js.map +1 -1
  53. package/pf-button/test/pf-button.e2e.js +12 -0
  54. package/pf-button/test/pf-button.e2e.js.map +1 -1
  55. package/pf-card/pf-card.css +172 -43
  56. package/pf-card/pf-card.d.ts +41 -38
  57. package/pf-card/pf-card.js +37 -54
  58. package/pf-card/pf-card.js.map +1 -1
  59. package/pf-card/test/pf-card.e2e.js +12 -0
  60. package/pf-card/test/pf-card.e2e.js.map +1 -1
  61. package/pf-chip/pf-chip-group.css +9 -6
  62. package/pf-chip/pf-chip-group.d.ts +27 -14
  63. package/pf-chip/pf-chip-group.js +65 -94
  64. package/pf-chip/pf-chip-group.js.map +1 -1
  65. package/pf-chip/pf-chip.d.ts +20 -9
  66. package/pf-chip/pf-chip.js +1 -8
  67. package/pf-chip/pf-chip.js.map +1 -1
  68. package/pf-chip/test/pf-chip-group.spec.js +42 -22
  69. package/pf-chip/test/pf-chip-group.spec.js.map +1 -1
  70. package/pf-chip/test/pf-chip.e2e.js +12 -0
  71. package/pf-chip/test/pf-chip.e2e.js.map +1 -1
  72. package/pf-clipboard-copy/pf-clipboard-copy.css +83 -85
  73. package/pf-clipboard-copy/pf-clipboard-copy.d.ts +53 -18
  74. package/pf-clipboard-copy/pf-clipboard-copy.js +55 -44
  75. package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
  76. package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js +12 -0
  77. package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js.map +1 -1
  78. package/pf-code-block/pf-code-block.css +7 -4
  79. package/pf-code-block/pf-code-block.d.ts +4 -25
  80. package/pf-code-block/pf-code-block.js +44 -23
  81. package/pf-code-block/pf-code-block.js.map +1 -1
  82. package/pf-code-block/test/pf-code-block.e2e.js +12 -0
  83. package/pf-code-block/test/pf-code-block.e2e.js.map +1 -1
  84. package/pf-dropdown/context.d.ts +2 -3
  85. package/pf-dropdown/context.js.map +1 -1
  86. package/pf-dropdown/pf-dropdown-group.d.ts +3 -9
  87. package/pf-dropdown/pf-dropdown-group.js +1 -5
  88. package/pf-dropdown/pf-dropdown-group.js.map +1 -1
  89. package/pf-dropdown/pf-dropdown-item.d.ts +21 -27
  90. package/pf-dropdown/pf-dropdown-item.js +1 -37
  91. package/pf-dropdown/pf-dropdown-item.js.map +1 -1
  92. package/pf-dropdown/pf-dropdown-menu.d.ts +4 -10
  93. package/pf-dropdown/pf-dropdown-menu.js +23 -23
  94. package/pf-dropdown/pf-dropdown-menu.js.map +1 -1
  95. package/pf-dropdown/pf-dropdown.d.ts +8 -24
  96. package/pf-dropdown/pf-dropdown.js +1 -26
  97. package/pf-dropdown/pf-dropdown.js.map +1 -1
  98. package/pf-dropdown/test/pf-dropdown.e2e.js +12 -0
  99. package/pf-dropdown/test/pf-dropdown.e2e.js.map +1 -1
  100. package/pf-icon/pf-icon.css +22 -0
  101. package/pf-icon/pf-icon.d.ts +93 -4
  102. package/pf-icon/pf-icon.js +191 -13
  103. package/pf-icon/pf-icon.js.map +1 -1
  104. package/pf-icon/test/pf-icon.e2e.js +12 -0
  105. package/pf-icon/test/pf-icon.e2e.js.map +1 -1
  106. package/pf-icon/test/pf-icon.spec.js +102 -88
  107. package/pf-icon/test/pf-icon.spec.js.map +1 -1
  108. package/pf-jump-links/pf-jump-links-item.d.ts +4 -11
  109. package/pf-jump-links/pf-jump-links-item.js +8 -15
  110. package/pf-jump-links/pf-jump-links-item.js.map +1 -1
  111. package/pf-jump-links/pf-jump-links-list.d.ts +2 -2
  112. package/pf-jump-links/pf-jump-links-list.js +1 -5
  113. package/pf-jump-links/pf-jump-links-list.js.map +1 -1
  114. package/pf-jump-links/pf-jump-links.d.ts +2 -2
  115. package/pf-jump-links/pf-jump-links.js +23 -62
  116. package/pf-jump-links/pf-jump-links.js.map +1 -1
  117. package/pf-jump-links/test/pf-jump-links.e2e.js +12 -0
  118. package/pf-jump-links/test/pf-jump-links.e2e.js.map +1 -1
  119. package/pf-label/pf-label.css +38 -5
  120. package/pf-label/pf-label.d.ts +65 -69
  121. package/pf-label/pf-label.js +49 -90
  122. package/pf-label/pf-label.js.map +1 -1
  123. package/pf-label/test/pf-label.e2e.js +12 -0
  124. package/pf-label/test/pf-label.e2e.js.map +1 -1
  125. package/pf-label/test/pf-label.spec.js +26 -16
  126. package/pf-label/test/pf-label.spec.js.map +1 -1
  127. package/pf-modal/pf-modal.d.ts +17 -22
  128. package/pf-modal/pf-modal.js +13 -39
  129. package/pf-modal/pf-modal.js.map +1 -1
  130. package/pf-modal/test/pf-modal.e2e.js +12 -0
  131. package/pf-modal/test/pf-modal.e2e.js.map +1 -1
  132. package/pf-panel/pf-panel.d.ts +31 -3
  133. package/pf-panel/pf-panel.js +1 -10
  134. package/pf-panel/pf-panel.js.map +1 -1
  135. package/pf-panel/test/pf-panel.e2e.js +12 -0
  136. package/pf-panel/test/pf-panel.e2e.js.map +1 -1
  137. package/pf-popover/pf-popover.d.ts +66 -84
  138. package/pf-popover/pf-popover.js +33 -150
  139. package/pf-popover/pf-popover.js.map +1 -1
  140. package/pf-popover/test/pf-popover.e2e.js +12 -0
  141. package/pf-popover/test/pf-popover.e2e.js.map +1 -1
  142. package/pf-popover/test/pf-popover.spec.js +0 -11
  143. package/pf-popover/test/pf-popover.spec.js.map +1 -1
  144. package/pf-progress/pf-progress.d.ts +40 -40
  145. package/pf-progress/pf-progress.js +1 -61
  146. package/pf-progress/pf-progress.js.map +1 -1
  147. package/pf-progress/test/pf-progress.e2e.js +12 -0
  148. package/pf-progress/test/pf-progress.e2e.js.map +1 -1
  149. package/pf-progress-stepper/pf-progress-step.d.ts +2 -3
  150. package/pf-progress-stepper/pf-progress-step.js +4 -14
  151. package/pf-progress-stepper/pf-progress-step.js.map +1 -1
  152. package/pf-progress-stepper/pf-progress-stepper.d.ts +118 -2
  153. package/pf-progress-stepper/pf-progress-stepper.js +10 -12
  154. package/pf-progress-stepper/pf-progress-stepper.js.map +1 -1
  155. package/pf-progress-stepper/test/pf-progress-stepper.e2e.js +12 -0
  156. package/pf-progress-stepper/test/pf-progress-stepper.e2e.js.map +1 -1
  157. package/pf-select/pf-option-group.d.ts +2 -2
  158. package/pf-select/pf-option-group.js +1 -5
  159. package/pf-select/pf-option-group.js.map +1 -1
  160. package/pf-select/pf-option.css +1 -1
  161. package/pf-select/pf-option.d.ts +4 -4
  162. package/pf-select/pf-option.js +20 -30
  163. package/pf-select/pf-option.js.map +1 -1
  164. package/pf-select/pf-select.css +14 -6
  165. package/pf-select/pf-select.d.ts +183 -40
  166. package/pf-select/pf-select.js +185 -260
  167. package/pf-select/pf-select.js.map +1 -1
  168. package/pf-select/test/pf-select.e2e.js +12 -0
  169. package/pf-select/test/pf-select.e2e.js.map +1 -1
  170. package/pf-select/test/pf-select.spec.js +1292 -613
  171. package/pf-select/test/pf-select.spec.js.map +1 -1
  172. package/pf-spinner/pf-spinner.css +27 -17
  173. package/pf-spinner/pf-spinner.d.ts +21 -17
  174. package/pf-spinner/pf-spinner.js +20 -24
  175. package/pf-spinner/pf-spinner.js.map +1 -1
  176. package/pf-spinner/test/pf-spinner.e2e.js +12 -0
  177. package/pf-spinner/test/pf-spinner.e2e.js.map +1 -1
  178. package/pf-switch/pf-switch.css +39 -13
  179. package/pf-switch/pf-switch.d.ts +48 -34
  180. package/pf-switch/pf-switch.js +114 -43
  181. package/pf-switch/pf-switch.js.map +1 -1
  182. package/pf-switch/test/pf-switch.e2e.js +12 -0
  183. package/pf-switch/test/pf-switch.e2e.js.map +1 -1
  184. package/pf-table/pf-caption.d.ts +2 -2
  185. package/pf-table/pf-caption.js +1 -4
  186. package/pf-table/pf-caption.js.map +1 -1
  187. package/pf-table/pf-table.d.ts +424 -424
  188. package/pf-table/pf-table.js +7 -645
  189. package/pf-table/pf-table.js.map +1 -1
  190. package/pf-table/pf-tbody.d.ts +2 -2
  191. package/pf-table/pf-tbody.js +1 -4
  192. package/pf-table/pf-tbody.js.map +1 -1
  193. package/pf-table/pf-td.d.ts +2 -2
  194. package/pf-table/pf-td.js +1 -4
  195. package/pf-table/pf-td.js.map +1 -1
  196. package/pf-table/pf-th.d.ts +2 -2
  197. package/pf-table/pf-th.js +1 -4
  198. package/pf-table/pf-th.js.map +1 -1
  199. package/pf-table/pf-thead.d.ts +2 -2
  200. package/pf-table/pf-thead.js +1 -4
  201. package/pf-table/pf-thead.js.map +1 -1
  202. package/pf-table/pf-tr.d.ts +1 -1
  203. package/pf-table/pf-tr.js +1 -4
  204. package/pf-table/pf-tr.js.map +1 -1
  205. package/pf-table/test/pf-table.e2e.js +12 -0
  206. package/pf-table/test/pf-table.e2e.js.map +1 -1
  207. package/pf-tabs/context.d.ts +2 -3
  208. package/pf-tabs/context.js.map +1 -1
  209. package/pf-tabs/pf-tab-panel.d.ts +3 -5
  210. package/pf-tabs/pf-tab-panel.js +1 -7
  211. package/pf-tabs/pf-tab-panel.js.map +1 -1
  212. package/pf-tabs/pf-tab.d.ts +37 -37
  213. package/pf-tabs/pf-tab.js +16 -54
  214. package/pf-tabs/pf-tab.js.map +1 -1
  215. package/pf-tabs/pf-tabs.d.ts +36 -37
  216. package/pf-tabs/pf-tabs.js +40 -78
  217. package/pf-tabs/pf-tabs.js.map +1 -1
  218. package/pf-tabs/test/pf-tabs.e2e.js +12 -0
  219. package/pf-tabs/test/pf-tabs.e2e.js.map +1 -1
  220. package/pf-tabs/test/pf-tabs.spec.js +11 -12
  221. package/pf-tabs/test/pf-tabs.spec.js.map +1 -1
  222. package/pf-text-area/pf-text-area.d.ts +128 -134
  223. package/pf-text-area/pf-text-area.js +7 -131
  224. package/pf-text-area/pf-text-area.js.map +1 -1
  225. package/pf-text-area/test/pf-text-area.e2e.js +12 -0
  226. package/pf-text-area/test/pf-text-area.e2e.js.map +1 -1
  227. package/pf-text-input/pf-text-input.d.ts +129 -135
  228. package/pf-text-input/pf-text-input.js +7 -132
  229. package/pf-text-input/pf-text-input.js.map +1 -1
  230. package/pf-text-input/test/pf-text-input.e2e.js +12 -0
  231. package/pf-text-input/test/pf-text-input.e2e.js.map +1 -1
  232. package/pf-tile/pf-tile.d.ts +21 -20
  233. package/pf-tile/pf-tile.js +18 -35
  234. package/pf-tile/pf-tile.js.map +1 -1
  235. package/pf-tile/test/pf-tile.e2e.js +12 -0
  236. package/pf-tile/test/pf-tile.e2e.js.map +1 -1
  237. package/pf-timestamp/pf-timestamp.d.ts +2 -2
  238. package/pf-timestamp/pf-timestamp.js +1 -3
  239. package/pf-timestamp/pf-timestamp.js.map +1 -1
  240. package/pf-timestamp/test/pf-timestamp.e2e.js +12 -0
  241. package/pf-timestamp/test/pf-timestamp.e2e.js.map +1 -1
  242. package/pf-tooltip/pf-tooltip.d.ts +51 -50
  243. package/pf-tooltip/pf-tooltip.js +26 -106
  244. package/pf-tooltip/pf-tooltip.js.map +1 -1
  245. package/pf-tooltip/test/pf-tooltip.e2e.js +12 -0
  246. package/pf-tooltip/test/pf-tooltip.e2e.js.map +1 -1
  247. package/pfe.min.js +1194 -1002
  248. package/pfe.min.js.map +4 -4
  249. package/react/pf-accordion/pf-accordion-header.js +2 -2
  250. package/react/pf-accordion/pf-accordion-panel.js +2 -2
  251. package/react/pf-accordion/pf-accordion.js +2 -2
  252. package/react/pf-avatar/pf-avatar.d.ts +1 -1
  253. package/react/pf-avatar/pf-avatar.js +5 -3
  254. package/react/pf-back-to-top/pf-back-to-top.js +2 -2
  255. package/react/pf-background-image/pf-background-image.js +2 -2
  256. package/react/pf-badge/pf-badge.js +2 -2
  257. package/react/pf-banner/pf-banner.js +2 -2
  258. package/react/pf-button/pf-button.js +2 -2
  259. package/react/pf-card/pf-card.js +2 -2
  260. package/react/pf-chip/pf-chip-group.js +2 -2
  261. package/react/pf-chip/pf-chip.js +2 -2
  262. package/react/pf-clipboard-copy/pf-clipboard-copy.d.ts +1 -1
  263. package/react/pf-clipboard-copy/pf-clipboard-copy.js +5 -3
  264. package/react/pf-code-block/pf-code-block.js +2 -2
  265. package/react/pf-dropdown/pf-dropdown-group.js +2 -2
  266. package/react/pf-dropdown/pf-dropdown-item.js +2 -2
  267. package/react/pf-dropdown/pf-dropdown-menu.js +2 -2
  268. package/react/pf-dropdown/pf-dropdown.js +2 -2
  269. package/react/pf-icon/pf-icon.js +2 -2
  270. package/react/pf-jump-links/pf-jump-links-item.js +2 -2
  271. package/react/pf-jump-links/pf-jump-links-list.js +2 -2
  272. package/react/pf-jump-links/pf-jump-links.js +2 -2
  273. package/react/pf-label/pf-label.js +2 -2
  274. package/react/pf-modal/pf-modal.js +2 -2
  275. package/react/pf-panel/pf-panel.js +2 -2
  276. package/react/pf-popover/pf-popover.js +2 -2
  277. package/react/pf-progress/pf-progress.js +2 -2
  278. package/react/pf-progress-stepper/pf-progress-step.js +2 -2
  279. package/react/pf-progress-stepper/pf-progress-stepper.js +2 -2
  280. package/react/pf-select/pf-option-group.js +2 -2
  281. package/react/pf-select/pf-option.js +2 -2
  282. package/react/pf-select/pf-select.d.ts +1 -1
  283. package/react/pf-select/pf-select.js +2 -3
  284. package/react/pf-spinner/pf-spinner.js +2 -2
  285. package/react/pf-switch/pf-switch.js +2 -2
  286. package/react/pf-table/pf-caption.js +2 -2
  287. package/react/pf-table/pf-table.js +2 -2
  288. package/react/pf-table/pf-tbody.js +2 -2
  289. package/react/pf-table/pf-td.js +2 -2
  290. package/react/pf-table/pf-th.js +2 -2
  291. package/react/pf-table/pf-thead.js +2 -2
  292. package/react/pf-table/pf-tr.js +2 -2
  293. package/react/pf-tabs/pf-tab-panel.js +2 -2
  294. package/react/pf-tabs/pf-tab.js +2 -2
  295. package/react/pf-tabs/pf-tabs.js +2 -2
  296. package/react/pf-text-area/pf-text-area.js +2 -2
  297. package/react/pf-text-input/pf-text-input.js +2 -2
  298. package/react/pf-tile/pf-tile.js +2 -2
  299. package/react/pf-timestamp/pf-timestamp.js +2 -2
  300. package/react/pf-tooltip/pf-tooltip.js +2 -2
  301. package/pf-accordion/BaseAccordion.d.ts +0 -61
  302. package/pf-accordion/BaseAccordion.js +0 -269
  303. package/pf-accordion/BaseAccordion.js.map +0 -1
  304. package/pf-accordion/BaseAccordionHeader.css +0 -39
  305. package/pf-accordion/BaseAccordionHeader.d.ts +0 -29
  306. package/pf-accordion/BaseAccordionHeader.js +0 -128
  307. package/pf-accordion/BaseAccordionHeader.js.map +0 -1
  308. package/pf-accordion/BaseAccordionPanel.css +0 -27
  309. package/pf-accordion/BaseAccordionPanel.d.ts +0 -7
  310. package/pf-accordion/BaseAccordionPanel.js +0 -33
  311. package/pf-accordion/BaseAccordionPanel.js.map +0 -1
  312. package/pf-avatar/BaseAvatar.css +0 -13
  313. package/pf-avatar/BaseAvatar.d.ts +0 -23
  314. package/pf-avatar/BaseAvatar.js +0 -62
  315. package/pf-avatar/BaseAvatar.js.map +0 -1
  316. package/pf-back-to-top/demo/demo.css +0 -25
  317. package/pf-badge/BaseBadge.css +0 -6
  318. package/pf-badge/BaseBadge.d.ts +0 -18
  319. package/pf-badge/BaseBadge.js +0 -16
  320. package/pf-badge/BaseBadge.js.map +0 -1
  321. package/pf-button/BaseButton.css +0 -68
  322. package/pf-button/BaseButton.d.ts +0 -51
  323. package/pf-button/BaseButton.js +0 -84
  324. package/pf-button/BaseButton.js.map +0 -1
  325. package/pf-card/BaseCard.css +0 -36
  326. package/pf-card/BaseCard.d.ts +0 -24
  327. package/pf-card/BaseCard.js +0 -51
  328. package/pf-card/BaseCard.js.map +0 -1
  329. package/pf-clipboard-copy/BaseClipboardCopy.css +0 -6
  330. package/pf-clipboard-copy/BaseClipboardCopy.d.ts +0 -18
  331. package/pf-clipboard-copy/BaseClipboardCopy.js +0 -25
  332. package/pf-clipboard-copy/BaseClipboardCopy.js.map +0 -1
  333. package/pf-code-block/BaseCodeBlock.css +0 -7
  334. package/pf-code-block/BaseCodeBlock.d.ts +0 -8
  335. package/pf-code-block/BaseCodeBlock.js +0 -22
  336. package/pf-code-block/BaseCodeBlock.js.map +0 -1
  337. package/pf-icon/BaseIcon.css +0 -22
  338. package/pf-icon/BaseIcon.d.ts +0 -41
  339. package/pf-icon/BaseIcon.js +0 -144
  340. package/pf-icon/BaseIcon.js.map +0 -1
  341. package/pf-label/BaseLabel.css +0 -44
  342. package/pf-label/BaseLabel.d.ts +0 -30
  343. package/pf-label/BaseLabel.js +0 -29
  344. package/pf-label/BaseLabel.js.map +0 -1
  345. package/pf-spinner/BaseSpinner.css +0 -20
  346. package/pf-spinner/BaseSpinner.d.ts +0 -27
  347. package/pf-spinner/BaseSpinner.js +0 -45
  348. package/pf-spinner/BaseSpinner.js.map +0 -1
  349. package/pf-switch/BaseSwitch.css +0 -36
  350. package/pf-switch/BaseSwitch.d.ts +0 -19
  351. package/pf-switch/BaseSwitch.js +0 -109
  352. package/pf-switch/BaseSwitch.js.map +0 -1
  353. package/pf-tabs/BaseTab.css +0 -60
  354. package/pf-tabs/BaseTab.d.ts +0 -32
  355. package/pf-tabs/BaseTab.js +0 -83
  356. package/pf-tabs/BaseTab.js.map +0 -1
  357. package/pf-tabs/BaseTabPanel.css +0 -7
  358. package/pf-tabs/BaseTabPanel.d.ts +0 -7
  359. package/pf-tabs/BaseTabPanel.js +0 -36
  360. package/pf-tabs/BaseTabPanel.js.map +0 -1
  361. package/pf-tabs/BaseTabs.css +0 -86
  362. package/pf-tabs/BaseTabs.d.ts +0 -38
  363. package/pf-tabs/BaseTabs.js +0 -221
  364. package/pf-tabs/BaseTabs.js.map +0 -1
  365. package/pf-tile/BaseTile.d.ts +0 -13
  366. package/pf-tile/BaseTile.js +0 -28
  367. package/pf-tile/BaseTile.js.map +0 -1
  368. package/pf-tooltip/BaseTooltip.css +0 -70
  369. package/pf-tooltip/BaseTooltip.d.ts +0 -16
  370. package/pf-tooltip/BaseTooltip.js +0 -54
  371. 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.click();
19
+ await clickElementAtCenter(header);
20
20
  await allUpdates(element);
21
21
  }
22
22
  async function clickSecondHeader() {
23
- secondHeader.click();
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 createFixture(html `<pf-accordion></pf-accordion>`);
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 createFixture(html `
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><a href="#">Lorem ipsum dolor sit amet</a>, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
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><a href="#">Lorem ipsum dolor sit amet</a>, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
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><a href="#">Lorem ipsum dolor sit amet</a>, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
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
- expect(header.shadowRoot.querySelector('button')?.getAttribute('aria-expanded')).to.equal('true');
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
- expect(header.shadowRoot.querySelector('button')?.getAttribute('aria-expanded')).to.equal('false');
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(async function () {
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(async function () {
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
- describe('with all panels closed', function () {
280
- it('applies hidden attribute to all panels', function () {
281
- expect(panel1.hidden, 'panel1').to.be.true;
282
- expect(panel2.hidden, 'panel2').to.be.true;
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('with all panels open', function () {
291
+ describe('clicking every header', function () {
287
292
  beforeEach(async function () {
288
293
  for (const header of element.querySelectorAll('pf-accordion-header')) {
289
- header.click();
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('when focus is on the first header', function () {
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('moves focus to the body', function () {
333
- expect(document.activeElement).to.equal(document.body);
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('moves focus to the body', function () {
339
- expect(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(header2);
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(document.activeElement).to.equal(header3);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header3);
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('when focus is on the middle header', function () {
388
- beforeEach(async function () {
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(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(header3);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header3);
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('when focus is on the last header', function () {
440
- beforeEach(async function () {
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(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header2);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header3);
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('when the first panel is expanded', function () {
508
- beforeEach(async function () {
512
+ describe('expand(0)', function () {
513
+ beforeEach(function () {
509
514
  element.expand(0);
510
- await aTimeout(500);
511
515
  });
512
- describe('and focus is on the first header', function () {
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(document.activeElement).to.equal(panel1.querySelector('a'));
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(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(panel1.querySelector('a'));
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(document.activeElement).to.equal(panel1.querySelector('a'));
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(document.activeElement).to.equal(panel1.querySelector('a'));
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(document.activeElement).to.equal(panel1.querySelector('a'));
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(document.activeElement).to.equal(panel1.querySelector('a'));
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
- expect(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(header2);
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(document.activeElement).to.equal(header3);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header3);
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('and focus is on the middle header', function () {
646
- beforeEach(press('Tab'));
647
- beforeEach(press('Tab'));
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(document.activeElement).to.equal(panel1.querySelector('a'));
663
+ expect(await a11ySnapshot()).to.have.axTreeFocusOn(panel1.querySelector('a'));
652
664
  });
653
665
  });
654
666
  });
655
667
  });
656
- describe('when the middle panel is expanded', function () {
657
- beforeEach(async function () {
668
+ describe('expand(1)', function () {
669
+ beforeEach(function () {
658
670
  element.expand(1);
659
- await nextFrame();
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('and focus is on the middle header', function () {
668
- beforeEach(async function () {
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(document.activeElement).to.equal(panel2.querySelector('a'));
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(document.activeElement).to.equal(document.body);
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(document.activeElement).to.equal(header1);
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(document.activeElement).to.equal(header3);
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('and focus is on the last header', function () {
714
- beforeEach(async function () {
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(document.activeElement).to.equal(panel2.querySelector('a'));
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('when the last panel is expanded', function () {
727
- beforeEach(async function () {
740
+ describe('expand(2)', function () {
741
+ beforeEach(function () {
728
742
  element.expand(2);
729
- await nextFrame();
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('when focus is on the last header', function () {
733
- beforeEach(async function () {
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(document.activeElement).to.equal(panel3.querySelector('a'));
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 createFixture(html `
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 createFixture(html `
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 createFixture(html `
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 createFixture(html `
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 topLevelHeaderOne;
889
- let topLevelHeaderTwo;
890
- let topLevelHeaderThree;
891
- let topLevelPanelOne;
892
- let topLevelPanelTwo;
893
- let nestedHeaderOne;
894
- let nestedHeaderTwo;
895
- let nestedHeaderThree;
896
- let nestedPanelOne;
897
- let nestedPanelTwo;
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 createFixture(html `
915
+ element = await fixture(html `
901
916
  <pf-accordion>
902
- <pf-accordion-header id="header-1" data-index="0"></pf-accordion-header>
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"></pf-accordion-header>
906
- <pf-accordion-panel id="panel-1-1" data-index="0-1"></pf-accordion-panel>
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"></pf-accordion-header>
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"></pf-accordion-header>
913
- <pf-accordion-panel id="panel-2-1" data-index="1-0"></pf-accordion-panel>
914
- <pf-accordion-header id="header-2-2" data-index="1-1"></pf-accordion-header>
915
- <pf-accordion-panel id="panel-2-2" data-index="1-1"></pf-accordion-panel>
916
- <pf-accordion-header id="header-2-3" data-index="1-2"></pf-accordion-header>
917
- <pf-accordion-panel id="panel-2-3" data-index="1-2"></pf-accordion-panel>
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-header id="header-3" data-index="2"></pf-accordion-header>
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
- topLevelHeaderOne = document.getElementById('header-1');
926
- topLevelHeaderTwo = document.getElementById('header-2');
927
- topLevelHeaderThree = document.getElementById('header-3');
928
- topLevelPanelOne = document.getElementById('panel-1');
929
- topLevelPanelTwo = document.getElementById('panel-2');
930
- nestedHeaderOne = document.getElementById('header-2-1');
931
- nestedHeaderTwo = document.getElementById('header-2-2');
932
- nestedHeaderThree = document.getElementById('header-2-3');
933
- nestedPanelOne = document.getElementById('panel-2-1');
934
- nestedPanelTwo = document.getElementById('panel-2-2');
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
- topLevelHeaderOne.click();
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
- topLevelHeaderTwo.click();
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
- nestedHeaderOne.click();
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
- nestedHeaderTwo.click();
956
- await allUpdates(element);
970
+ await clickElementAtCenter(nestedHeader2);
957
971
  });
958
- it('expands the first top-level pair', function () {
959
- expect(topLevelHeaderOne.shadowRoot.querySelector('button')?.getAttribute('aria-expanded'), 'top level header 1 button aria-expanded attr').to.equal('true');
960
- expect(topLevelHeaderOne.expanded, 'top level header 1 expanded DOM property').to.be.true;
961
- expect(topLevelPanelOne.hasAttribute('expanded'), 'top level panel 1 expanded attr').to.be.true;
962
- expect(topLevelPanelOne.expanded, 'top level panel 1 DOM property').to.be.true;
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
- expect(topLevelHeaderTwo.shadowRoot.querySelector('button')?.getAttribute('aria-expanded'), 'top level header 2 button aria-expanded attr').to.equal('true');
966
- expect(topLevelHeaderTwo.expanded, 'top level header 2 expanded DOM property').to.be.true;
967
- expect(topLevelPanelTwo.hasAttribute('expanded'), 'top level panel 2 expanded attr').to.be.true;
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
- expect(nestedHeaderOne.shadowRoot.querySelector('button')?.getAttribute('aria-expanded'), 'nested header 1 button aria-expanded attr').to.equal('false');
972
- expect(nestedHeaderOne.expanded, 'nested header 1 expanded DOM property').to.be.false;
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
- expect(nestedHeaderTwo.shadowRoot.querySelector('button')?.getAttribute('aria-expanded'), 'nested header 2 button aria-expanded attr').to.equal('true');
978
- expect(nestedHeaderTwo.expanded, 'nested header 2 expanded DOM property').to.be.true;
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('for assistive technology', function () {
987
- describe('with all panels closed', function () {
988
- it('applies hidden attribute to all panels', function () {
989
- expect(topLevelPanelOne.hidden, 'panel-1').to.be.true;
990
- expect(topLevelPanelTwo.hidden, 'panel-2').to.be.true;
991
- expect(nestedPanelOne.hidden, 'panel-1-1').to.be.true;
992
- expect(nestedPanelTwo.hidden, 'panel-2-2').to.be.true;
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
- describe('with all panels open', function () {
997
- beforeEach(async function () {
998
- for (const header of element.querySelectorAll('pf-accordion-header')) {
999
- header.click();
1000
- }
1001
- await nextFrame();
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 all panels', function () {
1004
- expect(topLevelPanelOne.hidden, 'panel-1').to.be.false;
1005
- expect(topLevelPanelTwo.hidden, 'panel-2').to.be.false;
1006
- expect(nestedPanelOne.hidden, 'panel-1-1').to.be.false;
1007
- expect(nestedPanelTwo.hidden, 'panel-2-2').to.be.false;
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('when focus is on the first header of the parent accordion', function () {
1012
- beforeEach(async function () {
1013
- topLevelHeaderOne.focus();
1014
- await nextFrame();
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
- describe('Space', function () {
1017
- beforeEach(press(' '));
1018
- it('expands the first panel', function () {
1019
- expect(topLevelPanelOne.expanded).to.be.true;
1020
- expect(topLevelPanelTwo.expanded).to.be.false;
1021
- expect(nestedPanelOne.expanded).to.be.false;
1022
- expect(nestedPanelTwo.expanded).to.be.false;
1023
- });
1024
- it('removes hidden attribute from the first panel', function () {
1025
- expect(topLevelPanelOne.hidden, 'panel-1').to.be.false;
1026
- expect(topLevelPanelTwo.hidden, 'panel-2').to.be.true;
1027
- expect(nestedPanelOne.hidden, 'panel-1-1').to.be.true;
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
- it('moves focus to the body', function () {
1034
- expect(document.activeElement).to.equal(document.body);
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
- describe('Navigating from parent to child accordion', function () {
1059
- describe('Opening the panel containing the nested accordion and pressing TAB', function () {
1060
- beforeEach(press('Space'));
1061
- beforeEach(press('Tab'));
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
- describe('ArrowLeft', function () {
1072
- beforeEach(press('ArrowLeft'));
1073
- it('moves focus to the last header', function () {
1074
- expect(document.activeElement).to.equal(nestedHeaderThree);
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
- describe('ArrowDown', function () {
1078
- beforeEach(press('ArrowDown'));
1079
- it('moves focus to the second header', function () {
1080
- expect(document.activeElement).to.equal(nestedHeaderTwo);
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
- describe('ArrowRight', function () {
1084
- beforeEach(press('ArrowRight'));
1085
- it('moves focus to the second header', function () {
1086
- expect(document.activeElement).to.equal(nestedHeaderTwo);
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
- describe('Tab', function () {
1090
- beforeEach(press('Tab'));
1091
- it('should move focus back to the body', function () {
1092
- expect(document.activeElement).to.equal(document.body);
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 accordionOneHeaderOne;
1103
- let accordionOnePanelOne;
1104
- let accordionTwoHeaderOne;
1105
- let accordionTwoPanelOne;
1124
+ let accordion1Header1;
1125
+ let accordion1Panel1;
1126
+ let accordion2Header1;
1127
+ let accordion2Panel1;
1106
1128
  beforeEach(async function () {
1107
- multipleAccordionElements = await createFixture(html `
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
- accordionOneHeaderOne = document.getElementById('header-1-1');
1120
- accordionOnePanelOne = document.getElementById('panel-1-1');
1121
- accordionTwoHeaderOne = document.getElementById('header-2-1');
1122
- accordionTwoPanelOne = document.getElementById('panel-2-1');
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
- describe('for assistive technology', function () {
1125
- describe('with all panels closed', function () {
1126
- it('applies hidden attribute to all panels', function () {
1127
- expect(accordionOnePanelOne.hidden, 'panel-1-1').to.be.true;
1128
- expect(accordionTwoPanelOne.hidden, 'panel-2-1').to.be.true;
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
- describe('with all panels open', function () {
1132
- beforeEach(async function () {
1133
- for (const header of multipleAccordionElements.querySelectorAll('pf-accordion-header')) {
1134
- header.click();
1135
- }
1136
- await nextFrame();
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 all panels', function () {
1139
- expect(accordionOnePanelOne.hidden, 'panel-1-1').to.be.false;
1140
- expect(accordionTwoPanelOne.hidden, 'panel-2-1').to.be.false;
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('when focus is on the first header of the first accordion', function () {
1144
- beforeEach(async function () {
1145
- accordionOneHeaderOne.focus();
1146
- await nextFrame();
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('Space', function () {
1149
- beforeEach(press(' '));
1150
- it('expands the first panel', function () {
1151
- expect(accordionOnePanelOne.expanded).to.be.true;
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 createFixture(html `
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.click();
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.click();
1227
+ await clickElementAtCenter(pfswitch);
1212
1228
  await element.updateComplete;
1213
1229
  await pfswitch.updateComplete;
1214
1230
  expect(pfswitch.checked).to.not.equal(checked);