@onewelcome/react-lib-components 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/dist/cjs/.scope.d.ts +2 -0
  2. package/dist/cjs/Button/Button.module.cjs.js +1 -1
  3. package/dist/cjs/Button/IconButton.module.cjs.js +1 -1
  4. package/dist/cjs/ContextMenu/ContextMenu.cjs.js +1 -1
  5. package/dist/cjs/ContextMenu/ContextMenu.cjs.js.map +1 -1
  6. package/dist/cjs/ContextMenu/ContextMenuItem.module.cjs.js +1 -1
  7. package/dist/cjs/ContextMenu/ContextMenuService.cjs.js +1 -1
  8. package/dist/cjs/ContextMenu/ContextMenuService.cjs.js.map +1 -1
  9. package/dist/cjs/DataGrid/DataGridActions/DataGridColumnsToggle.module.cjs.js +1 -1
  10. package/dist/cjs/Form/Fieldset/Fieldset.cjs.js +1 -1
  11. package/dist/cjs/Form/Fieldset/Fieldset.cjs.js.map +1 -1
  12. package/dist/cjs/Form/Input/Input.module.cjs.js +1 -1
  13. package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js +2 -0
  14. package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js.map +1 -0
  15. package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js +2 -0
  16. package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js.map +1 -0
  17. package/dist/cjs/Form/Select/MultiSelect/MultiSelect.module.cjs.js +2 -0
  18. package/dist/cjs/Form/Select/MultiSelect/MultiSelect.module.cjs.js.map +1 -0
  19. package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js +2 -0
  20. package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js.map +1 -0
  21. package/dist/cjs/Form/Select/MultiSelect/SelectButton.module.cjs.js +2 -0
  22. package/dist/cjs/Form/Select/MultiSelect/SelectButton.module.cjs.js.map +1 -0
  23. package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js +2 -0
  24. package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js.map +1 -0
  25. package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.module.cjs.js +2 -0
  26. package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.module.cjs.js.map +1 -0
  27. package/dist/cjs/Form/Select/SelectService.cjs.js +1 -1
  28. package/dist/cjs/Form/Select/SelectService.cjs.js.map +1 -1
  29. package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js +2 -0
  30. package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js.map +1 -0
  31. package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js +2 -0
  32. package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js.map +1 -0
  33. package/dist/cjs/Form/Select/SingleSelect/Select.module.cjs.js +2 -0
  34. package/dist/cjs/Form/Select/useAddNewBtn.cjs.js +2 -0
  35. package/dist/cjs/Form/Select/useAddNewBtn.cjs.js.map +1 -0
  36. package/dist/cjs/Form/Select/useAddNewBtn.module.cjs.js +2 -0
  37. package/dist/cjs/Form/Select/useAddNewBtn.module.cjs.js.map +1 -0
  38. package/dist/cjs/Form/Select/useSearch.cjs.js +2 -0
  39. package/dist/cjs/Form/Select/useSearch.cjs.js.map +1 -0
  40. package/dist/cjs/Form/Textarea/Textarea.module.cjs.js +1 -1
  41. package/dist/cjs/Form/Wrapper/InputWrapper/InputWrapper.module.cjs.js +1 -1
  42. package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js +1 -1
  43. package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.cjs.js.map +1 -1
  44. package/dist/cjs/Form/Wrapper/SelectWrapper/SelectWrapper.module.cjs.js +1 -1
  45. package/dist/cjs/Form/Wrapper/Wrapper/Wrapper.module.cjs.js +1 -1
  46. package/dist/cjs/Icon/Icon.cjs.js +1 -1
  47. package/dist/cjs/Icon/Icon.cjs.js.map +1 -1
  48. package/dist/cjs/Icon/Icon.module.cjs.js +1 -1
  49. package/dist/cjs/Link/Link.module.cjs.js +1 -1
  50. package/dist/cjs/Notifications/BaseModal/BaseModal.module.cjs.js +1 -1
  51. package/dist/cjs/Notifications/SlideInModal/SlideInModal.module.cjs.js +1 -1
  52. package/dist/cjs/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.cjs.js +1 -1
  53. package/dist/cjs/Pagination/Pagination.cjs.js +1 -1
  54. package/dist/cjs/Pagination/Pagination.cjs.js.map +1 -1
  55. package/dist/cjs/Popover/Popover.cjs.js +1 -1
  56. package/dist/cjs/Popover/Popover.cjs.js.map +1 -1
  57. package/dist/cjs/Popover/Popover.module.cjs.js +1 -1
  58. package/dist/cjs/Stepper/Step.cjs.js +1 -1
  59. package/dist/cjs/Stepper/Step.cjs.js.map +1 -1
  60. package/dist/cjs/Stepper/Step.module.cjs.js +1 -1
  61. package/dist/cjs/Stepper/Stepper.cjs.js +1 -1
  62. package/dist/cjs/Stepper/Stepper.cjs.js.map +1 -1
  63. package/dist/cjs/Tabs/TabButton.module.cjs.js +1 -1
  64. package/dist/cjs/Tag/RemoveButton.cjs.js +2 -0
  65. package/dist/cjs/Tag/RemoveButton.cjs.js.map +1 -0
  66. package/dist/cjs/Tag/RemoveButton.module.cjs.js +2 -0
  67. package/dist/cjs/Tag/RemoveButton.module.cjs.js.map +1 -0
  68. package/dist/cjs/Tag/Tag.cjs.js +1 -1
  69. package/dist/cjs/Tag/Tag.cjs.js.map +1 -1
  70. package/dist/cjs/Tag/Tag.module.cjs.js +1 -1
  71. package/dist/cjs/TextEllipsis/TextEllipsis.module.cjs.js +1 -1
  72. package/dist/cjs/Tiles/Tile.module.cjs.js +1 -1
  73. package/dist/cjs/Tooltip/Tooltip.module.cjs.js +1 -1
  74. package/dist/cjs/Wizard/BaseWizardSteps/BaseWizardSteps.module.cjs.js +1 -1
  75. package/dist/cjs/src/components/ContextMenu/ContextMenu.d.ts +1 -1
  76. package/dist/cjs/src/components/ContextMenu/ContextMenuService.d.ts +4 -1
  77. package/dist/cjs/src/components/Form/Select/MultiSelect/MultiOption.d.ts +6 -0
  78. package/dist/cjs/src/components/Form/Select/MultiSelect/MultiSelect.d.ts +3 -0
  79. package/dist/cjs/src/components/Form/Select/MultiSelect/SelectButton.d.ts +4 -0
  80. package/dist/cjs/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +11 -0
  81. package/dist/cjs/src/components/Form/Select/Select.interfaces.d.ts +47 -1
  82. package/dist/cjs/src/components/Form/Select/SelectService.d.ts +8 -3
  83. package/dist/cjs/src/components/Form/Select/{Option.d.ts → SingleSelect/Option.d.ts} +1 -0
  84. package/dist/cjs/src/components/Form/Select/SingleSelect/Select.d.ts +3 -0
  85. package/dist/cjs/src/components/Form/Select/SingleSelect/Select.test.d.ts +63 -0
  86. package/dist/cjs/src/components/Form/Select/useAddNewBtn.d.ts +12 -0
  87. package/dist/cjs/src/components/Form/Select/useSearch.d.ts +29 -0
  88. package/dist/cjs/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.d.ts +16 -0
  89. package/dist/cjs/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +2 -2
  90. package/dist/cjs/src/components/Icon/Icon.d.ts +1 -0
  91. package/dist/cjs/src/components/Stepper/Stepper.d.ts +0 -1
  92. package/dist/cjs/src/components/Tag/RemoveButton.d.ts +7 -0
  93. package/dist/cjs/src/components/Tag/Tag.d.ts +3 -0
  94. package/dist/cjs/src/hooks/usePosition.cjs.js.map +1 -1
  95. package/dist/cjs/src/hooks/usePosition.d.ts +1 -1
  96. package/dist/cjs/src/index.cjs.js +1 -1
  97. package/dist/cjs/src/index.d.ts +7 -4
  98. package/dist/esm/.scope.d.ts +2 -0
  99. package/dist/esm/Button/Button.module.esm.js +1 -1
  100. package/dist/esm/Button/IconButton.module.esm.js +1 -1
  101. package/dist/esm/ContextMenu/ContextMenu.esm.js +1 -1
  102. package/dist/esm/ContextMenu/ContextMenu.esm.js.map +1 -1
  103. package/dist/esm/ContextMenu/ContextMenuItem.module.esm.js +1 -1
  104. package/dist/esm/ContextMenu/ContextMenuService.esm.js +1 -1
  105. package/dist/esm/ContextMenu/ContextMenuService.esm.js.map +1 -1
  106. package/dist/esm/DataGrid/DataGridActions/DataGridColumnsToggle.module.esm.js +1 -1
  107. package/dist/esm/Form/Fieldset/Fieldset.esm.js +1 -1
  108. package/dist/esm/Form/Fieldset/Fieldset.esm.js.map +1 -1
  109. package/dist/esm/Form/Input/Input.module.esm.js +1 -1
  110. package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js +2 -0
  111. package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js.map +1 -0
  112. package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js +2 -0
  113. package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js.map +1 -0
  114. package/dist/esm/Form/Select/MultiSelect/MultiSelect.module.esm.js +2 -0
  115. package/dist/esm/Form/Select/MultiSelect/MultiSelect.module.esm.js.map +1 -0
  116. package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js +2 -0
  117. package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js.map +1 -0
  118. package/dist/esm/Form/Select/MultiSelect/SelectButton.module.esm.js +2 -0
  119. package/dist/esm/Form/Select/MultiSelect/SelectButton.module.esm.js.map +1 -0
  120. package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js +2 -0
  121. package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js.map +1 -0
  122. package/dist/esm/Form/Select/MultiSelect/SelectedOptions.module.esm.js +2 -0
  123. package/dist/esm/Form/Select/MultiSelect/SelectedOptions.module.esm.js.map +1 -0
  124. package/dist/esm/Form/Select/SelectService.esm.js +1 -1
  125. package/dist/esm/Form/Select/SelectService.esm.js.map +1 -1
  126. package/dist/esm/Form/Select/SingleSelect/Option.esm.js +2 -0
  127. package/dist/esm/Form/Select/SingleSelect/Option.esm.js.map +1 -0
  128. package/dist/esm/Form/Select/SingleSelect/Select.esm.js +2 -0
  129. package/dist/esm/Form/Select/SingleSelect/Select.esm.js.map +1 -0
  130. package/dist/esm/Form/Select/SingleSelect/Select.module.esm.js +2 -0
  131. package/dist/esm/Form/Select/useAddNewBtn.esm.js +2 -0
  132. package/dist/esm/Form/Select/useAddNewBtn.esm.js.map +1 -0
  133. package/dist/esm/Form/Select/useAddNewBtn.module.esm.js +2 -0
  134. package/dist/esm/Form/Select/useAddNewBtn.module.esm.js.map +1 -0
  135. package/dist/esm/Form/Select/useSearch.esm.js +2 -0
  136. package/dist/esm/Form/Select/useSearch.esm.js.map +1 -0
  137. package/dist/esm/Form/Textarea/Textarea.module.esm.js +1 -1
  138. package/dist/esm/Form/Wrapper/InputWrapper/InputWrapper.module.esm.js +1 -1
  139. package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.esm.js +1 -1
  140. package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.esm.js.map +1 -1
  141. package/dist/esm/Form/Wrapper/SelectWrapper/SelectWrapper.module.esm.js +1 -1
  142. package/dist/esm/Form/Wrapper/Wrapper/Wrapper.module.esm.js +1 -1
  143. package/dist/esm/Icon/Icon.esm.js +1 -1
  144. package/dist/esm/Icon/Icon.esm.js.map +1 -1
  145. package/dist/esm/Icon/Icon.module.esm.js +1 -1
  146. package/dist/esm/Link/Link.module.esm.js +1 -1
  147. package/dist/esm/Notifications/BaseModal/BaseModal.module.esm.js +1 -1
  148. package/dist/esm/Notifications/SlideInModal/SlideInModal.module.esm.js +1 -1
  149. package/dist/esm/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.esm.js +1 -1
  150. package/dist/esm/Pagination/Pagination.esm.js +1 -1
  151. package/dist/esm/Pagination/Pagination.esm.js.map +1 -1
  152. package/dist/esm/Popover/Popover.esm.js +1 -1
  153. package/dist/esm/Popover/Popover.esm.js.map +1 -1
  154. package/dist/esm/Popover/Popover.module.esm.js +1 -1
  155. package/dist/esm/Stepper/Step.esm.js +1 -1
  156. package/dist/esm/Stepper/Step.esm.js.map +1 -1
  157. package/dist/esm/Stepper/Step.module.esm.js +1 -1
  158. package/dist/esm/Stepper/Stepper.esm.js +1 -1
  159. package/dist/esm/Stepper/Stepper.esm.js.map +1 -1
  160. package/dist/esm/Tabs/TabButton.module.esm.js +1 -1
  161. package/dist/esm/Tag/RemoveButton.esm.js +2 -0
  162. package/dist/esm/Tag/RemoveButton.esm.js.map +1 -0
  163. package/dist/esm/Tag/RemoveButton.module.esm.js +2 -0
  164. package/dist/esm/Tag/RemoveButton.module.esm.js.map +1 -0
  165. package/dist/esm/Tag/Tag.esm.js +1 -1
  166. package/dist/esm/Tag/Tag.esm.js.map +1 -1
  167. package/dist/esm/Tag/Tag.module.esm.js +1 -1
  168. package/dist/esm/TextEllipsis/TextEllipsis.module.esm.js +1 -1
  169. package/dist/esm/Tiles/Tile.module.esm.js +1 -1
  170. package/dist/esm/Tooltip/Tooltip.module.esm.js +1 -1
  171. package/dist/esm/Wizard/BaseWizardSteps/BaseWizardSteps.module.esm.js +1 -1
  172. package/dist/esm/src/components/ContextMenu/ContextMenu.d.ts +1 -1
  173. package/dist/esm/src/components/ContextMenu/ContextMenuService.d.ts +4 -1
  174. package/dist/esm/src/components/Form/Select/MultiSelect/MultiOption.d.ts +6 -0
  175. package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.d.ts +3 -0
  176. package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +1 -0
  177. package/dist/esm/src/components/Form/Select/MultiSelect/SelectButton.d.ts +4 -0
  178. package/dist/esm/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +11 -0
  179. package/dist/esm/src/components/Form/Select/Select.interfaces.d.ts +47 -1
  180. package/dist/esm/src/components/Form/Select/SelectService.d.ts +8 -3
  181. package/dist/esm/src/components/Form/Select/{Option.d.ts → SingleSelect/Option.d.ts} +1 -0
  182. package/dist/esm/src/components/Form/Select/SingleSelect/Option.test.d.ts +1 -0
  183. package/dist/esm/src/components/Form/Select/SingleSelect/Select.d.ts +3 -0
  184. package/dist/esm/src/components/Form/Select/SingleSelect/Select.test.d.ts +63 -0
  185. package/dist/esm/src/components/Form/Select/SingleSelect/SelectKeyboardNavigation.test.d.ts +1 -0
  186. package/dist/esm/src/components/Form/Select/useAddNewBtn.d.ts +12 -0
  187. package/dist/esm/src/components/Form/Select/useSearch.d.ts +29 -0
  188. package/dist/esm/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.d.ts +16 -0
  189. package/dist/esm/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.test.d.ts +1 -0
  190. package/dist/esm/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +2 -2
  191. package/dist/esm/src/components/Icon/Icon.d.ts +1 -0
  192. package/dist/esm/src/components/Stepper/Stepper.d.ts +0 -1
  193. package/dist/esm/src/components/Tag/RemoveButton.d.ts +7 -0
  194. package/dist/esm/src/components/Tag/Tag.d.ts +3 -0
  195. package/dist/esm/src/hooks/usePosition.d.ts +1 -1
  196. package/dist/esm/src/hooks/usePosition.esm.js.map +1 -1
  197. package/dist/esm/src/index.d.ts +7 -4
  198. package/dist/esm/src/index.esm.js +1 -1
  199. package/package.json +49 -46
  200. package/src/components/ContextMenu/ContextMenu.tsx +13 -23
  201. package/src/components/ContextMenu/ContextMenuService.ts +47 -1
  202. package/src/components/Form/Fieldset/Fieldset.tsx +3 -1
  203. package/src/{hooks/useWrapper.test.ts → components/Form/Select/MultiSelect/MultiOption.tsx} +13 -10
  204. package/src/components/Form/Select/{Select.module.scss → MultiSelect/MultiSelect.module.scss} +19 -20
  205. package/src/components/Form/Select/MultiSelect/MultiSelect.tsx +363 -0
  206. package/src/components/Form/Select/MultiSelect/SelectButton.module.scss +27 -0
  207. package/src/components/Form/Select/MultiSelect/SelectButton.tsx +37 -0
  208. package/src/components/Form/Select/MultiSelect/SelectedOptions.module.scss +31 -0
  209. package/src/components/Form/Select/MultiSelect/SelectedOptions.tsx +67 -0
  210. package/src/components/Form/Select/Select.interfaces.ts +51 -1
  211. package/src/components/Form/Select/SelectService.ts +46 -13
  212. package/src/components/Form/Select/{Option.tsx → SingleSelect/Option.tsx} +3 -1
  213. package/src/components/Form/Select/SingleSelect/Select.module.scss +232 -0
  214. package/src/components/Form/Select/{Select.tsx → SingleSelect/Select.tsx} +56 -87
  215. package/src/components/Form/Select/useAddNewBtn.module.scss +51 -0
  216. package/src/components/Form/Select/useAddNewBtn.tsx +54 -0
  217. package/src/components/Form/Select/useSearch.tsx +124 -0
  218. package/src/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss +0 -10
  219. package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss +27 -0
  220. package/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.tsx +84 -0
  221. package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss +0 -4
  222. package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +3 -2
  223. package/src/components/Form/Wrapper/Wrapper/Wrapper.module.scss +0 -6
  224. package/src/components/Icon/Icon.module.scss +5 -0
  225. package/src/components/Icon/Icon.tsx +1 -0
  226. package/src/components/Link/Link.module.scss +16 -0
  227. package/src/components/Pagination/Pagination.tsx +2 -2
  228. package/src/components/Popover/Popover.tsx +19 -2
  229. package/src/components/Stepper/Step.tsx +2 -1
  230. package/src/components/Stepper/Stepper.tsx +0 -2
  231. package/src/{hooks/useScroll.test.tsx → components/Tag/RemoveButton.module.scss} +22 -17
  232. package/src/components/Tag/RemoveButton.tsx +52 -0
  233. package/src/components/Tag/Tag.module.scss +23 -2
  234. package/src/components/Tag/Tag.tsx +21 -11
  235. package/src/components/Tooltip/Tooltip.module.scss +1 -0
  236. package/src/font/icomoon.eot +0 -0
  237. package/src/font/icomoon.svg +1 -0
  238. package/src/font/icomoon.ttf +0 -0
  239. package/src/font/icomoon.woff +0 -0
  240. package/src/font/selection.json +1 -1
  241. package/src/hooks/usePosition.ts +1 -1
  242. package/src/index.ts +11 -4
  243. package/src/interfaces.ts +2 -2
  244. package/src/mixins.module.scss +2 -4
  245. package/dist/cjs/Form/Select/Option.cjs.js +0 -2
  246. package/dist/cjs/Form/Select/Option.cjs.js.map +0 -1
  247. package/dist/cjs/Form/Select/Select.cjs.js +0 -2
  248. package/dist/cjs/Form/Select/Select.cjs.js.map +0 -1
  249. package/dist/cjs/Form/Select/Select.module.cjs.js +0 -2
  250. package/dist/cjs/src/components/Form/Select/Select.d.ts +0 -23
  251. package/dist/esm/Form/Select/Option.esm.js +0 -2
  252. package/dist/esm/Form/Select/Option.esm.js.map +0 -1
  253. package/dist/esm/Form/Select/Select.esm.js +0 -2
  254. package/dist/esm/Form/Select/Select.esm.js.map +0 -1
  255. package/dist/esm/Form/Select/Select.module.esm.js +0 -2
  256. package/dist/esm/src/components/Form/Select/Select.d.ts +0 -23
  257. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -64
  258. package/src/components/Button/BaseButton.test.tsx +0 -133
  259. package/src/components/Button/Button.test.tsx +0 -150
  260. package/src/components/Button/IconButton.test.tsx +0 -106
  261. package/src/components/ContextMenu/ContextMenu.test.tsx +0 -358
  262. package/src/components/DataGrid/DataGrid.test.tsx +0 -437
  263. package/src/components/DataGrid/DataGridActions/DataGridActions.test.tsx +0 -204
  264. package/src/components/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +0 -99
  265. package/src/components/DataGrid/DataGridBody/DataGridBody.test.tsx +0 -140
  266. package/src/components/DataGrid/DataGridBody/DataGridCell.test.tsx +0 -90
  267. package/src/components/DataGrid/DataGridBody/DataGridRow.test.tsx +0 -117
  268. package/src/components/DataGrid/DataGridHeader/DataGridHeader.test.tsx +0 -276
  269. package/src/components/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +0 -144
  270. package/src/components/Form/Checkbox/Checkbox.test.tsx +0 -308
  271. package/src/components/Form/Fieldset/Fieldset.test.tsx +0 -127
  272. package/src/components/Form/FileUpload/FileItem/FileItem.test.tsx +0 -103
  273. package/src/components/Form/FileUpload/FileUpload.test.tsx +0 -374
  274. package/src/components/Form/Form.test.tsx +0 -63
  275. package/src/components/Form/FormControl/FormControl.test.tsx +0 -98
  276. package/src/components/Form/FormGroup/FormGroup.test.tsx +0 -127
  277. package/src/components/Form/FormHelperText/FormHelperText.test.tsx +0 -84
  278. package/src/components/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +0 -94
  279. package/src/components/Form/Input/Input.test.tsx +0 -267
  280. package/src/components/Form/Label/Label.test.tsx +0 -68
  281. package/src/components/Form/Radio/Radio.test.tsx +0 -130
  282. package/src/components/Form/Select/Option.test.tsx +0 -57
  283. package/src/components/Form/Select/Select.test.tsx +0 -564
  284. package/src/components/Form/Textarea/Textarea.test.tsx +0 -124
  285. package/src/components/Form/Toggle/Toggle.test.tsx +0 -200
  286. package/src/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +0 -141
  287. package/src/components/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +0 -211
  288. package/src/components/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +0 -117
  289. package/src/components/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +0 -186
  290. package/src/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +0 -173
  291. package/src/components/Form/Wrapper/Wrapper/Wrapper.test.tsx +0 -59
  292. package/src/components/Icon/Icon.test.tsx +0 -83
  293. package/src/components/Link/Link.test.tsx +0 -203
  294. package/src/components/Notifications/Banner/Banner.test.tsx +0 -84
  295. package/src/components/Notifications/BaseModal/BaseModal.test.tsx +0 -194
  296. package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +0 -74
  297. package/src/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +0 -71
  298. package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +0 -74
  299. package/src/components/Notifications/Dialog/Dialog.test.tsx +0 -118
  300. package/src/components/Notifications/Dialog/DialogActions/DialogActions.test.tsx +0 -61
  301. package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +0 -87
  302. package/src/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +0 -111
  303. package/src/components/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +0 -175
  304. package/src/components/Notifications/Modal/Modal.test.tsx +0 -18
  305. package/src/components/Notifications/NotificationProvider/NotificationContext.test.tsx +0 -449
  306. package/src/components/Notifications/SlideInModal/SlideInModal.test.tsx +0 -90
  307. package/src/components/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +0 -53
  308. package/src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +0 -77
  309. package/src/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +0 -219
  310. package/src/components/Notifications/Snackbar/useSnackbar.test.tsx +0 -136
  311. package/src/components/Pagination/Pagination.test.tsx +0 -183
  312. package/src/components/Popover/Popover.test.tsx +0 -103
  313. package/src/components/ProgressBar/ProgressBar.test.tsx +0 -91
  314. package/src/components/Skeleton/Skeleton.test.tsx +0 -112
  315. package/src/components/StatusIndicator/StatusIndicator.test.tsx +0 -143
  316. package/src/components/Stepper/Stepper.test.tsx +0 -83
  317. package/src/components/Tabs/Tab.test.tsx +0 -49
  318. package/src/components/Tabs/TabButton.test.tsx +0 -65
  319. package/src/components/Tabs/Tabs.test.tsx +0 -291
  320. package/src/components/Tag/Tag.test.tsx +0 -89
  321. package/src/components/TextEllipsis/TextEllipsis.test.tsx +0 -96
  322. package/src/components/Tiles/Tile.test.tsx +0 -183
  323. package/src/components/Tiles/Tiles.test.tsx +0 -162
  324. package/src/components/Tooltip/Tooltip.test.tsx +0 -390
  325. package/src/components/Typography/Typography.test.tsx +0 -177
  326. package/src/components/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +0 -90
  327. package/src/components/Wizard/Wizard.test.tsx +0 -218
  328. package/src/components/Wizard/WizardActions/WizardActions.test.tsx +0 -187
  329. package/src/components/Wizard/WizardSteps/WizardSteps.test.tsx +0 -125
  330. package/src/components/_BaseStyling_/BaseStyling.test.tsx +0 -55
  331. package/src/hooks/useAnimation.test.tsx +0 -65
  332. package/src/hooks/useBodyClick.test.tsx +0 -55
  333. package/src/hooks/useDebouncedCallback.test.ts +0 -150
  334. package/src/hooks/useDetermineStatusIcon.test.ts +0 -28
  335. package/src/hooks/useFormSelector.test.ts +0 -56
  336. package/src/hooks/usePosition.test.tsx +0 -510
  337. package/src/hooks/useRepeater.test.tsx +0 -156
  338. package/src/hooks/useSpacing.test.ts +0 -86
  339. package/src/hooks/useUploadFile.test.ts +0 -211
  340. package/src/util/helper.test.tsx +0 -403
  341. /package/dist/cjs/Form/Select/{Select.module.cjs.js.map → SingleSelect/Select.module.cjs.js.map} +0 -0
  342. /package/dist/cjs/src/components/Form/Select/{Option.test.d.ts → MultiSelect/MultiSelect.test.d.ts} +0 -0
  343. /package/dist/{esm/src/components/Form/Select → cjs/src/components/Form/Select/SingleSelect}/Option.test.d.ts +0 -0
  344. /package/dist/cjs/src/components/Form/Select/{Select.test.d.ts → SingleSelect/SelectKeyboardNavigation.test.d.ts} +0 -0
  345. /package/dist/{esm/src/components/Form/Select/Select.test.d.ts → cjs/src/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.test.d.ts} +0 -0
  346. /package/dist/esm/Form/Select/{Select.module.esm.js.map → SingleSelect/Select.module.esm.js.map} +0 -0
