@noctuatech/uswds 1.3.2 → 1.3.4

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 (299) hide show
  1. package/package.json +5 -5
  2. package/src/lib/accordion/{accordion.test.ts → accordion.element.test.ts} +28 -31
  3. package/src/lib/accordion/accordion.element.ts +9 -7
  4. package/src/lib/alert/{alert.test.ts → alert.element.test.ts} +5 -6
  5. package/src/lib/alert/alert.element.ts +6 -4
  6. package/src/lib/breadcrumbs/breadcrumb/breadcrumb.element.ts +10 -10
  7. package/src/lib/breadcrumbs/breadcrumbs.element.test.ts +23 -0
  8. package/src/lib/button/button.element.test.ts +15 -0
  9. package/src/lib/button/button.element.ts +37 -42
  10. package/src/lib/button-group/button-group.element.test.ts +13 -0
  11. package/src/lib/card/{card.test.ts → card.element.test.ts} +12 -12
  12. package/src/lib/checkbox/{checkbox.test.ts → checkbox.element.test.ts} +15 -17
  13. package/src/lib/checkbox/checkbox.element.ts +28 -32
  14. package/src/lib/checkbox/checkbox.stories.ts +17 -33
  15. package/src/lib/collection/collection-item/collection-item.element.test.ts +15 -0
  16. package/src/lib/collection/collection.element.test.ts +13 -0
  17. package/src/lib/combo-box/{combo-box.test.ts → combo-box.element.test.ts} +64 -93
  18. package/src/lib/config/config.element.test.ts +13 -0
  19. package/src/lib/description/description.element.test.ts +13 -0
  20. package/src/lib/file-input/file-input-preview/file-input-preview.element.test.ts +93 -0
  21. package/src/lib/file-input/file-input-preview/file-input-preview.element.ts +15 -13
  22. package/src/lib/file-input/file-input.element.test.ts +73 -0
  23. package/src/lib/file-input/file-input.element.ts +10 -20
  24. package/src/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.ts +20 -20
  25. package/src/lib/in-page-nav/{in-page-nav.test.ts → in-page-nav.element.test.ts} +18 -21
  26. package/src/lib/input/{input.test.ts → input.element.test.ts} +11 -0
  27. package/src/lib/input/input.element.ts +57 -41
  28. package/src/lib/input-mask/input-mask.element.ts +1 -1
  29. package/src/lib/input-mask/input-mask.stories.ts +2 -0
  30. package/src/lib/link/link.element.ts +18 -25
  31. package/src/lib/modal/modal-close/modal-close.element.test.ts +13 -0
  32. package/src/lib/modal/modal-heading/modal-heading.element.test.ts +15 -0
  33. package/src/lib/modal/modal.element.test.ts +23 -0
  34. package/src/lib/pagination/pagination-item/pagination-item.element.ts +9 -6
  35. package/src/lib/pagination/pagination-no/pagination-no.element.ts +17 -17
  36. package/src/lib/pagination/pagination.element.test.ts +13 -0
  37. package/src/lib/process-list/{process-list.test.ts → process-list.element.test.ts} +19 -12
  38. package/src/lib/radio/radio-option/radio-option.element.test.ts +20 -0
  39. package/src/lib/radio/radio.element.test.ts +121 -0
  40. package/src/lib/range-slider/range-slider.element.test.ts +57 -0
  41. package/src/lib/range-slider/range-slider.element.ts +48 -33
  42. package/src/lib/search/search.element.test.ts +71 -0
  43. package/src/lib/select/{select.test.ts → select.element.test.ts} +23 -26
  44. package/src/lib/select/select.element.ts +31 -32
  45. package/src/lib/side-nav/{side-nav.test.ts → side-nav.element.test.ts} +13 -23
  46. package/src/lib/step-indicator/step/step.element.ts +16 -16
  47. package/src/lib/step-indicator/{step-indicator.test.ts → step-indicator.element.test.ts} +6 -6
  48. package/src/lib/summary-box/summary-box.element.test.ts +13 -0
  49. package/src/lib/tag/tag.element.test.ts +13 -0
  50. package/src/lib/textarea/{textarea.test.ts → textarea.element.test.ts} +13 -13
  51. package/src/lib/textarea/textarea.element.ts +23 -24
  52. package/target/lib/accordion/accordion.element.js +4 -2
  53. package/target/lib/accordion/accordion.element.js.map +1 -1
  54. package/target/lib/accordion/accordion.element.test.d.ts +1 -0
  55. package/target/lib/accordion/{accordion.test.js → accordion.element.test.js} +19 -19
  56. package/target/lib/accordion/accordion.element.test.js.map +1 -0
  57. package/target/lib/alert/alert.element.js +4 -2
  58. package/target/lib/alert/alert.element.js.map +1 -1
  59. package/target/lib/alert/alert.element.test.d.ts +1 -0
  60. package/target/lib/alert/{alert.test.js → alert.element.test.js} +5 -5
  61. package/target/lib/alert/alert.element.test.js.map +1 -0
  62. package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.d.ts +1 -1
  63. package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js +6 -6
  64. package/target/lib/breadcrumbs/breadcrumbs.element.test.d.ts +2 -0
  65. package/target/lib/breadcrumbs/{breadcrumbs.test.js → breadcrumbs.element.test.js} +6 -6
  66. package/target/lib/breadcrumbs/breadcrumbs.element.test.js.map +1 -0
  67. package/target/lib/button/button.element.d.ts +3 -3
  68. package/target/lib/button/button.element.js +17 -23
  69. package/target/lib/button/button.element.js.map +1 -1
  70. package/target/lib/button/button.element.test.d.ts +1 -0
  71. package/target/lib/button/button.element.test.js +12 -0
  72. package/target/lib/button/button.element.test.js.map +1 -0
  73. package/target/lib/button-group/button-group.element.test.d.ts +1 -0
  74. package/target/lib/button-group/button-group.element.test.js +9 -0
  75. package/target/lib/button-group/button-group.element.test.js.map +1 -0
  76. package/target/lib/card/card.element.test.d.ts +6 -0
  77. package/target/lib/card/{card.test.js → card.element.test.js} +10 -10
  78. package/target/lib/card/card.element.test.js.map +1 -0
  79. package/target/lib/checkbox/checkbox.element.d.ts +3 -2
  80. package/target/lib/checkbox/checkbox.element.js +21 -22
  81. package/target/lib/checkbox/checkbox.element.js.map +1 -1
  82. package/target/lib/checkbox/checkbox.element.test.d.ts +1 -0
  83. package/target/lib/checkbox/{checkbox.test.js → checkbox.element.test.js} +13 -12
  84. package/target/lib/checkbox/checkbox.element.test.js.map +1 -0
  85. package/target/lib/checkbox/checkbox.stories.d.ts +2 -2
  86. package/target/lib/checkbox/checkbox.stories.js +6 -6
  87. package/target/lib/checkbox/checkbox.stories.js.map +1 -1
  88. package/target/lib/collection/collection-item/collection-item.element.test.d.ts +1 -0
  89. package/target/lib/collection/collection-item/collection-item.element.test.js +9 -0
  90. package/target/lib/collection/collection-item/collection-item.element.test.js.map +1 -0
  91. package/target/lib/collection/collection.element.test.d.ts +1 -0
  92. package/target/lib/collection/collection.element.test.js +9 -0
  93. package/target/lib/collection/collection.element.test.js.map +1 -0
  94. package/target/lib/combo-box/combo-box.element.test.d.ts +3 -0
  95. package/target/lib/combo-box/{combo-box.test.js → combo-box.element.test.js} +60 -60
  96. package/target/lib/combo-box/combo-box.element.test.js.map +1 -0
  97. package/target/lib/config/config.element.test.d.ts +1 -0
  98. package/target/lib/config/config.element.test.js +9 -0
  99. package/target/lib/config/config.element.test.js.map +1 -0
  100. package/target/lib/description/description.element.test.d.ts +1 -0
  101. package/target/lib/description/description.element.test.js +9 -0
  102. package/target/lib/description/description.element.test.js.map +1 -0
  103. package/target/lib/file-input/file-input-preview/file-input-preview.element.js +12 -10
  104. package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -1
  105. package/target/lib/file-input/file-input-preview/file-input-preview.element.test.d.ts +2 -0
  106. package/target/lib/file-input/file-input-preview/{file-input-preview.test.js → file-input-preview.element.test.js} +24 -24
  107. package/target/lib/file-input/file-input-preview/file-input-preview.element.test.js.map +1 -0
  108. package/target/lib/file-input/file-input.element.js +5 -6
  109. package/target/lib/file-input/file-input.element.js.map +1 -1
  110. package/target/lib/file-input/file-input.element.test.d.ts +1 -0
  111. package/target/lib/file-input/{file-input.test.js → file-input.element.test.js} +16 -16
  112. package/target/lib/file-input/file-input.element.test.js.map +1 -0
  113. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.d.ts +2 -3
  114. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js +15 -13
  115. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js.map +1 -1
  116. package/target/lib/in-page-nav/in-page-nav.element.test.d.ts +2 -0
  117. package/target/lib/in-page-nav/{in-page-nav.test.js → in-page-nav.element.test.js} +6 -6
  118. package/target/lib/in-page-nav/in-page-nav.element.test.js.map +1 -0
  119. package/target/lib/input/input.element.d.ts +4 -5
  120. package/target/lib/input/input.element.js +54 -48
  121. package/target/lib/input/input.element.js.map +1 -1
  122. package/target/lib/input/{input.test.js → input.element.test.js} +6 -1
  123. package/target/lib/input/input.element.test.js.map +1 -0
  124. package/target/lib/input-mask/input-mask.element.d.ts +1 -1
  125. package/target/lib/input-mask/input-mask.element.js +1 -1
  126. package/target/lib/input-mask/input-mask.element.js.map +1 -1
  127. package/target/lib/input-mask/{input-mask.test.js → input-mask.element.test.js} +1 -1
  128. package/target/lib/input-mask/input-mask.element.test.js.map +1 -0
  129. package/target/lib/input-mask/input-mask.stories.js +1 -1
  130. package/target/lib/input-mask/input-mask.stories.js.map +1 -1
  131. package/target/lib/link/link.element.d.ts +3 -5
  132. package/target/lib/link/link.element.js +14 -26
  133. package/target/lib/link/link.element.js.map +1 -1
  134. package/target/lib/modal/modal-close/modal-close.element.test.d.ts +1 -0
  135. package/target/lib/modal/modal-close/modal-close.element.test.js +9 -0
  136. package/target/lib/modal/modal-close/modal-close.element.test.js.map +1 -0
  137. package/target/lib/modal/modal-heading/modal-heading.element.test.d.ts +1 -0
  138. package/target/lib/modal/modal-heading/modal-heading.element.test.js +9 -0
  139. package/target/lib/modal/modal-heading/modal-heading.element.test.js.map +1 -0
  140. package/target/lib/modal/modal.element.test.d.ts +3 -0
  141. package/target/lib/modal/modal.element.test.js +11 -0
  142. package/target/lib/modal/modal.element.test.js.map +1 -0
  143. package/target/lib/pagination/pagination-item/pagination-item.element.d.ts +1 -1
  144. package/target/lib/pagination/pagination-item/pagination-item.element.js +3 -3
  145. package/target/lib/pagination/pagination-item/pagination-item.element.js.map +1 -1
  146. package/target/lib/pagination/pagination-no/pagination-no.element.d.ts +2 -3
  147. package/target/lib/pagination/pagination-no/pagination-no.element.js +10 -8
  148. package/target/lib/pagination/pagination-no/pagination-no.element.js.map +1 -1
  149. package/target/lib/pagination/pagination.element.test.d.ts +1 -0
  150. package/target/lib/pagination/pagination.element.test.js +9 -0
  151. package/target/lib/pagination/pagination.element.test.js.map +1 -0
  152. package/target/lib/process-list/process-list.element.test.d.ts +2 -0
  153. package/target/lib/process-list/{process-list.test.js → process-list.element.test.js} +6 -6
  154. package/target/lib/process-list/process-list.element.test.js.map +1 -0
  155. package/target/lib/radio/radio-option/radio-option.element.test.d.ts +2 -0
  156. package/target/lib/radio/radio-option/radio-option.element.test.js +11 -0
  157. package/target/lib/radio/radio-option/radio-option.element.test.js.map +1 -0
  158. package/target/lib/radio/radio.element.test.d.ts +2 -0
  159. package/target/lib/radio/{radio.test.js → radio.element.test.js} +19 -28
  160. package/target/lib/radio/radio.element.test.js.map +1 -0
  161. package/target/lib/range-slider/range-slider.element.d.ts +4 -2
  162. package/target/lib/range-slider/range-slider.element.js +34 -29
  163. package/target/lib/range-slider/range-slider.element.js.map +1 -1
  164. package/target/lib/range-slider/range-slider.element.test.d.ts +1 -0
  165. package/target/lib/range-slider/range-slider.element.test.js +26 -0
  166. package/target/lib/range-slider/range-slider.element.test.js.map +1 -0
  167. package/target/lib/search/search.element.test.d.ts +3 -0
  168. package/target/lib/search/search.element.test.js +52 -0
  169. package/target/lib/search/search.element.test.js.map +1 -0
  170. package/target/lib/select/select.element.d.ts +4 -3
  171. package/target/lib/select/select.element.js +25 -26
  172. package/target/lib/select/select.element.js.map +1 -1
  173. package/target/lib/select/select.element.test.d.ts +2 -0
  174. package/target/lib/select/{select.test.js → select.element.test.js} +23 -27
  175. package/target/lib/select/select.element.test.js.map +1 -0
  176. package/target/lib/services/{icon.service.test.js → icon.service.element.test.js} +1 -1
  177. package/target/lib/services/icon.service.element.test.js.map +1 -0
  178. package/target/lib/side-nav/side-nav.element.test.d.ts +3 -0
  179. package/target/lib/side-nav/{side-nav.test.js → side-nav.element.test.js} +11 -11
  180. package/target/lib/side-nav/side-nav.element.test.js.map +1 -0
  181. package/target/lib/step-indicator/step/step.element.d.ts +2 -2
  182. package/target/lib/step-indicator/step/step.element.js +8 -8
  183. package/target/lib/step-indicator/step-indicator.element.test.d.ts +2 -0
  184. package/target/lib/step-indicator/{step-indicator.test.js → step-indicator.element.test.js} +6 -6
  185. package/target/lib/step-indicator/step-indicator.element.test.js.map +1 -0
  186. package/target/lib/summary-box/summary-box.element.test.d.ts +1 -0
  187. package/target/lib/summary-box/summary-box.element.test.js +9 -0
  188. package/target/lib/summary-box/summary-box.element.test.js.map +1 -0
  189. package/target/lib/tag/tag.element.test.d.ts +1 -0
  190. package/target/lib/tag/tag.element.test.js +9 -0
  191. package/target/lib/tag/tag.element.test.js.map +1 -0
  192. package/target/lib/textarea/textarea.element.d.ts +2 -2
  193. package/target/lib/textarea/textarea.element.js +19 -24
  194. package/target/lib/textarea/textarea.element.js.map +1 -1
  195. package/target/lib/textarea/textarea.element.test.d.ts +1 -0
  196. package/target/lib/textarea/{textarea.test.js → textarea.element.test.js} +14 -14
  197. package/target/lib/textarea/textarea.element.test.js.map +1 -0
  198. package/src/lib/breadcrumbs/breadcrumbs.test.ts +0 -21
  199. package/src/lib/button/button.test.ts +0 -17
  200. package/src/lib/button-group/button-group.test.ts +0 -15
  201. package/src/lib/collection/collection-item/collection-item.test.ts +0 -15
  202. package/src/lib/collection/collection.test.ts +0 -15
  203. package/src/lib/config/config.test.ts +0 -15
  204. package/src/lib/description/description.test.ts +0 -15
  205. package/src/lib/file-input/file-input-preview/file-input-preview.test.ts +0 -95
  206. package/src/lib/file-input/file-input.test.ts +0 -79
  207. package/src/lib/modal/modal-close/modal-close.test.ts +0 -15
  208. package/src/lib/modal/modal-heading/modal-heading.test.ts +0 -15
  209. package/src/lib/modal/modal.test.ts +0 -25
  210. package/src/lib/pagination/pagination.test.ts +0 -15
  211. package/src/lib/radio/radio-option/radio-option.test.ts +0 -20
  212. package/src/lib/radio/radio.test.ts +0 -174
  213. package/src/lib/range-slider/range-slider.test.ts +0 -52
  214. package/src/lib/search/search.test.ts +0 -81
  215. package/src/lib/summary-box/summary-box.test.ts +0 -15
  216. package/src/lib/tag/tag.test.ts +0 -15
  217. package/target/lib/accordion/accordion.test.d.ts +0 -1
  218. package/target/lib/accordion/accordion.test.js.map +0 -1
  219. package/target/lib/alert/alert.test.d.ts +0 -1
  220. package/target/lib/alert/alert.test.js.map +0 -1
  221. package/target/lib/breadcrumbs/breadcrumbs.test.d.ts +0 -2
  222. package/target/lib/breadcrumbs/breadcrumbs.test.js.map +0 -1
  223. package/target/lib/button/button.test.d.ts +0 -1
  224. package/target/lib/button/button.test.js +0 -12
  225. package/target/lib/button/button.test.js.map +0 -1
  226. package/target/lib/button-group/button-group.test.d.ts +0 -1
  227. package/target/lib/button-group/button-group.test.js +0 -9
  228. package/target/lib/button-group/button-group.test.js.map +0 -1
  229. package/target/lib/card/card.test.d.ts +0 -6
  230. package/target/lib/card/card.test.js.map +0 -1
  231. package/target/lib/checkbox/checkbox.test.d.ts +0 -1
  232. package/target/lib/checkbox/checkbox.test.js.map +0 -1
  233. package/target/lib/collection/collection-item/collection-item.test.d.ts +0 -1
  234. package/target/lib/collection/collection-item/collection-item.test.js +0 -9
  235. package/target/lib/collection/collection-item/collection-item.test.js.map +0 -1
  236. package/target/lib/collection/collection.test.d.ts +0 -1
  237. package/target/lib/collection/collection.test.js +0 -9
  238. package/target/lib/collection/collection.test.js.map +0 -1
  239. package/target/lib/combo-box/combo-box.test.d.ts +0 -3
  240. package/target/lib/combo-box/combo-box.test.js.map +0 -1
  241. package/target/lib/config/config.test.d.ts +0 -1
  242. package/target/lib/config/config.test.js +0 -9
  243. package/target/lib/config/config.test.js.map +0 -1
  244. package/target/lib/description/description.test.d.ts +0 -1
  245. package/target/lib/description/description.test.js +0 -9
  246. package/target/lib/description/description.test.js.map +0 -1
  247. package/target/lib/file-input/file-input-preview/file-input-preview.test.d.ts +0 -2
  248. package/target/lib/file-input/file-input-preview/file-input-preview.test.js.map +0 -1
  249. package/target/lib/file-input/file-input.test.d.ts +0 -1
  250. package/target/lib/file-input/file-input.test.js.map +0 -1
  251. package/target/lib/in-page-nav/in-page-nav.test.d.ts +0 -2
  252. package/target/lib/in-page-nav/in-page-nav.test.js.map +0 -1
  253. package/target/lib/input/input.test.js.map +0 -1
  254. package/target/lib/input-mask/input-mask.test.js.map +0 -1
  255. package/target/lib/modal/modal-close/modal-close.test.d.ts +0 -1
  256. package/target/lib/modal/modal-close/modal-close.test.js +0 -9
  257. package/target/lib/modal/modal-close/modal-close.test.js.map +0 -1
  258. package/target/lib/modal/modal-heading/modal-heading.test.d.ts +0 -1
  259. package/target/lib/modal/modal-heading/modal-heading.test.js +0 -9
  260. package/target/lib/modal/modal-heading/modal-heading.test.js.map +0 -1
  261. package/target/lib/modal/modal.test.d.ts +0 -3
  262. package/target/lib/modal/modal.test.js +0 -11
  263. package/target/lib/modal/modal.test.js.map +0 -1
  264. package/target/lib/pagination/pagination.test.d.ts +0 -1
  265. package/target/lib/pagination/pagination.test.js +0 -9
  266. package/target/lib/pagination/pagination.test.js.map +0 -1
  267. package/target/lib/process-list/process-list.test.d.ts +0 -2
  268. package/target/lib/process-list/process-list.test.js.map +0 -1
  269. package/target/lib/radio/radio-option/radio-option.test.d.ts +0 -2
  270. package/target/lib/radio/radio-option/radio-option.test.js +0 -11
  271. package/target/lib/radio/radio-option/radio-option.test.js.map +0 -1
  272. package/target/lib/radio/radio.test.d.ts +0 -2
  273. package/target/lib/radio/radio.test.js.map +0 -1
  274. package/target/lib/range-slider/range-slider.test.d.ts +0 -1
  275. package/target/lib/range-slider/range-slider.test.js +0 -25
  276. package/target/lib/range-slider/range-slider.test.js.map +0 -1
  277. package/target/lib/search/search.test.d.ts +0 -3
  278. package/target/lib/search/search.test.js +0 -52
  279. package/target/lib/search/search.test.js.map +0 -1
  280. package/target/lib/select/select.test.d.ts +0 -2
  281. package/target/lib/select/select.test.js.map +0 -1
  282. package/target/lib/services/icon.service.test.js.map +0 -1
  283. package/target/lib/side-nav/side-nav.test.d.ts +0 -3
  284. package/target/lib/side-nav/side-nav.test.js.map +0 -1
  285. package/target/lib/step-indicator/step-indicator.test.d.ts +0 -2
  286. package/target/lib/step-indicator/step-indicator.test.js.map +0 -1
  287. package/target/lib/summary-box/summary-box.test.d.ts +0 -1
  288. package/target/lib/summary-box/summary-box.test.js +0 -9
  289. package/target/lib/summary-box/summary-box.test.js.map +0 -1
  290. package/target/lib/tag/tag.test.d.ts +0 -1
  291. package/target/lib/tag/tag.test.js +0 -9
  292. package/target/lib/tag/tag.test.js.map +0 -1
  293. package/target/lib/textarea/textarea.test.d.ts +0 -1
  294. package/target/lib/textarea/textarea.test.js.map +0 -1
  295. /package/src/lib/input-mask/{input-mask.test.ts → input-mask.element.test.ts} +0 -0
  296. /package/src/lib/services/{icon.service.test.ts → icon.service.element.test.ts} +0 -0
  297. /package/target/lib/input/{input.test.d.ts → input.element.test.d.ts} +0 -0
  298. /package/target/lib/input-mask/{input-mask.test.d.ts → input-mask.element.test.d.ts} +0 -0
  299. /package/target/lib/services/{icon.service.test.d.ts → icon.service.element.test.d.ts} +0 -0
