@patternfly/elements 3.0.0 → 3.0.2

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 (365) hide show
  1. package/custom-elements.json +490 -484
  2. package/package.json +1 -1
  3. package/pf-accordion/BaseAccordion.js +2 -1
  4. package/pf-accordion/BaseAccordion.js.map +1 -1
  5. package/pf-accordion/BaseAccordionHeader.js +4 -1
  6. package/pf-accordion/BaseAccordionHeader.js.map +1 -1
  7. package/pf-accordion/BaseAccordionPanel.d.ts +1 -1
  8. package/pf-accordion/pf-accordion-header.d.ts +1 -1
  9. package/pf-accordion/pf-accordion.d.ts +0 -5
  10. package/pf-accordion/pf-accordion.js +0 -5
  11. package/pf-accordion/pf-accordion.js.map +1 -1
  12. package/pf-accordion/test/pf-accordion.e2e.d.ts +1 -0
  13. package/pf-accordion/test/pf-accordion.e2e.js +11 -0
  14. package/pf-accordion/test/pf-accordion.e2e.js.map +1 -0
  15. package/pf-accordion/test/pf-accordion.spec.d.ts +1 -0
  16. package/pf-accordion/test/pf-accordion.spec.js +1222 -0
  17. package/pf-accordion/test/pf-accordion.spec.js.map +1 -0
  18. package/pf-avatar/BaseAvatar.d.ts +1 -1
  19. package/pf-avatar/test/pf-avatar.e2e.d.ts +1 -0
  20. package/pf-avatar/test/pf-avatar.e2e.js +11 -0
  21. package/pf-avatar/test/pf-avatar.e2e.js.map +1 -0
  22. package/pf-avatar/test/pf-avatar.spec.d.ts +1 -0
  23. package/pf-avatar/test/pf-avatar.spec.js +45 -0
  24. package/pf-avatar/test/pf-avatar.spec.js.map +1 -0
  25. package/pf-back-to-top/demo/demo.css +25 -0
  26. package/pf-back-to-top/pf-back-to-top.d.ts +1 -1
  27. package/pf-back-to-top/test/pf-back-to-top.e2e.d.ts +1 -0
  28. package/pf-back-to-top/test/pf-back-to-top.e2e.js +11 -0
  29. package/pf-back-to-top/test/pf-back-to-top.e2e.js.map +1 -0
  30. package/pf-back-to-top/test/pf-back-to-top.spec.d.ts +1 -0
  31. package/pf-back-to-top/test/pf-back-to-top.spec.js +267 -0
  32. package/pf-back-to-top/test/pf-back-to-top.spec.js.map +1 -0
  33. package/pf-background-image/pf-background-image.d.ts +1 -4
  34. package/pf-background-image/pf-background-image.js +1 -4
  35. package/pf-background-image/pf-background-image.js.map +1 -1
  36. package/pf-background-image/test/pf-background-image.e2e.d.ts +1 -0
  37. package/pf-background-image/test/pf-background-image.e2e.js +11 -0
  38. package/pf-background-image/test/pf-background-image.e2e.js.map +1 -0
  39. package/pf-background-image/test/pf-background-image.spec.d.ts +1 -0
  40. package/pf-background-image/test/pf-background-image.spec.js +89 -0
  41. package/pf-background-image/test/pf-background-image.spec.js.map +1 -0
  42. package/pf-badge/BaseBadge.d.ts +1 -1
  43. package/pf-badge/test/pf-badge.e2e.d.ts +1 -0
  44. package/pf-badge/test/pf-badge.e2e.js +11 -0
  45. package/pf-badge/test/pf-badge.e2e.js.map +1 -0
  46. package/pf-badge/test/pf-badge.spec.d.ts +1 -0
  47. package/pf-badge/test/pf-badge.spec.js +52 -0
  48. package/pf-badge/test/pf-badge.spec.js.map +1 -0
  49. package/pf-banner/pf-banner.d.ts +1 -10
  50. package/pf-banner/pf-banner.js +0 -9
  51. package/pf-banner/pf-banner.js.map +1 -1
  52. package/pf-banner/test/pf-banner.e2e.d.ts +1 -0
  53. package/pf-banner/test/pf-banner.e2e.js +11 -0
  54. package/pf-banner/test/pf-banner.e2e.js.map +1 -0
  55. package/pf-banner/test/pf-banner.spec.d.ts +1 -0
  56. package/pf-banner/test/pf-banner.spec.js +81 -0
  57. package/pf-banner/test/pf-banner.spec.js.map +1 -0
  58. package/pf-button/BaseButton.d.ts +7 -2
  59. package/pf-button/BaseButton.js +4 -1
  60. package/pf-button/BaseButton.js.map +1 -1
  61. package/pf-button/pf-button.d.ts +1 -17
  62. package/pf-button/pf-button.js +10 -18
  63. package/pf-button/pf-button.js.map +1 -1
  64. package/pf-button/test/pf-button.e2e.d.ts +1 -0
  65. package/pf-button/test/pf-button.e2e.js +11 -0
  66. package/pf-button/test/pf-button.e2e.js.map +1 -0
  67. package/pf-button/test/pf-button.spec.d.ts +1 -0
  68. package/pf-button/test/pf-button.spec.js +124 -0
  69. package/pf-button/test/pf-button.spec.js.map +1 -0
  70. package/pf-card/BaseCard.d.ts +1 -1
  71. package/pf-card/test/pf-card.e2e.d.ts +1 -0
  72. package/pf-card/test/pf-card.e2e.js +11 -0
  73. package/pf-card/test/pf-card.e2e.js.map +1 -0
  74. package/pf-card/test/pf-card.spec.d.ts +1 -0
  75. package/pf-card/test/pf-card.spec.js +160 -0
  76. package/pf-card/test/pf-card.spec.js.map +1 -0
  77. package/pf-chip/pf-chip-group.d.ts +8 -5
  78. package/pf-chip/pf-chip-group.js +10 -10
  79. package/pf-chip/pf-chip-group.js.map +1 -1
  80. package/pf-chip/pf-chip.d.ts +8 -5
  81. package/pf-chip/pf-chip.js +4 -4
  82. package/pf-chip/pf-chip.js.map +1 -1
  83. package/pf-chip/test/pf-chip-group.spec.d.ts +1 -0
  84. package/pf-chip/test/pf-chip-group.spec.js +189 -0
  85. package/pf-chip/test/pf-chip-group.spec.js.map +1 -0
  86. package/pf-chip/test/pf-chip.e2e.d.ts +1 -0
  87. package/pf-chip/test/pf-chip.e2e.js +11 -0
  88. package/pf-chip/test/pf-chip.e2e.js.map +1 -0
  89. package/pf-chip/test/pf-chip.spec.d.ts +1 -0
  90. package/pf-chip/test/pf-chip.spec.js +116 -0
  91. package/pf-chip/test/pf-chip.spec.js.map +1 -0
  92. package/pf-clipboard-copy/pf-clipboard-copy.css +4 -0
  93. package/pf-clipboard-copy/pf-clipboard-copy.d.ts +8 -3
  94. package/pf-clipboard-copy/pf-clipboard-copy.js +6 -4
  95. package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
  96. package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.d.ts +1 -0
  97. package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js +11 -0
  98. package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js.map +1 -0
  99. package/pf-clipboard-copy/test/pf-clipboard-copy.spec.d.ts +1 -0
  100. package/pf-clipboard-copy/test/pf-clipboard-copy.spec.js +103 -0
  101. package/pf-clipboard-copy/test/pf-clipboard-copy.spec.js.map +1 -0
  102. package/pf-code-block/BaseCodeBlock.js +2 -2
  103. package/pf-code-block/BaseCodeBlock.js.map +1 -1
  104. package/pf-code-block/pf-code-block.d.ts +1 -1
  105. package/pf-code-block/test/pf-code-block.e2e.d.ts +1 -0
  106. package/pf-code-block/test/pf-code-block.e2e.js +11 -0
  107. package/pf-code-block/test/pf-code-block.e2e.js.map +1 -0
  108. package/pf-code-block/test/pf-code-block.spec.d.ts +1 -0
  109. package/pf-code-block/test/pf-code-block.spec.js +89 -0
  110. package/pf-code-block/test/pf-code-block.spec.js.map +1 -0
  111. package/pf-dropdown/pf-dropdown-group.d.ts +1 -1
  112. package/pf-dropdown/pf-dropdown-group.js +4 -1
  113. package/pf-dropdown/pf-dropdown-group.js.map +1 -1
  114. package/pf-dropdown/pf-dropdown-item.d.ts +1 -2
  115. package/pf-dropdown/pf-dropdown-item.js +4 -2
  116. package/pf-dropdown/pf-dropdown-item.js.map +1 -1
  117. package/pf-dropdown/pf-dropdown-menu.d.ts +1 -2
  118. package/pf-dropdown/pf-dropdown-menu.js +8 -6
  119. package/pf-dropdown/pf-dropdown-menu.js.map +1 -1
  120. package/pf-dropdown/pf-dropdown.d.ts +8 -6
  121. package/pf-dropdown/pf-dropdown.js +11 -11
  122. package/pf-dropdown/pf-dropdown.js.map +1 -1
  123. package/pf-dropdown/test/pf-dropdown.e2e.d.ts +1 -0
  124. package/pf-dropdown/test/pf-dropdown.e2e.js +11 -0
  125. package/pf-dropdown/test/pf-dropdown.e2e.js.map +1 -0
  126. package/pf-dropdown/test/pf-dropdown.spec.d.ts +1 -0
  127. package/pf-dropdown/test/pf-dropdown.spec.js +129 -0
  128. package/pf-dropdown/test/pf-dropdown.spec.js.map +1 -0
  129. package/pf-icon/BaseIcon.d.ts +1 -2
  130. package/pf-icon/BaseIcon.js +3 -4
  131. package/pf-icon/BaseIcon.js.map +1 -1
  132. package/pf-icon/demo/icons/rh/boba-tea.js +5 -0
  133. package/pf-icon/demo/icons/rh/lifecycle.js +3 -0
  134. package/pf-icon/test/pf-icon.e2e.d.ts +1 -0
  135. package/pf-icon/test/pf-icon.e2e.js +11 -0
  136. package/pf-icon/test/pf-icon.e2e.js.map +1 -0
  137. package/pf-icon/test/pf-icon.spec.d.ts +1 -0
  138. package/pf-icon/test/pf-icon.spec.js +130 -0
  139. package/pf-icon/test/pf-icon.spec.js.map +1 -0
  140. package/pf-icon/test/rh-icon-aed.js +2 -0
  141. package/pf-icon/test/rh-icon-api.js +2 -0
  142. package/pf-icon/test/rh-icon-atom.js +2 -0
  143. package/pf-icon/test/rh-icon-bike.js +2 -0
  144. package/pf-jump-links/pf-jump-links-item.d.ts +8 -2
  145. package/pf-jump-links/pf-jump-links-item.js +4 -1
  146. package/pf-jump-links/pf-jump-links-item.js.map +1 -1
  147. package/pf-jump-links/pf-jump-links-list.d.ts +1 -1
  148. package/pf-jump-links/pf-jump-links.d.ts +1 -7
  149. package/pf-jump-links/pf-jump-links.js +1 -7
  150. package/pf-jump-links/pf-jump-links.js.map +1 -1
  151. package/pf-jump-links/test/pf-jump-links.e2e.d.ts +1 -0
  152. package/pf-jump-links/test/pf-jump-links.e2e.js +11 -0
  153. package/pf-jump-links/test/pf-jump-links.e2e.js.map +1 -0
  154. package/pf-jump-links/test/pf-jump-links.spec.d.ts +1 -0
  155. package/pf-jump-links/test/pf-jump-links.spec.js +85 -0
  156. package/pf-jump-links/test/pf-jump-links.spec.js.map +1 -0
  157. package/pf-label/BaseLabel.d.ts +1 -1
  158. package/pf-label/pf-label.d.ts +10 -24
  159. package/pf-label/pf-label.js +4 -21
  160. package/pf-label/pf-label.js.map +1 -1
  161. package/pf-label/test/pf-label.e2e.d.ts +1 -0
  162. package/pf-label/test/pf-label.e2e.js +11 -0
  163. package/pf-label/test/pf-label.e2e.js.map +1 -0
  164. package/pf-label/test/pf-label.spec.d.ts +1 -0
  165. package/pf-label/test/pf-label.spec.js +111 -0
  166. package/pf-label/test/pf-label.spec.js.map +1 -0
  167. package/pf-modal/pf-modal.d.ts +1 -6
  168. package/pf-modal/pf-modal.js +6 -8
  169. package/pf-modal/pf-modal.js.map +1 -1
  170. package/pf-modal/test/pf-modal.e2e.d.ts +1 -0
  171. package/pf-modal/test/pf-modal.e2e.js +13 -0
  172. package/pf-modal/test/pf-modal.e2e.js.map +1 -0
  173. package/pf-modal/test/pf-modal.spec.d.ts +1 -0
  174. package/pf-modal/test/pf-modal.spec.js +197 -0
  175. package/pf-modal/test/pf-modal.spec.js.map +1 -0
  176. package/pf-panel/pf-panel.d.ts +1 -1
  177. package/pf-panel/test/pf-panel.e2e.d.ts +1 -0
  178. package/pf-panel/test/pf-panel.e2e.js +11 -0
  179. package/pf-panel/test/pf-panel.e2e.js.map +1 -0
  180. package/pf-panel/test/pf-panel.spec.d.ts +1 -0
  181. package/pf-panel/test/pf-panel.spec.js +22 -0
  182. package/pf-panel/test/pf-panel.spec.js.map +1 -0
  183. package/pf-popover/pf-popover.d.ts +1 -5
  184. package/pf-popover/pf-popover.js +12 -7
  185. package/pf-popover/pf-popover.js.map +1 -1
  186. package/pf-popover/test/pf-popover.e2e.d.ts +1 -0
  187. package/pf-popover/test/pf-popover.e2e.js +11 -0
  188. package/pf-popover/test/pf-popover.e2e.js.map +1 -0
  189. package/pf-popover/test/pf-popover.spec.d.ts +1 -0
  190. package/pf-popover/test/pf-popover.spec.js +233 -0
  191. package/pf-popover/test/pf-popover.spec.js.map +1 -0
  192. package/pf-progress/demo/kitchen-sink.css +4 -0
  193. package/pf-progress/pf-progress.d.ts +1 -22
  194. package/pf-progress/pf-progress.js +1 -22
  195. package/pf-progress/pf-progress.js.map +1 -1
  196. package/pf-progress/test/pf-progress.e2e.d.ts +1 -0
  197. package/pf-progress/test/pf-progress.e2e.js +11 -0
  198. package/pf-progress/test/pf-progress.e2e.js.map +1 -0
  199. package/pf-progress/test/pf-progress.spec.d.ts +1 -0
  200. package/pf-progress/test/pf-progress.spec.js +45 -0
  201. package/pf-progress/test/pf-progress.spec.js.map +1 -0
  202. package/pf-progress-stepper/pf-progress-step.d.ts +1 -1
  203. package/pf-progress-stepper/pf-progress-stepper.d.ts +1 -1
  204. package/pf-progress-stepper/test/pf-progress-stepper.e2e.d.ts +1 -0
  205. package/pf-progress-stepper/test/pf-progress-stepper.e2e.js +11 -0
  206. package/pf-progress-stepper/test/pf-progress-stepper.e2e.js.map +1 -0
  207. package/pf-progress-stepper/test/pf-progress-stepper.spec.d.ts +1 -0
  208. package/pf-progress-stepper/test/pf-progress-stepper.spec.js +18 -0
  209. package/pf-progress-stepper/test/pf-progress-stepper.spec.js.map +1 -0
  210. package/pf-select/pf-option-group.d.ts +1 -1
  211. package/pf-select/pf-option-group.js +2 -0
  212. package/pf-select/pf-option-group.js.map +1 -1
  213. package/pf-select/pf-option.d.ts +1 -2
  214. package/pf-select/pf-option.js +3 -4
  215. package/pf-select/pf-option.js.map +1 -1
  216. package/pf-select/pf-select.d.ts +8 -3
  217. package/pf-select/pf-select.js +51 -21
  218. package/pf-select/pf-select.js.map +1 -1
  219. package/pf-select/test/pf-select.e2e.d.ts +1 -0
  220. package/pf-select/test/pf-select.e2e.js +11 -0
  221. package/pf-select/test/pf-select.e2e.js.map +1 -0
  222. package/pf-select/test/pf-select.spec.d.ts +1 -0
  223. package/pf-select/test/pf-select.spec.js +866 -0
  224. package/pf-select/test/pf-select.spec.js.map +1 -0
  225. package/pf-spinner/BaseSpinner.d.ts +1 -2
  226. package/pf-spinner/BaseSpinner.js +2 -4
  227. package/pf-spinner/BaseSpinner.js.map +1 -1
  228. package/pf-spinner/pf-spinner.d.ts +2 -2
  229. package/pf-spinner/pf-spinner.js +8 -1
  230. package/pf-spinner/pf-spinner.js.map +1 -1
  231. package/pf-spinner/test/pf-spinner.e2e.d.ts +1 -0
  232. package/pf-spinner/test/pf-spinner.e2e.js +11 -0
  233. package/pf-spinner/test/pf-spinner.e2e.js.map +1 -0
  234. package/pf-spinner/test/pf-spinner.spec.d.ts +1 -0
  235. package/pf-spinner/test/pf-spinner.spec.js +64 -0
  236. package/pf-spinner/test/pf-spinner.spec.js.map +1 -0
  237. package/pf-switch/BaseSwitch.d.ts +1 -1
  238. package/pf-switch/BaseSwitch.js +3 -3
  239. package/pf-switch/BaseSwitch.js.map +1 -1
  240. package/pf-switch/test/pf-switch.e2e.d.ts +1 -0
  241. package/pf-switch/test/pf-switch.e2e.js +11 -0
  242. package/pf-switch/test/pf-switch.e2e.js.map +1 -0
  243. package/pf-switch/test/pf-switch.spec.d.ts +1 -0
  244. package/pf-switch/test/pf-switch.spec.js +191 -0
  245. package/pf-switch/test/pf-switch.spec.js.map +1 -0
  246. package/pf-table/pf-caption.d.ts +1 -1
  247. package/pf-table/pf-table.d.ts +1 -3
  248. package/pf-table/pf-table.js +2 -4
  249. package/pf-table/pf-table.js.map +1 -1
  250. package/pf-table/pf-tbody.d.ts +1 -1
  251. package/pf-table/pf-td.d.ts +1 -1
  252. package/pf-table/pf-th.d.ts +1 -1
  253. package/pf-table/pf-th.js +3 -3
  254. package/pf-table/pf-th.js.map +1 -1
  255. package/pf-table/pf-thead.d.ts +1 -1
  256. package/pf-table/pf-tr.d.ts +1 -1
  257. package/pf-table/pf-tr.js +4 -4
  258. package/pf-table/pf-tr.js.map +1 -1
  259. package/pf-table/test/pf-table.e2e.d.ts +1 -0
  260. package/pf-table/test/pf-table.e2e.js +11 -0
  261. package/pf-table/test/pf-table.e2e.js.map +1 -0
  262. package/pf-table/test/pf-table.spec.d.ts +1 -0
  263. package/pf-table/test/pf-table.spec.js +17 -0
  264. package/pf-table/test/pf-table.spec.js.map +1 -0
  265. package/pf-tabs/BaseTab.d.ts +2 -2
  266. package/pf-tabs/BaseTab.js +4 -1
  267. package/pf-tabs/BaseTab.js.map +1 -1
  268. package/pf-tabs/BaseTabPanel.d.ts +1 -1
  269. package/pf-tabs/BaseTabs.d.ts +1 -3
  270. package/pf-tabs/BaseTabs.js +11 -12
  271. package/pf-tabs/BaseTabs.js.map +1 -1
  272. package/pf-tabs/pf-tab-panel.d.ts +1 -1
  273. package/pf-tabs/pf-tab.d.ts +1 -17
  274. package/pf-tabs/pf-tab.js +0 -16
  275. package/pf-tabs/pf-tab.js.map +1 -1
  276. package/pf-tabs/pf-tabs.d.ts +1 -12
  277. package/pf-tabs/pf-tabs.js +2 -13
  278. package/pf-tabs/pf-tabs.js.map +1 -1
  279. package/pf-tabs/test/pf-tabs.e2e.d.ts +1 -0
  280. package/pf-tabs/test/pf-tabs.e2e.js +13 -0
  281. package/pf-tabs/test/pf-tabs.e2e.js.map +1 -0
  282. package/pf-tabs/test/pf-tabs.spec.d.ts +1 -0
  283. package/pf-tabs/test/pf-tabs.spec.js +285 -0
  284. package/pf-tabs/test/pf-tabs.spec.js.map +1 -0
  285. package/pf-text-area/pf-text-area.d.ts +1 -2
  286. package/pf-text-area/pf-text-area.js +5 -5
  287. package/pf-text-area/pf-text-area.js.map +1 -1
  288. package/pf-text-area/test/pf-text-area.e2e.d.ts +1 -0
  289. package/pf-text-area/test/pf-text-area.e2e.js +11 -0
  290. package/pf-text-area/test/pf-text-area.e2e.js.map +1 -0
  291. package/pf-text-area/test/pf-text-area.spec.d.ts +1 -0
  292. package/pf-text-area/test/pf-text-area.spec.js +89 -0
  293. package/pf-text-area/test/pf-text-area.spec.js.map +1 -0
  294. package/pf-text-input/demo/demo.css +6 -0
  295. package/pf-text-input/pf-text-input.d.ts +8 -3
  296. package/pf-text-input/pf-text-input.js +4 -2
  297. package/pf-text-input/pf-text-input.js.map +1 -1
  298. package/pf-text-input/test/pf-text-input.e2e.d.ts +1 -0
  299. package/pf-text-input/test/pf-text-input.e2e.js +11 -0
  300. package/pf-text-input/test/pf-text-input.e2e.js.map +1 -0
  301. package/pf-text-input/test/pf-text-input.spec.d.ts +1 -0
  302. package/pf-text-input/test/pf-text-input.spec.js +20 -0
  303. package/pf-text-input/test/pf-text-input.spec.js.map +1 -0
  304. package/pf-tile/BaseTile.d.ts +1 -1
  305. package/pf-tile/pf-tile.d.ts +0 -12
  306. package/pf-tile/pf-tile.js +0 -12
  307. package/pf-tile/pf-tile.js.map +1 -1
  308. package/pf-tile/test/pf-tile.e2e.d.ts +1 -0
  309. package/pf-tile/test/pf-tile.e2e.js +11 -0
  310. package/pf-tile/test/pf-tile.e2e.js.map +1 -0
  311. package/pf-tile/test/pf-tile.spec.d.ts +1 -0
  312. package/pf-tile/test/pf-tile.spec.js +54 -0
  313. package/pf-tile/test/pf-tile.spec.js.map +1 -0
  314. package/pf-timestamp/pf-timestamp.d.ts +1 -1
  315. package/pf-timestamp/pf-timestamp.js +5 -1
  316. package/pf-timestamp/pf-timestamp.js.map +1 -1
  317. package/pf-timestamp/test/pf-timestamp.e2e.d.ts +1 -0
  318. package/pf-timestamp/test/pf-timestamp.e2e.js +12 -0
  319. package/pf-timestamp/test/pf-timestamp.e2e.js.map +1 -0
  320. package/pf-timestamp/test/pf-timestamp.spec.d.ts +1 -0
  321. package/pf-timestamp/test/pf-timestamp.spec.js +156 -0
  322. package/pf-timestamp/test/pf-timestamp.spec.js.map +1 -0
  323. package/pf-tooltip/BaseTooltip.d.ts +1 -1
  324. package/pf-tooltip/pf-tooltip.d.ts +1 -4
  325. package/pf-tooltip/pf-tooltip.js +6 -7
  326. package/pf-tooltip/pf-tooltip.js.map +1 -1
  327. package/pf-tooltip/test/pf-tooltip.e2e.d.ts +1 -0
  328. package/pf-tooltip/test/pf-tooltip.e2e.js +11 -0
  329. package/pf-tooltip/test/pf-tooltip.e2e.js.map +1 -0
  330. package/pf-tooltip/test/pf-tooltip.spec.d.ts +1 -0
  331. package/pf-tooltip/test/pf-tooltip.spec.js +53 -0
  332. package/pf-tooltip/test/pf-tooltip.spec.js.map +1 -0
  333. package/pfe.min.js +273 -266
  334. package/pfe.min.js.map +3 -3
  335. package/pf-accordion/README.md +0 -44
  336. package/pf-avatar/README.md +0 -31
  337. package/pf-back-to-top/README.md +0 -32
  338. package/pf-background-image/README.md +0 -37
  339. package/pf-badge/README.md +0 -57
  340. package/pf-banner/README.md +0 -60
  341. package/pf-button/README.md +0 -61
  342. package/pf-card/README.md +0 -34
  343. package/pf-chip/README.md +0 -20
  344. package/pf-clipboard-copy/README.md +0 -8
  345. package/pf-code-block/README.md +0 -77
  346. package/pf-dropdown/README.md +0 -46
  347. package/pf-icon/README.md +0 -86
  348. package/pf-icon/icons/fab/readme.svg +0 -1
  349. package/pf-jump-links/README.md +0 -27
  350. package/pf-label/README.md +0 -61
  351. package/pf-modal/README.md +0 -63
  352. package/pf-panel/README.md +0 -10
  353. package/pf-popover/README.md +0 -48
  354. package/pf-progress/README.md +0 -33
  355. package/pf-progress-stepper/README.md +0 -41
  356. package/pf-select/README.md +0 -21
  357. package/pf-spinner/README.md +0 -46
  358. package/pf-switch/README.md +0 -91
  359. package/pf-table/README.md +0 -43
  360. package/pf-tabs/README.md +0 -40
  361. package/pf-text-area/README.md +0 -11
  362. package/pf-text-input/README.md +0 -9
  363. package/pf-tile/README.md +0 -12
  364. package/pf-timestamp/README.md +0 -64
  365. package/pf-tooltip/README.md +0 -64