@@ -1,564 +0,0 @@
1
- /*
2
- * Copyright 2022 OneWelcome B.V.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import React, { useEffect, useRef } from "react";
18
- import { Select as SelectComponent, Props } from "./Select";
19
- import { act, render, waitFor } from "@testing-library/react";
20
- import { Option } from "./Option";
21
- import userEvent from "@testing-library/user-event";
22
-
23
- const defaultParams: Props = {
24
- name: "Example select",
25
- children: [
26
- <Option value="option1">Test</Option>,
27
- <Option value="option2">Test2</Option>,
28
- <Option value="option3">Test3</Option>,
29
- <Option value="option4">Test4</Option>,
30
- <Option value="option5">Test5</Option>,
31
- <Option value="option6">Test6</Option>,
32
- <Option value="option7">Test7</Option>,
33
- <Option value="option8">Test8</Option>,
34
- <Option value="option9">Test9</Option>,
35
- <Option value="option10">Test10</Option>,
36
- <Option value="option11">Test11</Option>,
37
- <Option value="option12">Test12</Option>,
38
- <Option value="option13">Test13</Option>,
39
- <Option value="option14">Test14</Option>,
40
- <Option value="option15">Test15</Option>,
41
- <Option value="option16">Test16</Option>,
42
- <Option value="option17">Test17</Option>
43
- ],
44
- value: "option1",
45
- searchInputProps: { "data-testid": "search-input" },
46
- // @ts-ignore it does exist Typescript, pls.
47
- selectButtonProps: { "data-testid": "select-button" }
48
- };
49
-
50
- const createSelect = (params?: (defaultParams: Props) => Props) => {
51
- let parameters: Props = defaultParams;
52
- if (params) {
53
- parameters = params(defaultParams);
54
- }
55
- const queries = render(<SelectComponent {...parameters} data-testid="select" />);
56
- const select = queries.getByTestId("select");
57
- const button = queries.getByTestId("select-button");
58
- const list = select.querySelector('ul[role="listbox"]');
59
- const dropdownWrapper = select.querySelector(".list-wrapper");
60
-
61
- return {
62
- ...queries,
63
- select,
64
- button,
65
- list,
66
- dropdownWrapper
67
- };
68
- };
69
-
70
- describe("Select should render", () => {
71
- it("renders with 5 options and proper attributes", async () => {
72
- const { select, button, list, dropdownWrapper } = createSelect(defaultParams => ({
73
- ...defaultParams,
74
- children: [
75
- <Option value="option1">Test</Option>,
76
- <Option value="option2">Test2</Option>,
77
- <Option value="option3">Test3</Option>,
78
- <Option value="option4">Test4</Option>,
79
- <Option value="option5">Test5</Option>
80
- ],
81
- placeholder: "Placeholder",
82
- value: ""
83
- }));
84
-
85
- expect(dropdownWrapper).toHaveStyle({ "pointer-events": "none" });
86
-
87
- if (button) {
88
- await userEvent.click(button);
89
- }
90
-
91
- expect(select).toBeDefined();
92
- expect(select.querySelector(".placeholder")).toBeInTheDocument();
93
- expect(button?.getAttribute("aria-expanded")).toBe("true");
94
- expect(button?.getAttribute("aria-disabled")).toBe("false");
95
- expect(list).toBeDefined();
96
- expect(list?.querySelectorAll("li[role='option']").length).toBe(5);
97
- expect(dropdownWrapper).toHaveStyle({ "pointer-events": "auto" });
98
- });
99
-
100
- it("should be disabled", () => {
101
- const { select, button } = createSelect(defaultParams => ({
102
- ...defaultParams,
103
- disabled: true
104
- }));
105
-
106
- expect(select).toHaveClass("disabled");
107
- expect(button).toHaveAttribute("aria-disabled", "true");
108
- expect(button).toHaveAttribute("disabled");
109
- });
110
-
111
- it("should have an error", () => {
112
- const { select, button } = createSelect(defaultParams => ({
113
- ...defaultParams,
114
- error: true,
115
- value: "option4"
116
- }));
117
-
118
- expect(select).toHaveClass("error");
119
- expect(button).toHaveAttribute("aria-invalid", "true");
120
- expect(select.querySelector("[data-clear]")).not.toBeInTheDocument();
121
- });
122
-
123
- it("should have a success icon when success state", () => {
124
- const { button } = createSelect(defaultParams => ({
125
- ...defaultParams,
126
- success: true
127
- }));
128
-
129
- const icon = button.querySelector("[class*='icon-checkmark-circle-alt']");
130
- expect(button).toHaveClass("success");
131
- expect(icon).toBeDefined();
132
- });
133
- });
134
-
135
- describe("ref should work", () => {
136
- it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
137
- const ExampleComponent = ({
138
- propagateRef
139
- }: {
140
- propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
141
- }) => {
142
- const ref = useRef(null);
143
-
144
- useEffect(() => {
145
- if (ref.current) {
146
- propagateRef && propagateRef(ref);
147
- }
148
- }, [ref]);
149
-
150
- return <SelectComponent {...defaultParams} data-ref="testing" ref={ref} />;
151
- };
152
-
153
- const refCheck = (ref: React.RefObject<HTMLElement>) => {
154
- expect(ref.current!.nodeName).toBe("SELECT");
155
- };
156
-
157
- render(<ExampleComponent propagateRef={refCheck} />);
158
- });
159
- });
160
-
161
- describe("Select should render with search", () => {
162
- it("shows the search and filtering works", async () => {
163
- const { select, list, button, getByTestId } = createSelect();
164
-
165
- const searchInput = getByTestId("search-input");
166
-
167
- if (button) {
168
- await userEvent.click(button);
169
- }
170
-
171
- expect(select).toBeTruthy();
172
- expect(searchInput).toBeTruthy();
173
- expect(list?.querySelectorAll("li[role='option']").length).toBe(17);
174
-
175
- if (searchInput) {
176
- await userEvent.type(searchInput, "17");
177
- }
178
-
179
- expect(list?.querySelectorAll("li[role='option']").length).toBe(1);
180
- expect(list?.querySelector("li[role='option']")?.innerHTML).toBe("Test17");
181
- });
182
- });
183
-
184
- describe("Selecting options using keyboard", () => {
185
- it("should focus through list items and select on enterpress", async () => {
186
- const onChangeHandler = jest.fn();
187
- const { select, button } = createSelect(defaultParams => ({
188
- ...defaultParams,
189
- onChange: onChangeHandler
190
- }));
191
-
192
- await userEvent.click(button);
193
-
194
- expect(button).toHaveAttribute("aria-expanded", "true");
195
-
196
- await userEvent.keyboard("{arrowdown}");
197
- await userEvent.keyboard("{arrowdown}");
198
- await userEvent.keyboard("{enter}");
199
-
200
- expect(button).toHaveAttribute("aria-expanded", "false");
201
-
202
- expect(onChangeHandler).toHaveBeenCalled();
203
-
204
- await userEvent.keyboard("{enter}");
205
-
206
- expect(button).toHaveAttribute("aria-expanded", "true");
207
-
208
- await userEvent.keyboard("{arrowdown}");
209
-
210
- expect(select.querySelector('li[data-value="option2"]')).toHaveFocus();
211
-
212
- await userEvent.keyboard("{arrowup}");
213
- await userEvent.keyboard("{arrowup}");
214
- await userEvent.keyboard("{arrowup}");
215
- await userEvent.keyboard("{arrowup}");
216
-
217
- expect(select.querySelector('li[data-value="option15"]')).toHaveFocus();
218
- await userEvent.keyboard("{arrowup}");
219
- expect(select.querySelector('li[data-value="option14"]')).toHaveFocus();
220
-
221
- await userEvent.keyboard("{arrowdown}");
222
- await userEvent.keyboard("{arrowdown}");
223
- await userEvent.keyboard("{arrowdown}");
224
- await userEvent.keyboard("{arrowdown}");
225
-
226
- expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
227
-
228
- await userEvent.keyboard("{escape}");
229
-
230
- expect(button).toHaveAttribute("aria-expanded", "false");
231
- });
232
-
233
- it("should focus through list items and select on spacebar press", async () => {
234
- const onChangeHandler = jest.fn();
235
- const { select, button } = createSelect(defaultParams => ({
236
- ...defaultParams,
237
- onChange: onChangeHandler
238
- }));
239
-
240
- await act(() => {
241
- button.focus();
242
- });
243
-
244
- expect(button).toHaveFocus();
245
-
246
- await userEvent.keyboard("[Space]");
247
-
248
- expect(button).toHaveAttribute("aria-expanded", "true");
249
-
250
- await userEvent.keyboard("{arrowdown}");
251
- await userEvent.keyboard("{arrowdown}");
252
- await userEvent.keyboard("[Space]");
253
-
254
- await waitFor(() => expect(button).toHaveAttribute("aria-expanded", "false"));
255
-
256
- expect(onChangeHandler).toHaveBeenCalled();
257
-
258
- await userEvent.keyboard("[Space]");
259
-
260
- expect(button).toHaveAttribute("aria-expanded", "true");
261
-
262
- await userEvent.keyboard("{arrowdown}");
263
-
264
- expect(select.querySelector('li[data-value="option2"]')).toHaveFocus();
265
-
266
- await userEvent.keyboard("{arrowup}");
267
- await userEvent.keyboard("{arrowup}");
268
- await userEvent.keyboard("{arrowup}");
269
- await userEvent.keyboard("{arrowup}");
270
-
271
- expect(select.querySelector('li[data-value="option15"]')).toHaveFocus();
272
- await userEvent.keyboard("{arrowup}");
273
- expect(select.querySelector('li[data-value="option14"]')).toHaveFocus();
274
-
275
- await userEvent.keyboard("{arrowdown}");
276
- await userEvent.keyboard("{arrowdown}");
277
- await userEvent.keyboard("{arrowdown}");
278
- await userEvent.keyboard("{arrowdown}");
279
-
280
- expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
281
-
282
- await userEvent.keyboard("{escape}");
283
-
284
- expect(button).toHaveAttribute("aria-expanded", "false");
285
- });
286
- });
287
-
288
- describe("Expanded should be false whenever we click the body", () => {
289
- it("closes select on body click", async () => {
290
- const { button } = createSelect();
291
-
292
- if (button) {
293
- await userEvent.click(button);
294
- }
295
-
296
- expect(button).toHaveAttribute("aria-expanded", "true");
297
- await userEvent.click(document.body);
298
- expect(button).toHaveAttribute("aria-expanded", "false");
299
- });
300
- });
301
-
302
- describe("List expansion", () => {
303
- it("should expand upwards", async () => {
304
- const { select, button, dropdownWrapper } = createSelect();
305
-
306
- Object.defineProperty(window, "innerHeight", { value: 500, writable: true });
307
-
308
- select.getBoundingClientRect = () => ({
309
- x: 50,
310
- y: 50,
311
- width: 500,
312
- height: 50,
313
- top: 250,
314
- left: 250,
315
- right: 750,
316
- bottom: 750,
317
- toJSON: () => jest.fn()
318
- });
319
-
320
- if (button) {
321
- await userEvent.click(button);
322
- }
323
-
324
- expect(dropdownWrapper).toHaveStyle({ bottom: "2.75rem" });
325
- });
326
-
327
- it("should expand downwards with a max height set", async () => {
328
- const { select, getByRole, dropdownWrapper } = createSelect();
329
-
330
- dropdownWrapper!.getBoundingClientRect = () => ({
331
- x: 50,
332
- y: 50,
333
- width: 500,
334
- height: 600,
335
- top: 10,
336
- left: 250,
337
- right: 750,
338
- bottom: 50,
339
- toJSON: () => jest.fn()
340
- });
341
-
342
- Object.defineProperty(window, "innerHeight", { value: 500, writable: true });
343
-
344
- select.getBoundingClientRect = () => ({
345
- x: 50,
346
- y: 50,
347
- width: 500,
348
- height: 40,
349
- top: 10,
350
- left: 250,
351
- right: 750,
352
- bottom: 50,
353
- toJSON: () => jest.fn()
354
- });
355
-
356
- await userEvent.click(document.body);
357
-
358
- const button = getByRole("button");
359
- await userEvent.click(button);
360
-
361
- expect(dropdownWrapper).toHaveStyle({ maxHeight: "474px" });
362
- expect(dropdownWrapper).toHaveStyle({ top: "2.75rem" });
363
- });
364
- });
365
-
366
- describe("previously selected item", () => {
367
- it("should have focus", async () => {
368
- const { select, button } = createSelect(defaultParams => ({
369
- ...defaultParams,
370
- value: "option4"
371
- }));
372
-
373
- await act(() => {
374
- button.focus();
375
- });
376
-
377
- const option1 = select.querySelector('li[data-value="option1"]')!;
378
-
379
- await userEvent.keyboard("{enter}");
380
-
381
- expect(button).toHaveAttribute("aria-expanded", "true");
382
- await userEvent.keyboard("{arrowdown}");
383
- await userEvent.keyboard("{arrowdown}");
384
- await userEvent.keyboard("{enter}");
385
-
386
- await userEvent.click(button);
387
-
388
- expect(document.activeElement).toStrictEqual(option1);
389
- });
390
- });
391
-
392
- describe("search input", () => {
393
- it("listens to different keyboard inputs", async () => {
394
- const { button, select } = createSelect();
395
-
396
- const searchInput = document.querySelector(".select-search")!;
397
-
398
- await userEvent.click(button);
399
-
400
- await act(() => {
401
- (searchInput as HTMLElement).focus();
402
- });
403
-
404
- await userEvent.keyboard("{arrowup}");
405
- expect(select.querySelector('li[data-value="option17"]')).toHaveFocus();
406
- });
407
-
408
- it("move focus with arrowdown", async () => {
409
- const { button, select } = createSelect();
410
-
411
- const searchInput = document.querySelector(".select-search")!;
412
-
413
- await userEvent.click(button);
414
-
415
- await act(() => {
416
- (searchInput as HTMLElement).focus();
417
- });
418
-
419
- await userEvent.keyboard("{arrowdown}");
420
- expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
421
- });
422
-
423
- it("select with enter", async () => {
424
- const { button, select } = createSelect();
425
-
426
- const searchInput = document.querySelector(".select-search")!;
427
-
428
- await userEvent.click(button);
429
-
430
- await act(() => {
431
- (searchInput as HTMLElement).focus();
432
- });
433
-
434
- await userEvent.keyboard("{enter}");
435
- expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
436
- });
437
-
438
- it("expand list with arrowdown", async () => {
439
- const { button } = createSelect();
440
-
441
- await act(() => {
442
- button.focus();
443
- });
444
-
445
- await userEvent.keyboard("{arrowdown}");
446
-
447
- expect(button).toHaveAttribute("aria-expanded", "true");
448
- });
449
-
450
- it("expand list with arrowup", async () => {
451
- const { button } = createSelect();
452
-
453
- await act(() => {
454
- button.focus();
455
- });
456
-
457
- await userEvent.keyboard("{arrowup}");
458
-
459
- expect(button).toHaveAttribute("aria-expanded", "true");
460
- });
461
-
462
- it("expand list with space", async () => {
463
- const { button } = createSelect();
464
-
465
- await act(() => {
466
- button.focus();
467
- });
468
-
469
- await userEvent.keyboard("[space]");
470
-
471
- await waitFor(() => expect(button).toHaveAttribute("aria-expanded", "true"));
472
- });
473
-
474
- it("closes on escape", async () => {
475
- const { button } = createSelect();
476
-
477
- const searchInput = document.querySelector(".select-search")!;
478
-
479
- await userEvent.click(button);
480
-
481
- await userEvent.tab();
482
-
483
- await waitFor(() => expect(searchInput).toHaveFocus());
484
-
485
- await userEvent.keyboard("{escape}");
486
-
487
- expect(button).toHaveAttribute("aria-expanded", "false");
488
- });
489
-
490
- it("closes on tab", async () => {
491
- const { button } = createSelect();
492
-
493
- const searchInput = document.querySelector(".select-search")!;
494
-
495
- await userEvent.click(button);
496
-
497
- await userEvent.tab();
498
-
499
- expect(searchInput).toHaveFocus();
500
-
501
- await userEvent.tab();
502
- });
503
- });
504
-
505
- describe("home and end keys work", () => {
506
- it("goes to home and end", async () => {
507
- const { button } = createSelect();
508
-
509
- await userEvent.click(button);
510
-
511
- const firstOption = document.querySelector('li[data-value="option1"]');
512
- const lastOption = document.querySelector('li[data-value="option17"]');
513
- await userEvent.keyboard("{end}");
514
-
515
- expect(lastOption).toHaveFocus();
516
-
517
- await userEvent.keyboard("{home}");
518
-
519
- expect(firstOption).toHaveFocus();
520
- });
521
- });
522
-
523
- describe("search input props work", () => {
524
- it("adds a classname", () => {
525
- createSelect(defaultParams => ({
526
- ...defaultParams,
527
- searchInputProps: { wrapperProps: { className: "test-wrapper-classname" } }
528
- }));
529
-
530
- expect(document.querySelector(".test-wrapper-classname")).toBeInTheDocument();
531
- });
532
- });
533
-
534
- describe("meta arrow left and right", () => {
535
- it("goes to the last item in the list when pressing meta right", async () => {
536
- const { button } = createSelect();
537
-
538
- await act(() => {
539
- button.focus();
540
- });
541
-
542
- await userEvent.keyboard("{enter}");
543
-
544
- expect(button).toHaveAttribute("aria-expanded", "true");
545
-
546
- await userEvent.keyboard("{Meta>}{arrowright}");
547
-
548
- await waitFor(() => expect(document.querySelector('li[data-value="option17"]')).toHaveFocus());
549
- });
550
-
551
- it("goes to the first item in the list when pressing meta left", async () => {
552
- const { button } = createSelect();
553
-
554
- await userEvent.click(button);
555
-
556
- await userEvent.keyboard("{Meta>}{arrowright}");
557
-
558
- await waitFor(() => expect(document.querySelector('li[data-value="option17"]')).toHaveFocus());
559
-
560
- await userEvent.keyboard("{Meta>}{arrowleft}");
561
-
562
- expect(document.querySelector('li[data-value="option1"]')).toHaveFocus();
563
- });
564
- });
@@ -1,124 +0,0 @@
1
- /*
2
- * Copyright 2022 OneWelcome B.V.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import React, { useEffect, useRef } from "react";
18
- import { Textarea, Props } from "./Textarea";
19
- import { render, waitFor } from "@testing-library/react";
20
- import userEvent from "@testing-library/user-event";
21
-
22
- const createTextarea = (params?: Props) => {
23
- const queries = render(<Textarea data-testid="textarea" {...params} />);
24
- const textarea = queries.getByRole("textbox");
25
-
26
- return {
27
- ...queries,
28
- textarea
29
- };
30
- };
31
-
32
- describe("Textarea should render", () => {
33
- it("renders without crashing", () => {
34
- const { textarea } = createTextarea();
35
- expect(textarea).toBeTruthy();
36
- });
37
- });
38
-
39
- describe("ref should work", () => {
40
- it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
41
- const ExampleComponent = ({
42
- propagateRef
43
- }: {
44
- propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
45
- }) => {
46
- const ref = useRef(null);
47
-
48
- useEffect(() => {
49
- if (ref.current) {
50
- propagateRef && propagateRef(ref);
51
- }
52
- }, [ref]);
53
-
54
- return <Textarea data-ref="testing" ref={ref} />;
55
- };
56
-
57
- const refCheck = (ref: React.RefObject<HTMLElement>) => {
58
- expect(ref.current).toHaveAttribute("data-ref", "testing");
59
- };
60
-
61
- render(<ExampleComponent propagateRef={refCheck} />);
62
- });
63
- });
64
-
65
- describe("Textarea properties", () => {
66
- it("is disabled", () => {
67
- const { textarea } = createTextarea({ disabled: true });
68
-
69
- expect(textarea).toHaveAttribute("disabled");
70
- });
71
-
72
- it("has 20 columns", () => {
73
- const { textarea } = createTextarea({ cols: 20 });
74
-
75
- expect(textarea).toHaveAttribute("cols", "20");
76
- });
77
-
78
- it("has autofocus", () => {
79
- const { textarea } = createTextarea({ autoFocus: true });
80
-
81
- waitFor(() => expect(textarea).toHaveAttribute("autofocus"));
82
- });
83
- });
84
-
85
- describe("Textarea listeners", () => {
86
- it("executes the functions", async () => {
87
- const onChangeHandler = jest.fn();
88
- const onKeyUpHandler = jest.fn();
89
- const onKeyDownHandler = jest.fn();
90
-
91
- const { textarea } = createTextarea({
92
- onKeyUp: onKeyUpHandler,
93
- onKeyDown: onKeyDownHandler,
94
- onChange: onChangeHandler
95
- });
96
-
97
- textarea.focus();
98
-
99
- expect(textarea).toHaveFocus();
100
-
101
- await userEvent.keyboard("test");
102
-
103
- expect(onKeyUpHandler).toHaveBeenCalled();
104
- expect(onKeyDownHandler).toHaveBeenCalled();
105
- expect(onChangeHandler).toHaveBeenCalled();
106
- });
107
- });
108
-
109
- describe("Error status", () => {
110
- it("has error class, and an icon", () => {
111
- const { textarea } = createTextarea({ error: true });
112
-
113
- expect(textarea).toHaveClass("error");
114
- expect(textarea.nextElementSibling).toHaveClass("icon-error-circle");
115
- });
116
- });
117
-
118
- describe("Success status", () => {
119
- it("success icon should be visible", () => {
120
- const { textarea } = createTextarea({ success: true });
121
- const icon = textarea.parentElement?.querySelector(".icon-checkmark-circle-alt");
122
- expect(icon).toBeDefined();
123
- });
124
- });