@@ -0,0 +1,71 @@
1
+ import './search.element.js';
2
+ import '../input/input.element.js';
3
+ import '../button/button.element.js';
4
+
5
+ import { assert, fixture, html } from '@open-wc/testing';
6
+
7
+ import { userEvent } from '@testing-library/user-event';
8
+ import type { USASearchElement } from './search.element.js';
9
+
10
+ describe('usa-search', () => {
11
+ it('should be accessible', async () => {
12
+ const search = await fixture<USASearchElement>(html` <usa-search name="search">Hello World</usa-search> `);
13
+
14
+ return assert.isAccessible(search);
15
+ });
16
+
17
+ it('should have default attribute values', async () => {
18
+ const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
19
+
20
+ assert.equal(search.name, 'search');
21
+ assert.equal(search.placeholder, 'Search');
22
+ assert.equal(search.required, false);
23
+ assert.equal(search.disabled, false);
24
+ assert.equal(search.autocomplete, 'off');
25
+ assert.equal(search.value, '');
26
+ });
27
+
28
+ it('should update attributes when changed', async () => {
29
+ const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
30
+
31
+ search.name = 'custom-name';
32
+ search.placeholder = 'Custom Placeholder';
33
+ search.required = true;
34
+ search.disabled = true;
35
+ search.autocomplete = 'on';
36
+ search.value = 'test value';
37
+
38
+ assert.equal(search.name, 'custom-name');
39
+ assert.equal(search.placeholder, 'Custom Placeholder');
40
+ assert.equal(search.required, true);
41
+ assert.equal(search.disabled, true);
42
+ assert.equal(search.autocomplete, 'on');
43
+ assert.equal(search.value, 'test value');
44
+ });
45
+
46
+ it('should handle form submission', async () => {
47
+ const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
48
+
49
+ let submitted = false;
50
+
51
+ search.addEventListener('submit', (e) => {
52
+ e.preventDefault();
53
+
54
+ submitted = true;
55
+ });
56
+
57
+ const form = search.shadowRoot?.querySelector('form');
58
+ form?.dispatchEvent(new Event('submit', { bubbles: true, composed: true }));
59
+
60
+ assert.isTrue(submitted);
61
+ });
62
+
63
+ it('should update value on input change', async () => {
64
+ const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
65
+
66
+ const input = search.shadowRoot?.querySelector('usa-input');
67
+ input?.dispatchEvent(new Event('input', { bubbles: true }));
68
+
69
+ assert.equal(search.value, '');
70
+ });
71
+ });
@@ -1,11 +1,11 @@
1
- import "./select.element.js";
2
- import "./select-option/select-option.element.js";
1
+ import './select.element.js';
2
+ import './select-option/select-option.element.js';
3
3
 