@@ -0,0 +1,267 @@
1
+ import { expect, html, nextFrame } from '@open-wc/testing';
2
+ import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
3
+ import { setViewport, sendKeys } from '@web/test-runner-commands';
4
+ import { allUpdates } from '@patternfly/pfe-tools/test/utils.js';
5
+ import { PfBackToTop } from '../pf-back-to-top.js';
6
+ import { a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';
7
+ const takeProps = (props) => (obj) => Object.fromEntries(Object.entries(obj).filter(([k]) => props.includes(k)));
8
+ describe('<pf-back-to-top>', function () {
9
+ it('imperatively instantiates', function () {
10
+ expect(document.createElement('pf-back-to-top')).to.be.an.instanceof(PfBackToTop);
11
+ });
12
+ describe('simply instantiating', function () {
13
+ let element;
14
+ beforeEach(async function () {
15
+ element = await createFixture(html `<pf-back-to-top></pf-back-to-top>`);
16
+ });
17
+ it('should upgrade', function () {
18
+ const klass = customElements.get('pf-back-to-top');
19
+ expect(element)
20
+ .to.be.an.instanceOf(klass)
21
+ .and
22
+ .to.be.an.instanceOf(PfBackToTop);
23
+ });
24
+ });
25
+ describe('when rendered in a viewport with a height smaller then content length', function () {
26
+ let element;
27
+ let snapshot;
28
+ beforeEach(async function () {
29
+ await setViewport({ width: 320, height: 640 });
30
+ window.scrollTo({ top: 0, behavior: 'instant' });
31
+ await nextFrame();
32
+ const container = await createFixture(html `
33
+ <div id="top">
34
+ <div style="height: 2000px;"></div>
35
+ <pf-back-to-top href="#top">Back to top</pf-back-to-top>
36
+ </div>
37
+ `);
38
+ element = container.querySelector('pf-back-to-top');
39
+ snapshot = await a11ySnapshot();
40
+ await allUpdates(element);
41
+ });
42
+ it('should be hidden on init', function () {
43
+ const { children } = snapshot;
44
+ expect(children).to.be.undefined;
45
+ });
46
+ it('should not be accessible', function () {
47
+ expect(snapshot.children).to.be.undefined;
48
+ });
49
+ describe('when scrolled 401px', function () {
50
+ beforeEach(async function () {
51
+ window.scrollTo({ top: 401, behavior: 'instant' });
52
+ await nextFrame();
53
+ await allUpdates(element);
54
+ snapshot = await a11ySnapshot();
55
+ });
56
+ it('should be visible', function () {
57
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
58
+ });
59
+ it('should be accessible', async function () {
60
+ await expect(element).to.be.accessible();
61
+ });
62
+ describe('pressing the tab key', function () {
63
+ beforeEach(async function () {
64
+ await sendKeys({ press: 'Tab' });
65
+ await allUpdates(element);
66
+ await nextFrame();
67
+ });
68
+ it('should focus the component', function () {
69
+ expect(document.activeElement).to.equal(element);
70
+ });
71
+ });
72
+ });
73
+ describe('when the always visible property is true', function () {
74
+ beforeEach(async function () {
75
+ window.scrollTo({ top: 0, behavior: 'instant' });
76
+ await nextFrame();
77
+ element.alwaysVisible = true;
78
+ await allUpdates(element);
79
+ snapshot = await a11ySnapshot();
80
+ });
81
+ it('should be visible', function () {
82
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
83
+ });
84
+ it('should be accessible', async function () {
85
+ await expect(element).to.be.accessible();
86
+ });
87
+ describe('pressing the tab key', function () {
88
+ beforeEach(async function () {
89
+ await sendKeys({ press: 'Tab' });
90
+ await allUpdates(element);
91
+ await nextFrame();
92
+ });
93
+ it('should focus the component', function () {
94
+ expect(document.activeElement).to.equal(element);
95
+ });
96
+ });
97
+ });
98
+ describe('when the scroll distance is set to 1000', function () {
99
+ beforeEach(async function () {
100
+ element.scrollDistance = 1000;
101
+ await allUpdates(element);
102
+ snapshot = await a11ySnapshot();
103
+ });
104
+ it('should be hidden', function () {
105
+ const { children } = snapshot;
106
+ expect(children).to.be.undefined;
107
+ });
108
+ describe('when scrolled 1001px', function () {
109
+ beforeEach(async function () {
110
+ window.scrollTo({ top: 1001, behavior: 'instant' });
111
+ await nextFrame();
112
+ await allUpdates(element);
113
+ snapshot = await a11ySnapshot();
114
+ });
115
+ it('should be visible', function () {
116
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
117
+ });
118
+ });
119
+ });
120
+ });
121
+ describe('when rendered in an element with an overflowed height', function () {
122
+ let element;
123
+ let snapshot;
124
+ beforeEach(async function () {
125
+ window.scrollTo({ top: 0, behavior: 'instant' });
126
+ await nextFrame();
127
+ const container = await createFixture(html `
128
+ <div id="top" style="height: 500px; overflow-y: scroll;">
129
+ <div style="height: 2000px;"></div>
130
+ <pf-back-to-top href="#top" scrollable-selector="#top">Back to top</pf-back-to-top>
131
+ </div>
132
+ `);
133
+ element = container.querySelector('pf-back-to-top');
134
+ snapshot = await a11ySnapshot();
135
+ await allUpdates(element);
136
+ });
137
+ it('should be hidden on init', function () {
138
+ const { children } = snapshot;
139
+ expect(children).to.be.undefined;
140
+ });
141
+ describe('when scrolled 401px', function () {
142
+ beforeEach(async function () {
143
+ const scrollableElement = document.querySelector('#top');
144
+ scrollableElement.scrollTo({ top: 401, behavior: 'instant' });
145
+ await nextFrame();
146
+ await allUpdates(element);
147
+ snapshot = await a11ySnapshot();
148
+ });
149
+ it('should be visible', function () {
150
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
151
+ });
152
+ });
153
+ });
154
+ describe('when no text is provided', function () {
155
+ let element;
156
+ let snapshot;
157
+ describe('as a link', function () {
158
+ beforeEach(async function () {
159
+ await setViewport({ width: 320, height: 640 });
160
+ window.scrollTo({ top: 0, behavior: 'instant' });
161
+ await nextFrame();
162
+ const container = await createFixture(html `
163
+ <div id="top">
164
+ <div style="height: 2000px;"></div>
165
+ <pf-back-to-top href="#top"></pf-back-to-top>
166
+ </div>
167
+ `);
168
+ element = container.querySelector('pf-back-to-top');
169
+ await allUpdates(element);
170
+ });
171
+ describe('when scrolled', function () {
172
+ beforeEach(async function () {
173
+ window.scrollTo({ top: 401, behavior: 'instant' });
174
+ await nextFrame();
175
+ await allUpdates(element);
176
+ snapshot = await a11ySnapshot();
177
+ });
178
+ it('should have a label of "Back to top"', function () {
179
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
180
+ });
181
+ });
182
+ });
183
+ describe('as a button', function () {
184
+ beforeEach(async function () {
185
+ await setViewport({ width: 320, height: 640 });
186
+ window.scrollTo({ top: 0, behavior: 'instant' });
187
+ await nextFrame();
188
+ const container = await createFixture(html `
189
+ <div id="top">
190
+ <div style="height: 2000px;"></div>
191
+ <pf-back-to-top></pf-back-to-top>
192
+ </div>
193
+ `);
194
+ element = container.querySelector('pf-back-to-top');
195
+ await allUpdates(element);
196
+ });
197
+ describe('when scrolled', function () {
198
+ beforeEach(async function () {
199
+ window.scrollTo({ top: 401, behavior: 'instant' });
200
+ await nextFrame();
201
+ await allUpdates(element);
202
+ snapshot = await a11ySnapshot();
203
+ });
204
+ it('should have a label of "Back to top"', function () {
205
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Back to top' }]);
206
+ });
207
+ });
208
+ });
209
+ });
210
+ describe('when a label is provided', function () {
211
+ let element;
212
+ let snapshot;
213
+ describe('as a link', function () {
214
+ beforeEach(async function () {
215
+ await setViewport({ width: 320, height: 640 });
216
+ window.scrollTo({ top: 0, behavior: 'instant' });
217
+ await nextFrame();
218
+ const container = await createFixture(html `
219
+ <div id="top">
220
+ <div style="height: 2000px;"></div>
221
+ <pf-back-to-top href="#top" label="Return to top"></pf-back-to-top>
222
+ </div>
223
+ `);
224
+ element = container.querySelector('pf-back-to-top');
225
+ await allUpdates(element);
226
+ });
227
+ describe('when scrolled', function () {
228
+ beforeEach(async function () {
229
+ window.scrollTo({ top: 401, behavior: 'instant' });
230
+ await nextFrame();
231
+ await allUpdates(element);
232
+ snapshot = await a11ySnapshot();
233
+ });
234
+ it('should have a label of "Return to top"', function () {
235
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Return to top' }]);
236
+ });
237
+ });
238
+ });
239
+ describe('as a button', function () {
240
+ beforeEach(async function () {
241
+ await setViewport({ width: 320, height: 640 });
242
+ window.scrollTo({ top: 0, behavior: 'instant' });
243
+ await nextFrame();
244
+ const container = await createFixture(html `
245
+ <div id="top">
246
+ <div style="height: 2000px;"></div>
247
+ <pf-back-to-top label="Return to top"></pf-back-to-top>
248
+ </div>
249
+ `);
250
+ element = container.querySelector('pf-back-to-top');
251
+ await allUpdates(element);
252
+ });
253
+ describe('when scrolled', function () {
254
+ beforeEach(async function () {
255
+ window.scrollTo({ top: 401, behavior: 'instant' });
256
+ await nextFrame();
257
+ await allUpdates(element);
258
+ snapshot = await a11ySnapshot();
259
+ });
260
+ it('should have a label of "Return to top"', function () {
261
+ expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Return to top' }]);
262
+ });
263
+ });
264
+ });
265
+ });
266
+ });
267
+ //# sourceMappingURL=pf-back-to-top.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pf-back-to-top.spec.js","sourceRoot":"","sources":["pf-back-to-top.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAyB,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAElG,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC,GAAW,EAAE,EAAE,CACrD,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7E,QAAQ,CAAC,kBAAkB,EAAE;IAC3B,EAAE,CAAC,2BAA2B,EAAE;QAC9B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE;QAC/B,IAAI,OAAoB,CAAC;QAEzB,UAAU,CAAC,KAAK;YACd,OAAO,GAAG,MAAM,aAAa,CAAc,IAAI,CAAA,mCAAmC,CAAC,CA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AC/C,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;gBACjD,MAAM,SAAS,EAAE,CAAC;gBAClB,MAAM,SAAS,GAAG,MAAM,aAAa,CAAc,IAAI,CAAA;;;;;SAKtD,CAAC,CAAC;gBACH,OAAO,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAE,CAAC;gBACrD,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,eAAe,EAAE;gBACxB,UAAU,CAAC,KAAK;oBACd,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;oBACnD,MAAM,SAAS,EAAE,CAAC;oBAClB,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC1B,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;gBAClC,CAAC,CAAC,CAAC;gBAEH,EAAE,CAAC,wCAAwC,EAAE;oBAC3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;gBACzH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, html, nextFrame } from '@open-wc/testing';\nimport { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';\nimport { setViewport, sendKeys } from '@web/test-runner-commands';\n\nimport { allUpdates } from '@patternfly/pfe-tools/test/utils.js';\n\nimport { PfBackToTop } from '../pf-back-to-top.js';\nimport { type A11yTreeSnapshot, a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';\n\nconst takeProps = (props: string[]) => (obj: object) =>\n Object.fromEntries(Object.entries(obj).filter(([k]) => props.includes(k)));\n\ndescribe('<pf-back-to-top>', function() {\n it('imperatively instantiates', function() {\n expect(document.createElement('pf-back-to-top')).to.be.an.instanceof(PfBackToTop);\n });\n\n describe('simply instantiating', function() {\n let element: PfBackToTop;\n\n beforeEach(async function() {\n element = await createFixture<PfBackToTop>(html`<pf-back-to-top></pf-back-to-top>`);\n });\n\n it('should upgrade', function() {\n const klass = customElements.get('pf-back-to-top');\n expect(element)\n .to.be.an.instanceOf(klass)\n .and\n .to.be.an.instanceOf(PfBackToTop);\n });\n });\n\n describe('when rendered in a viewport with a height smaller then content length', function() {\n let element: PfBackToTop;\n let snapshot: A11yTreeSnapshot;\n\n beforeEach(async function() {\n await setViewport({ width: 320, height: 640 });\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top href=\"#top\">Back to top</pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n snapshot = await a11ySnapshot();\n\n await allUpdates(element);\n });\n\n it('should be hidden on init', function() {\n const { children } = snapshot;\n expect(children).to.be.undefined;\n });\n\n it('should not be accessible', function() {\n expect(snapshot.children).to.be.undefined;\n });\n\n describe('when scrolled 401px', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should be visible', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);\n });\n\n it('should be accessible', async function() {\n await expect(element).to.be.accessible();\n });\n\n describe('pressing the tab key', function() {\n beforeEach(async function() {\n await sendKeys({ press: 'Tab' });\n await allUpdates(element);\n await nextFrame();\n });\n\n it('should focus the component', function() {\n expect(document.activeElement).to.equal(element);\n });\n });\n });\n\n describe('when the always visible property is true', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n element.alwaysVisible = true;\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should be visible', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);\n });\n\n it('should be accessible', async function() {\n await expect(element).to.be.accessible();\n });\n\n describe('pressing the tab key', function() {\n beforeEach(async function() {\n await sendKeys({ press: 'Tab' });\n await allUpdates(element);\n await nextFrame();\n });\n it('should focus the component', function() {\n expect(document.activeElement).to.equal(element);\n });\n });\n });\n\n describe('when the scroll distance is set to 1000', function() {\n beforeEach(async function() {\n element.scrollDistance = 1000;\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should be hidden', function() {\n const { children } = snapshot;\n expect(children).to.be.undefined;\n });\n\n describe('when scrolled 1001px', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 1001, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should be visible', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);\n });\n });\n });\n });\n\n describe('when rendered in an element with an overflowed height', function() {\n let element: PfBackToTop;\n let snapshot: A11yTreeSnapshot;\n\n beforeEach(async function() {\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\" style=\"height: 500px; overflow-y: scroll;\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top href=\"#top\" scrollable-selector=\"#top\">Back to top</pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n snapshot = await a11ySnapshot();\n\n await allUpdates(element);\n });\n\n it('should be hidden on init', function() {\n const { children } = snapshot;\n expect(children).to.be.undefined;\n });\n\n describe('when scrolled 401px', function() {\n beforeEach(async function() {\n const scrollableElement = document.querySelector('#top')!;\n scrollableElement.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should be visible', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);\n });\n });\n });\n\n describe('when no text is provided', function() {\n let element: PfBackToTop;\n let snapshot: A11yTreeSnapshot;\n\n describe('as a link', function() {\n beforeEach(async function() {\n await setViewport({ width: 320, height: 640 });\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top href=\"#top\"></pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n await allUpdates(element);\n });\n\n describe('when scrolled', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should have a label of \"Back to top\"', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);\n });\n });\n });\n\n describe('as a button', function() {\n beforeEach(async function() {\n await setViewport({ width: 320, height: 640 });\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top></pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n await allUpdates(element);\n });\n\n describe('when scrolled', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should have a label of \"Back to top\"', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Back to top' }]);\n });\n });\n });\n });\n\n describe('when a label is provided', function() {\n let element: PfBackToTop;\n let snapshot: A11yTreeSnapshot;\n\n describe('as a link', function() {\n beforeEach(async function() {\n await setViewport({ width: 320, height: 640 });\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top href=\"#top\" label=\"Return to top\"></pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n await allUpdates(element);\n });\n\n describe('when scrolled', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should have a label of \"Return to top\"', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Return to top' }]);\n });\n });\n });\n\n describe('as a button', function() {\n beforeEach(async function() {\n await setViewport({ width: 320, height: 640 });\n window.scrollTo({ top: 0, behavior: 'instant' });\n await nextFrame();\n const container = await createFixture<PfBackToTop>(html`\n <div id=\"top\">\n <div style=\"height: 2000px;\"></div>\n <pf-back-to-top label=\"Return to top\"></pf-back-to-top>\n </div>\n `);\n element = container.querySelector('pf-back-to-top')!;\n await allUpdates(element);\n });\n\n describe('when scrolled', function() {\n beforeEach(async function() {\n window.scrollTo({ top: 401, behavior: 'instant' });\n await nextFrame();\n await allUpdates(element);\n snapshot = await a11ySnapshot();\n });\n\n it('should have a label of \"Return to top\"', function() {\n expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Return to top' }]);\n });\n });\n });\n });\n});\n"]}
@@ -2,9 +2,7 @@ import { LitElement } from 'lit';
2
2
  /**
3
3
  * A **background image** allows you to place an image in the background of your page or area of a page.
4
4
  * @summary Allows users to place an image in the background of your page or area of a page.
5
- *
6
5
  * @slot filter - Overrides the default svg filter for the background image.
7
- *
8
6
  * @cssprop {<color>} --pf-c-background-image--BackgroundColor {@default `#151515`}
9
7
  * @cssprop --pf-c-background-image--BackgroundImage
10
8
  * @cssprop --pf-c-background-image--BackgroundImage-2x
@@ -12,7 +10,6 @@ import { LitElement } from 'lit';
12
10
  * @cssprop --pf-c-background-image--BackgroundImage--sm-2x
13
11
  * @cssprop --pf-c-background-image--BackgroundImage--lg
14
12
  * @cssprop --pf-c-background-image--Filter {@default `url("#image_overlay")`}
15
- *
16
13
  */
17
14
  export declare class PfBackgroundImage extends LitElement {
18
15
  #private;
@@ -42,7 +39,7 @@ export declare class PfBackgroundImage extends LitElement {
42
39
  */
43
40
  filter: boolean;
44
41
  private _svg?;
45
- render(): import("lit").TemplateResult<1>;
42
+ render(): import("lit-html").TemplateResult<1>;
46
43
  }
47
44
  declare global {
48
45
  interface HTMLElementTagNameMap {
@@ -10,9 +10,7 @@ const styles = css `:host {\n display: flex;\n\n --_background-image: var(--pf
10
10
  /**
11
11
  * A **background image** allows you to place an image in the background of your page or area of a page.
12
12
  * @summary Allows users to place an image in the background of your page or area of a page.
13
- *
14
13
  * @slot filter - Overrides the default svg filter for the background image.
15
- *
16
14
  * @cssprop {<color>} --pf-c-background-image--BackgroundColor {@default `#151515`}
17
15
  * @cssprop --pf-c-background-image--BackgroundImage
18
16
  * @cssprop --pf-c-background-image--BackgroundImage-2x
@@ -20,7 +18,6 @@ const styles = css `:host {\n display: flex;\n\n --_background-image: var(--pf
20
18
  * @cssprop --pf-c-background-image--BackgroundImage--sm-2x
21
19
  * @cssprop --pf-c-background-image--BackgroundImage--lg
22
20
  * @cssprop --pf-c-background-image--Filter {@default `url("#image_overlay")`}
23
- *
24
21
  */
25
22
  let PfBackgroundImage = class PfBackgroundImage extends LitElement {
26
23
  constructor() {
@@ -39,7 +36,7 @@ let PfBackgroundImage = class PfBackgroundImage extends LitElement {
39
36
  '--_background-image-2x': this.src2x,
40
37
  '--_background-image-sm': this.srcSm,
41
38
  '--_background-image-sm-2x': this.srcSm2x,
42
- '--_background-image-lg': this.srcLg
39
+ '--_background-image-lg': this.srcLg,
43
40
  };
44
41
  Object.entries(cssProps).forEach(([key, value]) => {
45
42
  // if the value is undefined, remove the css property
@@ -1 +1 @@
1
- {"version":3,"file":"pf-background-image.js","sourceRoot":"","sources":["pf-background-image.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAkB,MAAM,6BAA6B,CAAC;;;AAIvE;;;;;;;;;;;;;;GAcG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;;QA4BL;;WAEG;QACyC,WAAM,GAAG,KAAK,CAAC;QAI3D,yCAAkB;QAElB,qCAAW,KAAK,EAAC;IAsDnB,CAAC;IApDC,MAAM;QACJ,MAAM,QAAQ,GAAG;YACf,qBAAqB,EAAE,IAAI,CAAC,GAAG;YAC/B,wBAAwB,EAAE,IAAI,CAAC,KAAK;YACpC,wBAAwB,EAAE,IAAI,CAAC,KAAK;YACpC,2BAA2B,EAAE,IAAI,CAAC,OAAO;YACzC,wBAAwB,EAAE,IAAI,CAAC,KAAK;SACxB,CAAC;QAEf,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAChD,qDAAqD;YACrD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACN,uDAAuD;gBACvD,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,GAAG,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;QAE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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAgB;AAES;IAAnE,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;+CAA6B;AAjC7E,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA2F7B","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { property } from 'lit/decorators/property.js';\n\n\nimport { styleMap, type StyleInfo } from 'lit/directives/style-map.js';\n\nimport styles from './pf-background-image.css';\n\n/**\n * A **background image** allows you to place an image in the background of your page or area of a page.\n * @summary Allows users to place an image in the background of your page or area of a page.\n *\n * @slot filter - Overrides the default svg filter for the background image.\n *\n * @cssprop {<color>} --pf-c-background-image--BackgroundColor {@default `#151515`}\n * @cssprop --pf-c-background-image--BackgroundImage\n * @cssprop --pf-c-background-image--BackgroundImage-2x\n * @cssprop --pf-c-background-image--BackgroundImage--sm\n * @cssprop --pf-c-background-image--BackgroundImage--sm-2x\n * @cssprop --pf-c-background-image--BackgroundImage--lg\n * @cssprop --pf-c-background-image--Filter {@default `url(\"#image_overlay\")`}\n *\n */\n@customElement('pf-background-image')\nexport class PfBackgroundImage extends LitElement {\n static readonly styles = [styles];\n\n /**\n * The URL for the image shown on mobile\n */\n @property({ reflect: true }) src?: string;\n\n /**\n * The image shown on mobile with 2x DPI\n */\n @property({ reflect: true, attribute: 'src-2x' }) src2x?: string;\n\n /**\n * The URL for the image shown on small screens (min-width: 576px)\n */\n @property({ reflect: true, attribute: 'src-sm' }) srcSm?: string;\n\n /**\n * The URL for the image shown on small screens (min-width: 576px) with 2x DPI\n */\n @property({ reflect: true, attribute: 'src-sm-2x' }) srcSm2x?: string;\n\n /**\n * The URL for the image shown on large screens (min-width: 992px)\n */\n @property({ reflect: true, attribute: 'src-lg' }) srcLg?: string;\n\n /**\n * Apply SVG Filter to the image\n */\n @property({ type: Boolean, reflect: true }) filter = false;\n\n @queryAssignedElements({ slot: 'filter', selector: 'svg' }) private _svg?: SVGElement[];\n\n #svg?: SVGElement;\n\n #updated = false;\n\n render() {\n const cssProps = {\n '--_background-image': this.src,\n '--_background-image-2x': this.src2x,\n '--_background-image-sm': this.srcSm,\n '--_background-image-sm-2x': this.srcSm2x,\n '--_background-image-lg': this.srcLg\n } as StyleInfo;\n\n Object.entries(cssProps).forEach(([key, value]) => {\n // if the value is undefined, remove the css property\n if (!value) {\n delete cssProps[key];\n } else {\n // otherwise, add the value with the url() css function\n cssProps[key] = `url(${value})`;\n }\n });\n\n return html`\n <div id=\"container\" part=\"container\" style=\"${styleMap(cssProps)}\">\n ${!this.filter ? html`` : html`\n <slot name=\"filter\" @slotchange=${this.#onSlotChange}>\n ${(this.#svg && this.#updated) ? this.#svg : html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"0\" height=\"0\">\n <filter id=\"image_overlay\">\n <feColorMatrix type=\"matrix\" values=\"1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0\"></feColorMatrix>\n <feComponentTransfer color-interpolation-filters=\"sRGB\" result=\"duotone\">\n <feFuncR type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncR>\n <feFuncG type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncG>\n <feFuncB type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncB>\n <feFuncA type=\"table\" tableValues=\"0 1\"></feFuncA>\n </feComponentTransfer>\n </filter>\n </svg>\n `}\n </slot>\n `}\n </div>\n `;\n }\n\n #onSlotChange() {\n const [svg] = this._svg as Array<SVGElement>;\n if (svg) {\n this.#svg = svg;\n this.#updated = true;\n this.requestUpdate();\n } else {\n this.#updated = false;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-background-image': PfBackgroundImage;\n }\n}\n"]}
1
+ {"version":3,"file":"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AE,CAAC;+CAA6B;AAjC7E,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA2F7B","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { property } from 'lit/decorators/property.js';\n\n\nimport { styleMap, type StyleInfo } from 'lit/directives/style-map.js';\n\nimport styles from './pf-background-image.css';\n\n/**\n * A **background image** allows you to place an image in the background of your page or area of a page.\n * @summary Allows users to place an image in the background of your page or area of a page.\n * @slot filter - Overrides the default svg filter for the background image.\n * @cssprop {<color>} --pf-c-background-image--BackgroundColor {@default `#151515`}\n * @cssprop --pf-c-background-image--BackgroundImage\n * @cssprop --pf-c-background-image--BackgroundImage-2x\n * @cssprop --pf-c-background-image--BackgroundImage--sm\n * @cssprop --pf-c-background-image--BackgroundImage--sm-2x\n * @cssprop --pf-c-background-image--BackgroundImage--lg\n * @cssprop --pf-c-background-image--Filter {@default `url(\"#image_overlay\")`}\n */\n@customElement('pf-background-image')\nexport class PfBackgroundImage extends LitElement {\n static readonly styles = [styles];\n\n /**\n * The URL for the image shown on mobile\n */\n @property({ reflect: true }) src?: string;\n\n /**\n * The image shown on mobile with 2x DPI\n */\n @property({ reflect: true, attribute: 'src-2x' }) src2x?: string;\n\n /**\n * The URL for the image shown on small screens (min-width: 576px)\n */\n @property({ reflect: true, attribute: 'src-sm' }) srcSm?: string;\n\n /**\n * The URL for the image shown on small screens (min-width: 576px) with 2x DPI\n */\n @property({ reflect: true, attribute: 'src-sm-2x' }) srcSm2x?: string;\n\n /**\n * The URL for the image shown on large screens (min-width: 992px)\n */\n @property({ reflect: true, attribute: 'src-lg' }) srcLg?: string;\n\n /**\n * Apply SVG Filter to the image\n */\n @property({ type: Boolean, reflect: true }) filter = false;\n\n @queryAssignedElements({ slot: 'filter', selector: 'svg' }) private _svg?: SVGElement[];\n\n #svg?: SVGElement;\n\n #updated = false;\n\n render() {\n const cssProps = {\n '--_background-image': this.src,\n '--_background-image-2x': this.src2x,\n '--_background-image-sm': this.srcSm,\n '--_background-image-sm-2x': this.srcSm2x,\n '--_background-image-lg': this.srcLg,\n } as StyleInfo;\n\n Object.entries(cssProps).forEach(([key, value]) => {\n // if the value is undefined, remove the css property\n if (!value) {\n delete cssProps[key];\n } else {\n // otherwise, add the value with the url() css function\n cssProps[key] = `url(${value})`;\n }\n });\n\n return html`\n <div id=\"container\" part=\"container\" style=\"${styleMap(cssProps)}\">\n ${!this.filter ? html`` : html`\n <slot name=\"filter\" @slotchange=${this.#onSlotChange}>\n ${(this.#svg && this.#updated) ? this.#svg : html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"0\" height=\"0\">\n <filter id=\"image_overlay\">\n <feColorMatrix type=\"matrix\" values=\"1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0\"></feColorMatrix>\n <feComponentTransfer color-interpolation-filters=\"sRGB\" result=\"duotone\">\n <feFuncR type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncR>\n <feFuncG type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncG>\n <feFuncB type=\"table\" tableValues=\"0.086274509803922 0.43921568627451\"></feFuncB>\n <feFuncA type=\"table\" tableValues=\"0 1\"></feFuncA>\n </feComponentTransfer>\n </filter>\n </svg>\n `}\n </slot>\n `}\n </div>\n `;\n }\n\n #onSlotChange() {\n const [svg] = this._svg as SVGElement[];\n if (svg) {\n this.#svg = svg;\n this.#updated = true;\n this.requestUpdate();\n } else {\n this.#updated = false;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-background-image': PfBackgroundImage;\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { test } from '@playwright/test';
2
+ import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
3
+ const tagName = 'pf-background-image';
4
+ test.describe(tagName, () => {
5
+ test('snapshot', async ({ page }) => {
6
+ const componentPage = new PfeDemoPage(page, tagName);
7
+ await componentPage.navigate();
8
+ await componentPage.snapshot();
9
+ });
10
+ });
11
+ //# sourceMappingURL=pf-background-image.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pf-background-image.e2e.js","sourceRoot":"","sources":["pf-background-image.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAEnF,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\n\nconst tagName = 'pf-background-image';\n\ntest.describe(tagName, () => {\n test('snapshot', async ({ page }) => {\n const componentPage = new PfeDemoPage(page, tagName);\n await componentPage.navigate();\n await componentPage.snapshot();\n });\n});\n"]}
@@ -0,0 +1,89 @@
1
+ import { expect, html } from '@open-wc/testing';
2
+ import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
3
+ import { PfBackgroundImage } from '@patternfly/elements/pf-background-image/pf-background-image.js';
4
+ import { setViewport } from '@web/test-runner-commands';
5
+ const example = html `
6
+ <pf-background-image filter
7
+ src="/components/background-image/demo/pfbg.jpg"
8
+ src-2x="/components/background-image/demo/pfbg_576.jpg"
9
+ src-sm="/components/background-image/demo/pfbg_768.jpg"
10
+ src-sm-2x="/components/background-image/demo/pfbg_768@2x.jpg"
11
+ src-lg="/components/background-image/demo/pfbg_1200.jpg"
12
+ >
13
+ </pf-background-image>
14
+ `;
15
+ function isMobile() {
16
+ const matches = !!window.matchMedia('(max-width: 575px)').matches;
17
+ return matches;
18
+ }
19
+ function isTablet() {
20
+ const matches = !!window.matchMedia('(min-width: 576px)').matches;
21
+ return matches;
22
+ }
23
+ function isDesktop() {
24
+ const matches = !!window.matchMedia('(min-width: 992px)').matches;
25
+ return matches;
26
+ }
27
+ describe('<pf-background-image>', function () {
28
+ describe('simply instantiating', function () {
29
+ let element;
30
+ it('imperatively instantiates', function () {
31
+ expect(document.createElement('pf-background-image')).to.be.an.instanceof(PfBackgroundImage);
32
+ });
33
+ it('should upgrade', async function () {
34
+ element = await createFixture(html `<pf-background-image></pf-background-image>`);
35
+ const klass = customElements.get('pf-background-image');
36
+ expect(element)
37
+ .to.be.an.instanceOf(klass)
38
+ .and
39
+ .to.be.an.instanceOf(PfBackgroundImage);
40
+ });
41
+ describe('adjusting window size', function () {
42
+ describe('when the window is less than 576px wide', function () {
43
+ beforeEach(async function () {
44
+ await setViewport({ width: 320, height: 500 });
45
+ await element.updateComplete;
46
+ expect(isMobile()).to.be.true;
47
+ });
48
+ it('should background image', async function () {
49
+ const element = await createFixture(example);
50
+ await element.updateComplete;
51
+ const container = element.shadowRoot.querySelector('#container');
52
+ const afterStyles = getComputedStyle(container, '::after');
53
+ expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg.jpg');
54
+ });
55
+ });
56
+ });
57
+ describe('when the window is less greater then 576px wide', function () {
58
+ beforeEach(async function () {
59
+ await setViewport({ width: 576, height: 500 });
60
+ await element.updateComplete;
61
+ expect(isTablet()).to.be.true;
62
+ });
63
+ it('should background image', async function () {
64
+ const element = await createFixture(example);
65
+ await element.updateComplete;
66
+ const container = element.shadowRoot.querySelector('#container');
67
+ const afterStyles = getComputedStyle(container, '::after');
68
+ /* the image sizes are not named based off viewport but their own intrinsic size */
69
+ expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg_768.jpg');
70
+ });
71
+ });
72
+ describe('when the window is less greater then 992px wide', function () {
73
+ beforeEach(async function () {
74
+ await setViewport({ width: 992, height: 500 });
75
+ await element.updateComplete;
76
+ expect(isDesktop()).to.be.true;
77
+ });
78
+ it('should background image', async function () {
79
+ const element = await createFixture(example);
80
+ await element.updateComplete;
81
+ const container = element.shadowRoot.querySelector('#container');
82
+ const afterStyles = getComputedStyle(container, '::after');
83
+ /* the image sizes are not named based off viewport but their own intrinsic size */
84
+ expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg_1200.jpg');
85
+ });
86
+ });
87
+ });
88
+ });
89
+ //# sourceMappingURL=pf-background-image.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pf-background-image.spec.js","sourceRoot":"","sources":["pf-background-image.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,OAAO,GAAG,IAAI,CAAA;;;;;;;;;CASnB,CAAC;AAEF,SAAS,QAAQ;IACf,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;IAClE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;IAClE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,SAAS;IAChB,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,UA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CAAC,CAAC;gBAC/C,MAAM,OAAO,CAAC,cAAc,CAAC;gBAC7B,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YACjC,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK;gBACjC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAoB,OAAO,CAAC,CAAC;gBAChE,MAAM,OAAO,CAAC,cAAc,CAAC;gBAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,UAAW,CAAC,aAAa,CAAC,YAAY,CAAE,CAAC;gBACnE,MAAM,WAAW,GAAG,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBAC3D,mFAAmF;gBACnF,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC;YACzH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, html } from '@open-wc/testing';\nimport { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';\nimport { PfBackgroundImage } from '@patternfly/elements/pf-background-image/pf-background-image.js';\nimport { setViewport } from '@web/test-runner-commands';\n\nconst example = html`\n <pf-background-image filter\n src=\"/components/background-image/demo/pfbg.jpg\"\n src-2x=\"/components/background-image/demo/pfbg_576.jpg\"\n src-sm=\"/components/background-image/demo/pfbg_768.jpg\"\n src-sm-2x=\"/components/background-image/demo/pfbg_768@2x.jpg\"\n src-lg=\"/components/background-image/demo/pfbg_1200.jpg\"\n >\n </pf-background-image>\n`;\n\nfunction isMobile() {\n const matches = !!window.matchMedia('(max-width: 575px)').matches;\n return matches;\n}\n\nfunction isTablet() {\n const matches = !!window.matchMedia('(min-width: 576px)').matches;\n return matches;\n}\n\nfunction isDesktop() {\n const matches = !!window.matchMedia('(min-width: 992px)').matches;\n return matches;\n}\n\ndescribe('<pf-background-image>', function() {\n describe('simply instantiating', function() {\n let element: PfBackgroundImage;\n\n it('imperatively instantiates', function() {\n expect(document.createElement('pf-background-image')).to.be.an.instanceof(PfBackgroundImage);\n });\n\n it('should upgrade', async function() {\n element = await createFixture<PfBackgroundImage>(html`<pf-background-image></pf-background-image>`);\n const klass = customElements.get('pf-background-image');\n expect(element)\n .to.be.an.instanceOf(klass)\n .and\n .to.be.an.instanceOf(PfBackgroundImage);\n });\n\n describe('adjusting window size', function() {\n describe('when the window is less than 576px wide', function() {\n beforeEach(async function() {\n await setViewport({ width: 320, height: 500 });\n await element.updateComplete;\n expect(isMobile()).to.be.true;\n });\n\n it('should background image', async function() {\n const element = await createFixture<PfBackgroundImage>(example);\n await element.updateComplete;\n const container = element.shadowRoot!.querySelector('#container')!;\n const afterStyles = getComputedStyle(container, '::after');\n expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg.jpg');\n });\n });\n });\n\n describe('when the window is less greater then 576px wide', function() {\n beforeEach(async function() {\n await setViewport({ width: 576, height: 500 });\n await element.updateComplete;\n expect(isTablet()).to.be.true;\n });\n\n it('should background image', async function() {\n const element = await createFixture<PfBackgroundImage>(example);\n await element.updateComplete;\n const container = element.shadowRoot!.querySelector('#container')!;\n const afterStyles = getComputedStyle(container, '::after');\n /* the image sizes are not named based off viewport but their own intrinsic size */\n expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg_768.jpg');\n });\n });\n\n describe('when the window is less greater then 992px wide', function() {\n beforeEach(async function() {\n await setViewport({ width: 992, height: 500 });\n await element.updateComplete;\n expect(isDesktop()).to.be.true;\n });\n\n it('should background image', async function() {\n const element = await createFixture<PfBackgroundImage>(example);\n await element.updateComplete;\n const container = element.shadowRoot!.querySelector('#container')!;\n const afterStyles = getComputedStyle(container, '::after');\n /* the image sizes are not named based off viewport but their own intrinsic size */\n expect(afterStyles.getPropertyValue('background-image')).to.contain('/components/background-image/demo/pfbg_1200.jpg');\n });\n });\n });\n});\n\n"]}
@@ -14,5 +14,5 @@ export declare abstract class BaseBadge extends LitElement {
14
14
  * the numeric value exceeds the threshold value.
15
15
  */
16
16
  abstract threshold?: number;
17
- render(): import("lit").TemplateResult<1>;
17
+ render(): import("lit-html").TemplateResult<1>;
18
18
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { test } from '@playwright/test';
2
+ import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
3
+ const tagName = 'pf-badge';
4
+ test.describe(tagName, () => {
5
+ test('snapshot', async ({ page }) => {
6
+ const componentPage = new PfeDemoPage(page, tagName);
7
+ await componentPage.navigate();
8
+ await componentPage.snapshot();
9
+ });
10
+ });
11
+ //# sourceMappingURL=pf-badge.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pf-badge.e2e.js","sourceRoot":"","sources":["pf-badge.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAEnF,MAAM,OAAO,GAAG,UAAU,CAAC;AAE3B,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\n\nconst tagName = 'pf-badge';\n\ntest.describe(tagName, () => {\n test('snapshot', async ({ page }) => {\n const componentPage = new PfeDemoPage(page, tagName);\n await componentPage.navigate();\n await componentPage.snapshot();\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import { expect, html, nextFrame } from '@open-wc/testing';
2
+ import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
3
+ import { hexToRgb, getColor } from '@patternfly/pfe-tools/test/hex-to-rgb.js';
4
+ import { PfBadge } from '@patternfly/elements/pf-badge/pf-badge.js';
5
+ // Background colors for the various states
6
+ const states = {
7
+ default: '#f0f0f0',
8
+ read: '#f0f0f0',
9
+ unread: '#0066cc',
10
+ };
11
+ const element = html `<pf-badge number="10">10</pf-badge>`;
12
+ describe('<pf-badge>', function () {
13
+ it('imperatively instantiates', function () {
14
+ expect(document.createElement('pf-badge')).to.be.an.instanceof(PfBadge);
15
+ });
16
+ it('should upgrade', async function () {
17
+ const el = await createFixture(element);
18
+ expect(el, 'pf-badge should be an instance of PfBadge')
19
+ .to.be.an
20
+ .instanceOf(customElements.get('pf-badge'))
21
+ .and
22
+ .to.be.an.instanceof(PfBadge);
23
+ });
24
+ it('should display text equivalent to the number attribute', async function () {
25
+ const el = await createFixture(html `<pf-badge number="100">10</pf-badge>`);
26
+ await nextFrame();
27
+ expect(el.shadowRoot.querySelector('span').textContent).to.equal('100');
28
+ });
29
+ it('should add \'+\' sign if the value exceeds the threshold', async function () {
30
+ const el = await createFixture(html `<pf-badge number="900" threshold="100">900</pf-badge>`);
31
+ await nextFrame();
32
+ expect(el.shadowRoot.querySelector('span').textContent).to.equal('100+');
33
+ });
34
+ it('shouldn\'t add a \'+\' sign if the value doesn\'t exceed the threshold', async function () {
35
+ const el = await createFixture(html `<pf-badge number="900" threshold="1000">900</pf-badge>`);
36
+ await el.updateComplete;
37
+ expect(el.textContent).to.equal('900');
38
+ expect(el.shadowRoot.querySelector('span').textContent).to.equal('900');
39
+ });
40
+ // This is the one that created an error:
41
+ Object.entries(states).forEach(([state, color]) => {
42
+ it(`should have a background color of '${color}' when state is ${state}`, async function () {
43
+ const el = await createFixture(element);
44
+ if (state !== 'default') {
45
+ el.setAttribute('state', state);
46
+ }
47
+ const [r, g, b] = getColor(el, 'background-color');
48
+ expect([r, g, b]).to.deep.equal(hexToRgb(color));
49
+ });
50
+ });
51
+ });
52
+ //# sourceMappingURL=pf-badge.spec.js.map