4
- import { assert, fixture, html } from "@open-wc/testing";
5
- import { userEvent } from "@testing-library/user-event";
4
+ import { assert, fixture, html } from '@open-wc/testing';
5
+ import { userEvent } from '@testing-library/user-event';
6
6
 
7
- describe("usa-select", () => {
8
- it("should be accessible", async () => {
7
+ describe('usa-select', () => {
8
+ it('should be accessible', async () => {
9
9
  const el = await fixture<HTMLFormElement>(html`
10
10
  <usa-select name="example">
11
11
  Hello World
@@ -19,7 +19,7 @@ describe("usa-select", () => {
19
19
  return assert.isAccessible(el);
20
20
  });
21
21
 
22
- it("should create local select options", async () => {
22
+ it('should create local select options', async () => {
23
23
  const form = await fixture<HTMLFormElement>(html`
24
24
  <form>
25
25
  <usa-select name="example">
@@ -32,17 +32,15 @@ describe("usa-select", () => {
32
32
  </form>
33
33
  `);
34
34
 
35
- const nativeInputs = form
36
- .querySelector("usa-select")
37
- ?.shadowRoot?.querySelectorAll("option");
35
+ const nativeInputs = form.querySelector('usa-select')?.shadowRoot?.querySelectorAll('option');
38
36
 
39
37
  assert.deepEqual(
40
38
  Array.from(nativeInputs ?? []).map((input) => input.value),
41
- ["first", "second", "third"],
39
+ ['first', 'second', 'third'],
42
40
  );
43
41
  });
44
42
 
45
- it("should remove select options when options are removed", async () => {
43
+ it('should remove select options when options are removed', async () => {
46
44
  const form = await fixture<HTMLFormElement>(html`
47
45
  <form>
48
46
  <usa-select name="example">
@@ -55,21 +53,19 @@ describe("usa-select", () => {
55
53
  </form>
56
54
  `);
57
55
 
58
- const options = form.querySelectorAll("usa-select-option");
56
+ const options = form.querySelectorAll('usa-select-option');
59
57
 
60
58
  options[1].remove();
61
59
 
62
- const nativeInputs = form
63
- .querySelector("usa-select")
64
- ?.shadowRoot?.querySelectorAll("option");
60
+ const nativeInputs = form.querySelector('usa-select')?.shadowRoot?.querySelectorAll('option');
65
61
 
66
62
  assert.deepEqual(
67
63
  Array.from(nativeInputs ?? []).map((input) => input.value),
68
- ["first", "third"],
64
+ ['first', 'third'],
69
65
  );
70
66
  });
71
67
 
72
- it("should submit form with default values", async () => {
68
+ it('should submit form with default values', async () => {
73
69
  const form = await fixture<HTMLFormElement>(html`
74
70
  <form>
75
71
  <usa-select name="example" value="second">
@@ -84,10 +80,10 @@ describe("usa-select", () => {
84
80
 
85
81
  const value = new FormData(form);
86
82
 
87
- assert.equal(value.get("example"), "second");
83
+ assert.equal(value.get('example'), 'second');
88
84
  });
89
85
 
90
- it("should update form value as select value changed", async () => {
86
+ it('should update form value as select value changed', async () => {
91
87
  const form = await fixture<HTMLFormElement>(html`
92
88
  <form>
93
89
  <usa-select name="example" value="second">
@@ -100,24 +96,25 @@ describe("usa-select", () => {
100
96
  </form>
101
97
  `);
102
98
 
103
- const select = form.querySelector("usa-select");
104
- const nativeSelect = select?.shadowRoot?.querySelector("select");
99
+ const select = form.querySelector('usa-select');
100
+ const nativeSelect = select?.shadowRoot?.querySelector('select');
105
101
 
106
102
  if (nativeSelect) {
107
- await userEvent.selectOptions(nativeSelect, "third");
103
+ await userEvent.selectOptions(nativeSelect, 'third');
108
104
  }
109
105
 
110
106
  const value = new FormData(form);
111
107
 
112
- assert.equal(value.get("example"), "third");
108
+ assert.equal(value.get('example'), 'third');
113
109
  });
114
110
 
115
- it("should not submit when not valid", async () => {
111
+ it('should not submit when not valid', async () => {
116
112
  const form = await fixture<HTMLFormElement>(html`
117
113
  <form>
118
- <usa-select name="example" required>
114
+ <usa-select id="TEST" name="example" required>
119
115
  Hello World
120
116
 
117
+ <usa-select-option value="">-Select One -</usa-select-option>
121
118
  <usa-select-option value="first">First</usa-select-option>
122
119
  <usa-select-option value="second">Second</usa-select-option>
123
120
  <usa-select-option value="third">Third</usa-select-option>
@@ -1,20 +1,24 @@
1
- import { injectable } from "@joist/di";
2
- import { attr, css, element, html, listen, query } from "@joist/element";
1
+ import '@joist/templating/define.js';
3
2
 
4
- import { SELECT_CONTEXT, type SelectContainer } from "./context.js";
3
+ import { injectable } from '@joist/di';
4
+ import { attr, css, element, html, listen, query } from '@joist/element';
5
+ import { bind } from '@joist/templating';
6
+
7
+ import { SELECT_CONTEXT, type SelectContainer } from './context.js';
8
+ import { effect } from '@joist/observable';
5
9
 
6
10
  declare global {
7
11
  interface HTMLElementTagNameMap {
8
- "usa-select": USASelectElement;
12
+ 'usa-select': USASelectElement;
9
13
  }
10
14
  }
11
15
 
12
16
  @injectable({
13
- name: "usa-select-ctx",
17
+ name: 'usa-select-ctx',
14
18
  provideSelfAs: [SELECT_CONTEXT],
15
19
  })
16
20
  @element({
17
- tagName: "usa-select",
21
+ tagName: 'usa-select',
18
22
  shadowDom: [
19
23
  css`
20
24
  :host {
@@ -69,7 +73,9 @@ declare global {
69
73
  <slot></slot>
70
74
  </div>
71
75
 
72
- <select part="select"></select>
76
+ <j-bind props="value,name,required">
77
+ <select part="select"></select>
78
+ </j-bind>
73
79
  </label>
74
80
  `,
75
81
  ],
@@ -78,63 +84,56 @@ export class USASelectElement extends HTMLElement implements SelectContainer {
78
84
  static formAssociated = true;
79
85
 
80
86
  @attr()
81
- accessor value = "";
87
+ @bind()
88
+ accessor value = '';
82
89
 
83
90
  @attr()
84
- accessor name = "";
91
+ @bind()
92
+ accessor name = '';
85
93
 
86
94
  @attr()
95
+ @bind()
87
96
  accessor required = false;
88
97
 
89
- #select = query("select");
98
+ #select = query('select');
90
99
  #internals = this.attachInternals();
91
100
 
92
101
  connectedCallback() {
93
- this.#select({
94
- value: this.value,
95
- name: this.name,
96
- required: this.required,
97
- });
98
-
99
102
  this.#syncFormState();
100
103
  }
101
104
 
102
- attributeChangedCallback() {
103
- this.#select({
104
- value: this.value,
105
- name: this.name,
106
- required: this.required,
107
- });
108
-
105
+ @effect()
106
+ onChange() {
109
107
  this.#syncFormState();
110
108
  }
111
109
 
112
- @listen("change")
110
+ @listen('change')
113
111
  onSelectChange() {
114
112
  const select = this.#select();
115
113
 
116
114
  this.value = select.value;
117
-
118
- this.#syncFormState();
119
115
  }
120
116
 
121
117
  addSelectOption(option: HTMLOptionElement) {
122
118
  const select = this.#select();
119
+
120
+ if (!this.value && !select.children.length) {
121
+ this.value = option.value;
122
+ }
123
+
123
124
  select.append(option);
124
125
  }
125
126
 
126
- #syncFormState() {
127
+ async #syncFormState() {
127
128
  const select = this.#select();
128
129
 
129
130
  this.#internals.setFormValue(this.value);
130
131
  this.#internals.setValidity({});
131
132
 
133
+ await Promise.resolve();
134
+
132
135
  if (select.validationMessage) {
133
- this.#internals.setValidity(
134
- { customError: true },
135
- select.validationMessage,
136
- select,
137
- );
136
+ this.#internals.setValidity({ customError: true }, select.validationMessage, select);
138
137
  }
139
138
  }
140
139
  }
@@ -1,13 +1,13 @@
1
- import "../link/link.element.js";
2
- import "./side-nav.element.js";
3
- import "./side-nav-item/side-nav-item.element.js";
1
+ import '../link/link.element.js';
2
+ import './side-nav.element.js';
3
+ import './side-nav-item/side-nav-item.element.js';
4
4
 
5
- import { assert, fixture, html } from "@open-wc/testing";
5
+ import { assert, fixture, html } from '@open-wc/testing';
6
6
 
7
- import type { USASideNavElement } from "./side-nav.element.js";
7
+ import type { USASideNavElement } from './side-nav.element.js';
8
8
 
9
- describe("usa-side-nav", () => {
10
- it("should be accessible", async () => {
9
+ describe('usa-side-nav', () => {
10
+ it('should be accessible', async () => {
11
11
  const sideNav = await fixture<USASideNavElement>(html`
12
12
  <usa-side-nav>
13
13
  <usa-side-nav-item current>
@@ -51,7 +51,7 @@ describe("usa-side-nav", () => {
51
51
  return assert.isAccessible(sideNav);
52
52
  });
53
53
 
54
- it("should set child padding correctly", async () => {
54
+ it('should set child padding correctly', async () => {
55
55
  const sideNav = await fixture<USASideNavElement>(html`
56
56
  <usa-side-nav>
57
57
  <usa-side-nav-item current>
@@ -92,20 +92,10 @@ describe("usa-side-nav", () => {
92
92
  </usa-side-nav>
93
93
  `);
94
94
 
95
- const items = sideNav.querySelectorAll("usa-side-nav-item");
96
-
97
- assert.equal(
98
- getComputedStyle(items[1]).getPropertyValue(
99
- "--usa-nav-item-padding-left",
100
- ),
101
- "2rem",
102
- );
103
-
104
- assert.equal(
105
- getComputedStyle(items[3]).getPropertyValue(
106
- "--usa-nav-item-padding-left",
107
- ),
108
- "3rem",
109
- );
95
+ const items = sideNav.querySelectorAll('usa-side-nav-item');
96
+
97
+ assert.equal(getComputedStyle(items[1]).getPropertyValue('--usa-nav-item-padding-left'), '2rem');
98
+
99
+ assert.equal(getComputedStyle(items[3]).getPropertyValue('--usa-nav-item-padding-left'), '3rem');
110
100
  });
111
101
  });
@@ -1,13 +1,13 @@
1
- import { attr, attrChanged, css, element, html } from "@joist/element";
1
+ import { attr, attrChanged, css, element, html } from '@joist/element';
2
2
 
3
3
  declare global {
4
4
  interface HTMLElementTagNameMap {
5
- "usa-step": USAStepIndicatorStepElement;
5
+ 'usa-step': USAStepIndicatorStepElement;
6
6
  }
7
7
  }
8
8
 
9
9
  @element({
10
- tagName: "usa-step",
10
+ tagName: 'usa-step',
11
11
  shadowDom: [
12
12
  css`
13
13
  :host {
@@ -42,26 +42,26 @@ declare global {
42
42
  box-sizing: border-box;
43
43
  }
44
44
 
45
- :host([state="complete"]) {
45
+ :host([state='complete']) {
46
46
  color: #162e51;
47
47
  }
48
48
 
49
- :host([state="complete"])::before {
49
+ :host([state='complete'])::before {
50
50
  background-color: #162e51;
51
51
  }
52
52
 
53
- :host([state="current"]) {
53
+ :host([state='current']) {
54
54
  color: #005ea2;
55
55
  font-weight: bold;
56
56
  }
57
57
 
58
- :host([state="current"])::before {
58
+ :host([state='current'])::before {
59
59
  background-color: #005ea2;
60
60
  }
61
61
 
62
62
  :host:before {
63
63
  background-color: #919191;
64
- content: "";
64
+ content: '';
65
65
  display: block;
66
66
  height: 0.5rem;
67
67
  }
@@ -78,19 +78,19 @@ declare global {
78
78
  margin-top: 1.5rem;
79
79
  }
80
80
 
81
- :host([counter][state="complete"]):after {
81
+ :host([counter][state='complete']):after {
82
82
  background-color: #162e51;
83
83
  box-shadow: 0 0 0 0.25rem #fff;
84
84
  color: #fff;
85
85
  }
86
86
 
87
- :host([counter][state="current"]):after {
87
+ :host([counter][state='current']):after {
88
88
  background-color: #005ea2;
89
89
  box-shadow: 0 0 0 0.25rem #fff;
90
90
  color: #fff;
91
91
  }
92
92
 
93
- :host([counter="small"]):after {
93
+ :host([counter='small']):after {
94
94
  height: 1.5rem;
95
95
  width: 1.5rem;
96
96
  font-size: 0.93rem;
@@ -109,15 +109,15 @@ declare global {
109
109
  })
110
110
  export class USAStepIndicatorStepElement extends HTMLElement {
111
111
  @attr()
112
- accessor state: "complete" | "current" | "" = "";
112
+ accessor state: 'complete' | 'current' | '' = '';
113
113
 
114
114
  @attr()
115
- accessor role = "listitem";
115
+ accessor role = 'listitem';
116
116
 
117
- @attrChanged("state")
117
+ @attrChanged('state')
118
118
  onStateAttrChanged() {
119
- if (this.state === "current") {
120
- this.ariaCurrent = "step";
119
+ if (this.state === 'current') {
120
+ this.ariaCurrent = 'step';
121
121
  }
122
122
  }
123
123
  }
@@ -1,12 +1,12 @@
1
- import "./step-indicator.element.js";
2
- import "./step/step.element.js";
1
+ import './step-indicator.element.js';
2
+ import './step/step.element.js';
3
3
 
4
- import { assert, fixture, html } from "@open-wc/testing";
4
+ import { assert, fixture, html } from '@open-wc/testing';
5
5
 
6
- import type { USAStepIndicatorElement } from "./step-indicator.element.js";
6
+ import type { USAStepIndicatorElement } from './step-indicator.element.js';
7
7
 
8
- describe("usa-step-indicator", () => {
9
- it("should be accessible", async () => {
8
+ describe('usa-step-indicator', () => {
9
+ it('should be accessible', async () => {
10
10
  const stepIndicator = await fixture<USAStepIndicatorElement>(html`
11
11
  <usa-step-indicator>
12
12
  <usa-step state="complete" counter="on">Personal information</usa-step>
@@ -0,0 +1,13 @@
1
+ import './summary-box.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USASummaryBoxElement } from './summary-box.element.js';
6
+
7
+ describe('usa-summary-box', () => {
8
+ it('should be accessible', async () => {
9
+ const summaryBox = await fixture<USASummaryBoxElement>(html` <usa-summary-box>Hello World</usa-summary-box> `);
10
+
11
+ return assert.isAccessible(summaryBox);
12
+ });
13
+ });
@@ -0,0 +1,13 @@
1
+ import './tag.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USATagElement } from './tag.element.js';
6
+
7
+ describe('usa-tag', () => {
8
+ it('should be accessible', async () => {
9
+ const tag = await fixture<USATagElement>(html` <usa-tag>Hello World</usa-tag> `);
10
+
11
+ return assert.isAccessible(tag);
12
+ });
13
+ });
@@ -1,10 +1,10 @@
1
- import "./textarea.element.js";
1
+ import './textarea.element.js';
2
2
 
3
- import { assert, fixture, html } from "@open-wc/testing";
4
- import { userEvent } from "@testing-library/user-event";
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+ import { userEvent } from '@testing-library/user-event';
5
5
 
6
- describe("usa-textarea", () => {
7
- it("should be accessible", async () => {
6
+ describe('usa-textarea', () => {
7
+ it('should be accessible', async () => {
8
8
  const form = await fixture<HTMLFormElement>(html`
9
9
  <usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
10
10
  `);
@@ -12,7 +12,7 @@ describe("usa-textarea", () => {
12
12
  return assert.isAccessible(form);
13
13
  });
14
14
 
15
- it("should submit form with default values", async () => {
15
+ it('should submit form with default values', async () => {
16
16
  const form = await fixture<HTMLFormElement>(html`
17
17
  <form>
18
18
  <usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
@@ -23,10 +23,10 @@ describe("usa-textarea", () => {
23
23
 
24
24
  const value = new FormData(form);
25
25
 
26
- assert.equal(value.get("fname"), "Foo");
26
+ assert.equal(value.get('fname'), 'Foo');
27
27
  });
28
28
 
29
- it("should update form value as input value changed", async () => {
29
+ it('should update form value as input value changed', async () => {
30
30
  const form = await fixture<HTMLFormElement>(html`
31
31
  <form>
32
32
  <usa-textarea name="fname">Hello World</usa-textarea>
@@ -35,19 +35,19 @@ describe("usa-textarea", () => {
35
35
  </form>
36
36
  `);
37
37
 
38
- const input = form.querySelector("usa-textarea");
39
- const nativeInput = input?.shadowRoot?.querySelector("textarea");
38
+ const input = form.querySelector('usa-textarea');
39
+ const nativeInput = input?.shadowRoot?.querySelector('textarea');
40
40
 
41
41
  if (nativeInput) {
42
- await userEvent.type(nativeInput, "Bar");
42
+ await userEvent.type(nativeInput, 'Bar');
43
43
  }
44
44
 
45
45
  const value = new FormData(form);
46
46
 
47
- assert.equal(value.get("fname"), "Bar");
47
+ assert.equal(value.get('fname'), 'Bar');
48
48
  });
49
49
 
50
- it("should not submit when not valid", async () => {
50
+ it('should not submit when not valid', async () => {
51
51
  const form = await fixture<HTMLFormElement>(html`
52
52
  <form>
53
53
  <usa-textarea name="fname" required>Hello World</usa-textarea>
@@ -1,5 +1,8 @@
1
- import { attr, css, element, html, listen, query, ready } from '@joist/element';
2
- import { effect, observe } from '@joist/observable';
1
+ import '@joist/templating/define.js';
2
+
3
+ import { attr, css, element, html, listen, query } from '@joist/element';
4
+ import { effect } from '@joist/observable';
5
+ import { bind } from '@joist/templating';
3
6
 
4
7
  declare global {
5
8
  interface HTMLElementTagNameMap {
@@ -59,11 +62,15 @@ declare global {
59
62
  }
60
63
  `,
61
64
  html`
62
- <label for="textarea" part="label">
63
- <slot></slot>
64
- </label>
65
-
66
- <textarea id="textarea" part="textarea"></textarea>
65
+ <j-bind attrs="for:name">
66
+ <label part="label">
67
+ <slot></slot>
68
+ </label>
69
+ </j-bind>
70
+
71
+ <j-bind props="name,placeholder,autocomplete,required,value,id:name">
72
+ <textarea id="textarea" part="textarea"></textarea>
73
+ </j-bind>
67
74
  `,
68
75
  ],
69
76
  })
@@ -71,48 +78,40 @@ export class USATextareaElement extends HTMLElement {
71
78
  static formAssociated = true;
72
79
 
73
80
  @attr()
81
+ @bind()
74
82
  accessor name = '';
75
83
 
76
84
  @attr()
85
+ @bind()
77
86
  accessor autocomplete: AutoFill = 'on';
78
87
 
79
88
  @attr()
89
+ @bind()
80
90
  accessor placeholder = '';
81
91
 
82
92
  @attr()
93
+ @bind()
83
94
  accessor required = false;
84
95
 
96
+ @attr()
97
+ @bind()
98
+ accessor autofocus = false;
99
+
85
100
  @attr({
86
101
  reflect: false,
87
102
  })
88
- @observe()
103
+ @bind()
89
104
  accessor value = '';
90
105
 
91
106
  #internals = this.attachInternals();
92
107
  #input = query('textarea');
93
108
 
94
- @ready()
95
- onReady() {
96
- this.#input({ autofocus: this.autofocus });
97
- }
98
-
99
- attributeChangedCallback() {
100
- this.#input({
101
- name: this.name,
102
- placeholder: this.placeholder,
103
- autocomplete: this.autocomplete,
104
- required: this.required,
105
- });
106
- }
107
-
108
109
  connectedCallback() {
109
110
  this.#syncFormState();
110
111
  }
111
112
 
112
113
  @effect()
113
114
  onChange() {
114
- this.#input({ value: this.value });
115
-
116
115
  this.#syncFormState();
117
116
  }
118
117