@spothero/ui 15.10.8 → 16.0.0-beta.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 (317) hide show
  1. package/.eslintignore +2 -1
  2. package/dex.config.js +1 -1
  3. package/jest.config.json +1 -2
  4. package/package.json +8 -24
  5. package/styles/{v2/components → components}/Accordion/Accordion.stories.js +2 -2
  6. package/styles/{v2/components → components}/Accordion/styles/button.js +1 -1
  7. package/styles/{v2/components → components}/Alert/Alert.jsx +2 -2
  8. package/styles/{v2/components → components}/AutoSuggestSelect/AutoSuggestSelect.jsx +7 -0
  9. package/styles/{v2/components → components}/Button/stories/button.js +1 -1
  10. package/styles/{v2/components → components}/Button/stories/overview.js +1 -1
  11. package/styles/{v2/components → components}/FormControl/FormControl.jsx +2 -0
  12. package/styles/{v2/components → components}/Grid/Grid.stories.js +1 -1
  13. package/styles/{v2/components → components}/Heading/Heading.styles.js +1 -1
  14. package/styles/{v2/components → components}/Image/Image.jsx +23 -2
  15. package/styles/{v2/components → components}/Link/Link.stories.js +2 -2
  16. package/styles/{v2/components → components}/List/List.stories.js +2 -2
  17. package/styles/{v2/components → components}/Modal/Modal.jsx +0 -1
  18. package/styles/{v2/components → components}/Modal/Modal.stories.js +4 -4
  19. package/styles/{v2/components → components}/Popover/Popover.stories.js +1 -1
  20. package/styles/{v2/components → components}/Popover/styles/index.js +1 -1
  21. package/styles/{v2/components/Popover/styles/popper.js → components/Popover/styles/popover-content.js} +8 -5
  22. package/styles/components/Popover/styles/popper.js +5 -0
  23. package/styles/{v2/components → components}/Skeleton/index.js +1 -1
  24. package/styles/{v2/components → components}/Spinner/Spinner.stories.js +1 -1
  25. package/styles/{v2/components → components}/Table/Table.styles.js +1 -1
  26. package/styles/{v2/components → components}/Tabs/Tabs.jsx +2 -3
  27. package/styles/{v2/components → components}/Tabs/combineSizeWithVariant.js +5 -3
  28. package/styles/{v2/components → components}/Text/Text.styles.js +1 -1
  29. package/styles/{v2/components → components}/Text/combineAsWithVariant.js +1 -1
  30. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.jsx +2 -2
  31. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.stories.js +2 -2
  32. package/v2/index.js +1 -1
  33. package/v2/index.js.map +1 -1
  34. package/backlog/Alert/Alert.js +0 -37
  35. package/backlog/AutoSuggestInput/AutoSuggestInput.js +0 -474
  36. package/backlog/AutoSuggestInput/AutoSuggestItem.js +0 -99
  37. package/backlog/AutoSuggestInput/AutoSuggestList.js +0 -126
  38. package/backlog/Badge/Badge.js +0 -28
  39. package/backlog/Chart/Chart.js +0 -211
  40. package/backlog/Checkbox/Checkbox.js +0 -167
  41. package/backlog/DateTime/DatePicker.js +0 -279
  42. package/backlog/DateTime/DatePickerCalendar.js +0 -199
  43. package/backlog/DateTime/DatePickerCalendarNavigation.js +0 -102
  44. package/backlog/DateTime/DatePickerCalendarWithRange.js +0 -241
  45. package/backlog/DateTime/DateTimePicker.js +0 -216
  46. package/backlog/DateTime/DateTimeRangePicker.js +0 -530
  47. package/backlog/DateTime/TimePicker.js +0 -180
  48. package/backlog/DateTime/date-time-assertions.js +0 -66
  49. package/backlog/DateTime/index.js +0 -55
  50. package/backlog/ErrorBoundary/ErrorBoundary.js +0 -125
  51. package/backlog/Flyout/Flyout.js +0 -198
  52. package/backlog/Form/Form.js +0 -193
  53. package/backlog/Form/FormElementError.js +0 -24
  54. package/backlog/Form/FormGroup.js +0 -30
  55. package/backlog/Form/FormGroupError.js +0 -28
  56. package/backlog/Form/index.js +0 -39
  57. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +0 -253
  58. package/backlog/GooglePlacesSearchInput/PoweredByGoogle.js +0 -38
  59. package/backlog/GooglePlacesSearchInput/index.js +0 -23
  60. package/backlog/HorizontalRule/HorizontalRule.js +0 -30
  61. package/backlog/Label/Label.js +0 -31
  62. package/backlog/Notification/Notification.js +0 -178
  63. package/backlog/Notification/NotificationContainer.js +0 -131
  64. package/backlog/Notification/NotificationPropTypes.js +0 -37
  65. package/backlog/Notification/index.js +0 -23
  66. package/backlog/PasswordControl/PasswordControl.js +0 -201
  67. package/backlog/Portal/Portal.js +0 -110
  68. package/backlog/PulseLoader/PulseLoader.js +0 -62
  69. package/backlog/Radio/Radio.js +0 -135
  70. package/backlog/Radio/RadioGroup.js +0 -123
  71. package/backlog/Radio/index.js +0 -23
  72. package/backlog/RenderInBody/RenderInBody.js +0 -103
  73. package/backlog/Select/Select.js +0 -275
  74. package/backlog/Select/SelectItemPropTypes.js +0 -32
  75. package/backlog/Select/index.js +0 -23
  76. package/backlog/SelectControlled/SelectControlled.js +0 -270
  77. package/backlog/SelectControlled/index.js +0 -15
  78. package/backlog/Sprite/Sprite.js +0 -24
  79. package/backlog/Tabs/Tab.js +0 -94
  80. package/backlog/Tabs/TabContent.js +0 -56
  81. package/backlog/Tabs/TabNavigation.js +0 -108
  82. package/backlog/Tabs/TabPanel.js +0 -29
  83. package/backlog/Tabs/Tabs.js +0 -126
  84. package/backlog/Tabs/index.js +0 -47
  85. package/backlog/TextArea/TextArea.js +0 -155
  86. package/backlog/TextInput/TextInput.js +0 -230
  87. package/backlog/TextInput/TextInputPropTypes.js +0 -114
  88. package/backlog/TextInput/index.js +0 -23
  89. package/backlog/Tooltip/Tooltip.js +0 -249
  90. package/backlog/index.js +0 -393
  91. package/backlog/v1/components/Button/Button.js +0 -64
  92. package/backlog/v1/components/Button/button-props.js +0 -48
  93. package/backlog/v1/components/Image/Image.js +0 -193
  94. package/backlog/v1/components/Loader/Loader.js +0 -51
  95. package/backlog/v1/components/Modal/Modal.js +0 -325
  96. package/backlog/v1/components/Modal/ModalContent.js +0 -154
  97. package/backlog/v1/components/Modal/ModalFooter.js +0 -89
  98. package/backlog/v1/components/Modal/index.js +0 -31
  99. package/backlog/v1/components/Panel/Panel.js +0 -209
  100. package/backlog/v1/components/Table/Table.js +0 -336
  101. package/backlog/v1/components/Table/TableCell.js +0 -28
  102. package/backlog/v1/components/Table/TableCellPropTypes.js +0 -22
  103. package/backlog/v1/components/Table/TableControls.js +0 -56
  104. package/backlog/v1/components/Table/TableFooter.js +0 -63
  105. package/backlog/v1/components/Table/TableHeading.js +0 -126
  106. package/backlog/v1/components/Table/TableHeadingPropTypes.js +0 -35
  107. package/backlog/v1/components/Table/TableSortSelector.js +0 -125
  108. package/backlog/v1/components/Table/TableSortType.js +0 -11
  109. package/backlog/v1/components/Table/index.js +0 -47
  110. package/backlog/v1/components/TextButton/TextButton.js +0 -74
  111. package/backlog/v1/components/index.js +0 -75
  112. package/backlog/v1/utils/deprecate.js +0 -61
  113. package/styles/Alert/_Alert.scss +0 -51
  114. package/styles/AutoSuggestInput/_AutoSuggestInput.scss +0 -116
  115. package/styles/Badge/_Badge.scss +0 -33
  116. package/styles/Chart/_Chart.scss +0 -105
  117. package/styles/Chart/_chartist-settings.scss +0 -131
  118. package/styles/Chart/_chartist.scss +0 -295
  119. package/styles/Checkbox/_Checkbox.scss +0 -173
  120. package/styles/DateTime/_DatePicker.scss +0 -61
  121. package/styles/DateTime/_DatePickerCalendar.scss +0 -159
  122. package/styles/DateTime/_DateTime.scss +0 -4
  123. package/styles/DateTime/_DateTimePicker.scss +0 -46
  124. package/styles/DateTime/_TimePicker.scss +0 -30
  125. package/styles/ErrorBoundary/_ErrorBoundary.scss +0 -18
  126. package/styles/Flyout/_Flyout.scss +0 -73
  127. package/styles/Form/_Form.scss +0 -53
  128. package/styles/GooglePlacesSearchInput/_GooglePlacesSearchInput.scss +0 -3
  129. package/styles/GooglePlacesSearchInput/_PoweredByGoogle.scss +0 -21
  130. package/styles/HorizontalRule/_HorizontalRule.scss +0 -48
  131. package/styles/Label/_Label.scss +0 -6
  132. package/styles/Notification/_Notification.scss +0 -113
  133. package/styles/PasswordControl/_PasswordControl.scss +0 -86
  134. package/styles/PulseLoader/_PulseLoader.scss +0 -60
  135. package/styles/Radio/_Radio.scss +0 -93
  136. package/styles/Select/_Select.scss +0 -94
  137. package/styles/Tabs/_Tabs.scss +0 -57
  138. package/styles/TextArea/_TextArea.scss +0 -26
  139. package/styles/TextInput/_TextInput.scss +0 -43
  140. package/styles/Tooltip/_Tooltip.scss +0 -108
  141. package/styles/_index.scss +0 -34
  142. package/styles/common/sass/_control-sizing.scss +0 -5
  143. package/styles/common/sass/_disable-scrolling.scss +0 -7
  144. package/styles/common/sass/_forms.scss +0 -72
  145. package/styles/index.js +0 -50
  146. package/styles/v1/components/Button/Button.jsx +0 -48
  147. package/styles/v1/components/Button/Button.spec.js +0 -76
  148. package/styles/v1/components/Button/_Button.scss +0 -178
  149. package/styles/v1/components/Button/button-props.js +0 -30
  150. package/styles/v1/components/Button/stories/button.js +0 -20
  151. package/styles/v1/components/Button/stories/index.stories.js +0 -92
  152. package/styles/v1/components/Button/stories/overview.js +0 -87
  153. package/styles/v1/components/Button/stories/types.js +0 -31
  154. package/styles/v1/components/Image/Image.jsx +0 -175
  155. package/styles/v1/components/Image/Image.spec.js +0 -113
  156. package/styles/v1/components/Image/_Image.scss +0 -24
  157. package/styles/v1/components/Image/stories/Cloudinary.stories.js +0 -39
  158. package/styles/v1/components/Image/stories/Display.stories.js +0 -92
  159. package/styles/v1/components/Loader/Loader.jsx +0 -54
  160. package/styles/v1/components/Loader/Loader.spec.js +0 -67
  161. package/styles/v1/components/Loader/_Loader.scss +0 -18
  162. package/styles/v1/components/Loader/stories/Display.stories.js +0 -55
  163. package/styles/v1/components/Modal/Modal.jsx +0 -315
  164. package/styles/v1/components/Modal/Modal.spec.js +0 -293
  165. package/styles/v1/components/Modal/ModalContent.jsx +0 -126
  166. package/styles/v1/components/Modal/ModalFooter.jsx +0 -53
  167. package/styles/v1/components/Modal/_Modal.scss +0 -262
  168. package/styles/v1/components/Modal/index.js +0 -3
  169. package/styles/v1/components/Modal/stories/Content.stories.js +0 -314
  170. package/styles/v1/components/Modal/stories/Display.stories.js +0 -208
  171. package/styles/v1/components/Modal/stories/Methods.stories.js +0 -44
  172. package/styles/v1/components/Modal/stories/Width.stories.js +0 -82
  173. package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +0 -21
  174. package/styles/v1/components/Panel/Panel.jsx +0 -202
  175. package/styles/v1/components/Panel/Panel.spec.js +0 -196
  176. package/styles/v1/components/Panel/_Panel.scss +0 -55
  177. package/styles/v1/components/Panel/stories/Display.stories.js +0 -82
  178. package/styles/v1/components/Panel/stories/Methods.stories.js +0 -76
  179. package/styles/v1/components/Table/Table.jsx +0 -367
  180. package/styles/v1/components/Table/Table.spec.js +0 -526
  181. package/styles/v1/components/Table/TableCell.jsx +0 -17
  182. package/styles/v1/components/Table/TableCellPropTypes.js +0 -10
  183. package/styles/v1/components/Table/TableControls.jsx +0 -61
  184. package/styles/v1/components/Table/TableFooter.jsx +0 -72
  185. package/styles/v1/components/Table/TableHeading.jsx +0 -58
  186. package/styles/v1/components/Table/TableHeadingPropTypes.js +0 -20
  187. package/styles/v1/components/Table/TableSortSelector.jsx +0 -63
  188. package/styles/v1/components/Table/TableSortType.js +0 -4
  189. package/styles/v1/components/Table/_Table.scss +0 -263
  190. package/styles/v1/components/Table/index.js +0 -5
  191. package/styles/v1/components/Table/stories/Display.stories.js +0 -194
  192. package/styles/v1/components/Table/stories/Methods.stories.js +0 -141
  193. package/styles/v1/components/Table/stories/helpers/TableCellEmail.jsx +0 -25
  194. package/styles/v1/components/Table/stories/helpers/TableCustomRow.jsx +0 -35
  195. package/styles/v1/components/Table/stories/helpers/TableHeadingEmail.jsx +0 -20
  196. package/styles/v1/components/Table/stories/helpers/table-data.js +0 -26
  197. package/styles/v1/components/Table/stories/helpers/table-headers.js +0 -14
  198. package/styles/v1/components/TextButton/TextButton.jsx +0 -78
  199. package/styles/v1/components/TextButton/TextButton.spec.js +0 -95
  200. package/styles/v1/components/TextButton/_TextButton.scss +0 -114
  201. package/styles/v1/components/TextButton/stories/Display.stories.js +0 -46
  202. package/styles/v1/components/index.js +0 -7
  203. package/styles/v1/utils/deprecate.js +0 -45
  204. package/styles/v2/components/Popover/styles/popover-content.js +0 -8
  205. package/styles/v2/components/index.js +0 -70
  206. package/styles/v2/components/styles.js +0 -21
  207. package/styles/v2/theme/global.js +0 -118
  208. package/styles/v2/theme/index.js +0 -27
  209. package/styles/v2/utils/Spaces.js +0 -16
  210. package/v1/assets-manifest.json +0 -5
  211. package/v1/index.html +0 -1
  212. package/v1/index.js +0 -3
  213. package/v1/index.js.LICENSE.txt +0 -23
  214. package/v1/index.js.map +0 -1
  215. /package/styles/{v2/components → components}/Accordion/Accordion.jsx +0 -0
  216. /package/styles/{v2/components → components}/Accordion/index.js +0 -0
  217. /package/styles/{v2/components → components}/Accordion/styles/container.js +0 -0
  218. /package/styles/{v2/components → components}/Accordion/styles/index.js +0 -0
  219. /package/styles/{v2/components → components}/Accordion/styles/panel.js +0 -0
  220. /package/styles/{v2/components → components}/Alert/Alert.stories.js +0 -0
  221. /package/styles/{v2/components → components}/Alert/index.js +0 -0
  222. /package/styles/{v2/components → components}/Alert/styles/index.js +0 -0
  223. /package/styles/{v2/components → components}/AutoSuggestSelect/index.js +0 -0
  224. /package/styles/{v2/components → components}/Badge/Badge.jsx +0 -0
  225. /package/styles/{v2/components → components}/Badge/Badge.stories.js +0 -0
  226. /package/styles/{v2/components → components}/Badge/styles/index.js +0 -0
  227. /package/styles/{v2/components → components}/Button/Button.jsx +0 -0
  228. /package/styles/{v2/components → components}/Button/Button.spec.js +0 -0
  229. /package/styles/{v2/components → components}/Button/Button.styles.js +0 -0
  230. /package/styles/{v2/components → components}/Button/button-props.js +0 -0
  231. /package/styles/{v2/components → components}/Button/index.js +0 -0
  232. /package/styles/{v2/components → components}/Button/stories/index.stories.js +0 -0
  233. /package/styles/{v2/components → components}/Card/Card.jsx +0 -0
  234. /package/styles/{v2/components → components}/Card/Card.stories.js +0 -0
  235. /package/styles/{v2/components → components}/Checkbox/Checkbox.jsx +0 -0
  236. /package/styles/{v2/components → components}/Checkbox/Checkbox.stories.js +0 -0
  237. /package/styles/{v2/components → components}/Checkbox/index.js +0 -0
  238. /package/styles/{v2/components → components}/Checkbox/styles/index.js +0 -0
  239. /package/styles/{v2/components → components}/Container/Container.jsx +0 -0
  240. /package/styles/{v2/components → components}/Container/Container.stories.js +0 -0
  241. /package/styles/{v2/components → components}/Container/Container.styles.js +0 -0
  242. /package/styles/{v2/components → components}/Divider/Divider.jsx +0 -0
  243. /package/styles/{v2/components → components}/Divider/Divider.stories.js +0 -0
  244. /package/styles/{v2/components → components}/Divider/Divider.styles.js +0 -0
  245. /package/styles/{v2/components → components}/Grid/Grid.jsx +0 -0
  246. /package/styles/{v2/components → components}/Grid/Grid.styles.js +0 -0
  247. /package/styles/{v2/components → components}/Grid/GridItem.jsx +0 -0
  248. /package/styles/{v2/components → components}/Grid/GridItem.styles.js +0 -0
  249. /package/styles/{v2/components → components}/Grid/index.js +0 -0
  250. /package/styles/{v2/components → components}/Heading/Heading.jsx +0 -0
  251. /package/styles/{v2/components → components}/Heading/Heading.stories.js +0 -0
  252. /package/styles/{v2/components → components}/Icon/Icon.jsx +0 -0
  253. /package/styles/{v2/components → components}/Icon/Icon.stories.js +0 -0
  254. /package/styles/{v2/components → components}/Image/Image.spec.js +0 -0
  255. /package/styles/{v2/components → components}/Image/Image.stories.js +0 -0
  256. /package/styles/{v2/components → components}/Input/Input.jsx +0 -0
  257. /package/styles/{v2/components → components}/Input/Input.stories.js +0 -0
  258. /package/styles/{v2/components → components}/Input/index.js +0 -0
  259. /package/styles/{v2/components → components}/Input/styles/index.js +0 -0
  260. /package/styles/{v2/components → components}/Link/Link.jsx +0 -0
  261. /package/styles/{v2/components → components}/Link/Link.styles.js +0 -0
  262. /package/styles/{v2/components → components}/List/List.jsx +0 -0
  263. /package/styles/{v2/components → components}/List/index.js +0 -0
  264. /package/styles/{v2/components → components}/List/styles/index.js +0 -0
  265. /package/styles/{v2/components → components}/List/styles/item.styles.js +0 -0
  266. /package/styles/{v2/components → components}/Loader/Loader.jsx +0 -0
  267. /package/styles/{v2/components → components}/Loader/Loader.stories.js +0 -0
  268. /package/styles/{v2/components → components}/Modal/index.js +0 -0
  269. /package/styles/{v2/components → components}/Modal/styles/body.js +0 -0
  270. /package/styles/{v2/components → components}/Modal/styles/closeButton.js +0 -0
  271. /package/styles/{v2/components → components}/Modal/styles/dialog.js +0 -0
  272. /package/styles/{v2/components → components}/Modal/styles/dialogContainer.js +0 -0
  273. /package/styles/{v2/components → components}/Modal/styles/footer.js +0 -0
  274. /package/styles/{v2/components → components}/Modal/styles/header.js +0 -0
  275. /package/styles/{v2/components → components}/Modal/styles/index.js +0 -0
  276. /package/styles/{v2/components → components}/Modal/styles/overlay.js +0 -0
  277. /package/styles/{v2/components → components}/Popover/Popover.jsx +0 -0
  278. /package/styles/{v2/components → components}/Popover/PopoverArrow.jsx +0 -0
  279. /package/styles/{v2/components → components}/Popover/PopoverCloseButton.jsx +0 -0
  280. /package/styles/{v2/components → components}/Popover/PopoverContent.jsx +0 -0
  281. /package/styles/{v2/components → components}/Popover/index.js +0 -0
  282. /package/styles/{v2/components → components}/Popover/styles/popover-arrow.js +0 -0
  283. /package/styles/{v2/components → components}/Popover/styles/popover-body.js +0 -0
  284. /package/styles/{v2/components → components}/Popover/styles/popover-close-button.js +0 -0
  285. /package/styles/{v2/components → components}/Popover/styles/popover-header.js +0 -0
  286. /package/styles/{v2/components → components}/Radio/Radio.jsx +0 -0
  287. /package/styles/{v2/components → components}/Radio/Radio.stories.js +0 -0
  288. /package/styles/{v2/components → components}/Radio/RadioGroup.jsx +0 -0
  289. /package/styles/{v2/components → components}/Radio/index.js +0 -0
  290. /package/styles/{v2/components → components}/Radio/styles/index.js +0 -0
  291. /package/styles/{v2/components → components}/Select/Select.jsx +0 -0
  292. /package/styles/{v2/components → components}/Select/Select.stories.js +0 -0
  293. /package/styles/{v2/components → components}/Select/index.js +0 -0
  294. /package/styles/{v2/components → components}/Select/styles/index.js +0 -0
  295. /package/styles/{v2/components → components}/Skeleton/Skeleton.stories.jsx +0 -0
  296. /package/styles/{v2/components → components}/Skeleton/Skeleton.styles.js +0 -0
  297. /package/styles/{v2/components → components}/Spinner/Spinner.jsx +0 -0
  298. /package/styles/{v2/components → components}/Spinner/Spinner.styles.js +0 -0
  299. /package/styles/{v2/components → components}/Switch/Switch.jsx +0 -0
  300. /package/styles/{v2/components → components}/Switch/Switch.stories.js +0 -0
  301. /package/styles/{v2/components → components}/Switch/index.js +0 -0
  302. /package/styles/{v2/components → components}/Switch/styles/index.js +0 -0
  303. /package/styles/{v2/components → components}/Table/Table.jsx +0 -0
  304. /package/styles/{v2/components → components}/Table/Table.stories.js +0 -0
  305. /package/styles/{v2/components → components}/Table/index.js +0 -0
  306. /package/styles/{v2/components → components}/Tabs/Tabs.stories.js +0 -0
  307. /package/styles/{v2/components → components}/Tabs/index.js +0 -0
  308. /package/styles/{v2/components → components}/Tabs/styles/index.js +0 -0
  309. /package/styles/{v2/components → components}/Text/Text.jsx +0 -0
  310. /package/styles/{v2/components → components}/Text/Text.stories.js +0 -0
  311. /package/styles/{v2/components → components}/Text/options.js +0 -0
  312. /package/styles/{v2/theme → theme}/base/breakpoints.js +0 -0
  313. /package/styles/{v2/theme → theme}/base/colors.js +0 -0
  314. /package/styles/{v2/theme → theme}/base/index.js +0 -0
  315. /package/styles/{v2/theme → theme}/base/sizes.js +0 -0
  316. /package/styles/{v2/theme → theme}/base/typography.js +0 -0
  317. /package/styles/{v2/theme → theme}/base/zindices.js +0 -0
@@ -1,526 +0,0 @@
1
- import TableSortType from './TableSortType';
2
-
3
- const {ASC, DESC} = TableSortType;
4
-
5
- describe('<Table />', () => {
6
- context('Display', () => {
7
- context('Default', () => {
8
- beforeEach(() => {
9
- cy.visitStory('v1/Table/Display', 'Default');
10
- });
11
-
12
- it('Renders table and data', () => {
13
- cy.viewport('macbook-15')
14
- // make sure table container exists
15
- .get('.Table-container')
16
- // make sure Table component exists
17
- .get('table')
18
- .should('have.class', 'Table')
19
- // make sure heading exists
20
- .get('thead')
21
- .should('have.class', 'TableHead')
22
- // verify heading labels
23
- .get('.TableHeading')
24
- .eq(0)
25
- .should('contain.text', 'First Name')
26
- .get('.TableHeading')
27
- .eq(1)
28
- .should('contain.text', 'Last Name')
29
- .get('.TableHeading')
30
- .eq(2)
31
- .should('contain.text', 'Email')
32
- .get('.TableHeading')
33
- .eq(3)
34
- .should('contain.text', 'Age')
35
- // make sure table body exists
36
- .get('tbody')
37
- .should('have.class', 'TableBody')
38
- // verify TableCell exists
39
- .get('.TableCell')
40
- // verify desktop breakpoints use table-cell display
41
- .should('have.css', 'display', 'table-cell')
42
- // verify first table row
43
- .get('.TableBody > tr')
44
- .eq(0)
45
- .should('contain', 'Tony')
46
- .should('contain', 'Stark')
47
- .should('contain', 'ironman@avengers.com')
48
- .should('contain', '38')
49
- // verify desktop breakpoints use table-row display
50
- .should('have.css', 'display', 'table-row')
51
- // verify Table footer message
52
- .get('.TableFooter')
53
- .should('contain', 'Showing 4 of 4')
54
- // verify TableControls doesn't exist
55
- .get('.TableControls')
56
- .should('not.exist');
57
- });
58
-
59
- it(`Renders tablet table with proper 'card' styling`, () => {
60
- cy.viewport('ipad-2')
61
- // verify TableCell exists
62
- .get('.TableCell')
63
- // verify tablet breakpoints use block display
64
- .should('have.css', 'display', 'block')
65
- // get first table row
66
- .get('.TableBody > tr')
67
- .eq(0)
68
- // verify tablet breakpoints use inline-block display
69
- .should('have.css', 'display', 'inline-block')
70
- // verify TableFooter hides message
71
- .get('.TableFooter-info')
72
- .should('not.be.visible');
73
- });
74
-
75
- it(`Renders mobile table with proper 'card' styling`, () => {
76
- cy.viewport('iphone-6')
77
- // verify TableCell exists
78
- .get('.TableCell')
79
- // verify mobile breakpoints use block display
80
- .should('have.css', 'display', 'block')
81
- // get first table row
82
- .get('.TableBody > tr')
83
- .eq(0)
84
- // verify mobile breakpoints use block display
85
- .should('have.css', 'display', 'block')
86
- // verify TableFooter hides message
87
- .get('.TableFooter-info')
88
- .should('not.be.visible');
89
- });
90
- });
91
-
92
- context('With custom class names', () => {
93
- it('Renders table with custom class names', () => {
94
- cy.visitStory('v1/Table/Display', 'WithClassNames')
95
- // make sure table container has class name
96
- .get('.Table-container')
97
- .should('have.class', 'AvengersTable-container')
98
- // make sure Table has class name
99
- .get('.Table')
100
- .should('have.class', 'AvengersTable')
101
- // verify headings have class names
102
- .get('.TableHeading')
103
- .eq(0)
104
- .should('have.class', 'AvengersTableHeading-first-name')
105
- .get('.TableHeading')
106
- .eq(1)
107
- .should('have.class', 'AvengersTableHeading-last-name')
108
- .get('.TableHeading')
109
- .eq(2)
110
- .should('have.class', 'AvengersTableHeading-email')
111
- .get('.TableHeading')
112
- .eq(3)
113
- .should('have.class', 'AvengersTableHeading-age')
114
- // verify TableCells have class names
115
- .get('.TableCell')
116
- .eq(0)
117
- .should('have.class', 'AvengersTableCell-first-name')
118
- .get('.TableCell')
119
- .eq(1)
120
- .should('have.class', 'AvengersTableCell-last-name')
121
- .get('.TableCell')
122
- .eq(2)
123
- .should('have.class', 'AvengersTableCell-email')
124
- .get('.TableCell')
125
- .eq(3)
126
- .should('have.class', 'AvengersTableCell-age');
127
- });
128
-
129
- it('Renders table with custom class names for rows', () => {
130
- cy.visitStory('v1/Table/Display', 'WithRowClassNames')
131
- .get('.Table tbody tr')
132
- .should('have.length', 4)
133
- .should('have.class', 'TableRow');
134
- });
135
- });
136
-
137
- context('With custom renders', () => {
138
- it('Renders table with custom heading and cell renders', () => {
139
- cy.visitStory('v1/Table/Display', 'WithCustomRenders')
140
- // verify custom table heading exists
141
- .get('.TableHeadingEmail')
142
- // verify custom table cell exists
143
- .get('.TableCellEmail');
144
- });
145
-
146
- it('Renders table with custom row render', () => {
147
- cy.visitStory('v1/Table/Display', 'WithCustomRowRender')
148
- // verify custom table row exists
149
- .get('.TableCustomRow')
150
- .eq(0)
151
- .should('contain', 'This is an Avenger!');
152
- });
153
- });
154
-
155
- context('With large rows', () => {
156
- it('Renders table with large rows', () => {
157
- cy.visitStory('v1/Table/Display', 'WithLargeRows')
158
- // verify large table rows exist
159
- .get('.Table')
160
- .should('have.class', 'Table-large');
161
- });
162
- });
163
-
164
- context('With sorting via array', () => {
165
- it('Renders table sorted by firstName data key', () => {
166
- cy.visitStory('v1/Table/Display', 'WithSortingArray')
167
- // verify first table row
168
- .get('.TableBody > tr')
169
- .eq(0)
170
- .should('contain', 'Bruce')
171
- .should('contain', 'Banner')
172
- .should('contain', 'hulksmash@avengers.com');
173
- });
174
- });
175
-
176
- context('With no data', () => {
177
- const confirmNoData = () => {
178
- return cy
179
- .get('.TableBody')
180
- .should('have.class', 'Table-no-data');
181
- };
182
-
183
- it('Renders table with no data (using a default message)', () => {
184
- cy.visitStory('v1/Table/Display', 'NoData').then(() => {
185
- confirmNoData();
186
- cy.get('.TableBody').should(
187
- 'contain.text',
188
- 'No data available at this time.'
189
- );
190
- });
191
- });
192
-
193
- it('Renders table with no data or footer (using a custom message)', () => {
194
- cy.visitStory('v1/Table/Display', 'NoDataCustomMessage').then(
195
- () => {
196
- confirmNoData();
197
- cy.get('.TableBody').should(
198
- 'contain.text',
199
- 'The Avengers are no more!'
200
- );
201
- }
202
- );
203
- });
204
- });
205
-
206
- context('With no footer', () => {
207
- const confirmNoFooter = () => {
208
- return cy.get('.TableFooter-info').should('not.exist');
209
- };
210
-
211
- it('Renders table with no footer when provided no data (default message)', () => {
212
- cy.visitStory('v1/Table/Display', 'NoData').then(() => {
213
- cy.viewport('macbook-15');
214
- confirmNoFooter();
215
- });
216
- });
217
-
218
- it('Renders table with no footer when provided no data (custom message)', () => {
219
- cy.visitStory('v1/Table/Display', 'NoDataCustomMessage').then(
220
- () => {
221
- cy.viewport('macbook-15');
222
- confirmNoFooter();
223
- }
224
- );
225
- });
226
-
227
- it('Renders table with no footer', () => {
228
- cy.visitStory('v1/Table/Display', 'WithNoFooterMessage').then(
229
- () => {
230
- cy.viewport('macbook-15');
231
- confirmNoFooter();
232
- }
233
- );
234
- });
235
- });
236
-
237
- context('With table footer options', () => {
238
- it('Renders table with a custom footer message', () => {
239
- cy.visitStory('v1/Table/Display', 'WithCustomFooterMessage')
240
- .viewport('macbook-15')
241
- // verify table footer has custom message
242
- .get('.TableFooter-info')
243
- .should('contain.text', '4 Rows');
244
- });
245
- });
246
-
247
- context('With no tableDataRowCount', () => {
248
- it('Renders table with a valid footer message using the table data array length', () => {
249
- cy.visitStory('v1/Table/Display', 'WithNoTableDataRowCount')
250
- .viewport('macbook-15')
251
- // verify table footer
252
- .get('.TableFooter-info')
253
- .should('contain.text', 'Showing 4 of 4');
254
- });
255
- });
256
- });
257
-
258
- context('Methods', () => {
259
- context('Pagination (onPageChange)', () => {
260
- it('Pagination functions properly', () => {
261
- cy.visitStory('v1/Table/Methods', 'Pagination', {
262
- onBeforeLoad: contentWindow => {
263
- contentWindow.onPageChange = ({
264
- totalPages,
265
- currentPage,
266
- previousPage,
267
- }) => {
268
- console.log('onPageChange'); // eslint-disable-line no-console
269
- };
270
- cy.stub(contentWindow, 'onPageChange').as('pageChange');
271
- },
272
- })
273
- // verify TableFooter message
274
- .get('.TableFooter-info')
275
- .should('contain', 'Showing 1-3 of 4')
276
- // make sure TableControls and TableControls-pagination divs exists
277
- .get('.TableControls')
278
- .get('.TableControls-pagination')
279
- // make sure Page 1 initially selected
280
- .get('.TableControls-pagination option:selected')
281
- .should('contain.text', 'Page 1')
282
- // change Page via select - cannot use selectItem method due to rerender of TableControls
283
- .get('.Select')
284
- .find('select')
285
- .select('2')
286
- .wait(500);
287
-
288
- cy.get('@pageChange')
289
- .should('be.calledWith', {
290
- totalPages: 2,
291
- currentPage: 2,
292
- previousPage: 1,
293
- })
294
- // make sure Page 2 became selected
295
- .get('.TableControls-pagination option:selected')
296
- .should('contain.text', 'Page 2')
297
- // verify TableFooter message
298
- .get('.TableFooter-info')
299
- .should('contain', 'Showing 4-4 of 4')
300
- // change page via Prev arrow button and verify onPageChange called
301
- .get('.TableControls-pagination > .Button-secondary')
302
- .eq(0)
303
- .click()
304
- .wait(500);
305
-
306
- cy.get('@pageChange')
307
- .should('be.calledWith', {
308
- totalPages: 2,
309
- currentPage: 1,
310
- previousPage: 2,
311
- })
312
- // change page via Next arrow button and verify onPageChange called
313
- .get('.TableControls-pagination > .Button-secondary')
314
- .eq(1)
315
- .click()
316
- .wait(500);
317
-
318
- cy.get('@pageChange').should('be.calledWith', {
319
- currentPage: 2,
320
- previousPage: 1,
321
- totalPages: 2,
322
- });
323
- });
324
- });
325
-
326
- context('Sortable Headers (onSortChange)', () => {
327
- beforeEach(() => {
328
- cy.visitStory('v1/Table/Methods', 'WithSortableHeaders', {
329
- onBeforeLoad: contentWindow => {
330
- contentWindow.onSortChange = ({dataKey, sortOrder}) => {
331
- console.log('onSortChange'); // eslint-disable-line no-console
332
- };
333
- cy.stub(contentWindow, 'onSortChange').as('sortChange');
334
- },
335
- });
336
- });
337
- it('Sorting functions properly - desktop via headers', () => {
338
- cy.viewport('macbook-15')
339
- // make sortable headers exist where they should (email doesn't sort)
340
- // verify headings have class names
341
- .get('.TableHeading')
342
- .eq(0)
343
- .should('have.class', 'TableHeading-sortable')
344
- .get('.TableHeading')
345
- .eq(1)
346
- .should('have.class', 'TableHeading-sortable')
347
- .get('.TableHeading')
348
- .eq(2)
349
- .should('not.have.class', 'TableHeading-sortable')
350
- .get('.TableHeading')
351
- .eq(3)
352
- .should('have.class', 'TableHeading-sortable')
353
- // make sure Last Name initially selected and sorted in Descending order
354
- .get('.TableHeading')
355
- .eq(1)
356
- .should('have.class', 'TableHeading-sort-active')
357
- .should('have.class', 'TableHeading-sort-descending')
358
- // verify first table row
359
- .get('.TableBody > tr')
360
- .eq(0)
361
- .should('contain', 'Tony')
362
- .should('contain', 'Stark')
363
- .should('contain', 'ironman@avengers.com')
364
- .should('contain', '38')
365
- // click a non sortable column and verify no call is made
366
- .get('.AvengersTableHeading-email')
367
- .click()
368
- .wait(500)
369
- .get('@sortChange')
370
- .should('not.be.called')
371
- // change Sort via header - click the Age column header
372
- .get('.AvengersTableHeading-age')
373
- .click()
374
- .wait(500);
375
- cy.get('@sortChange')
376
- .should('be.calledWith', {
377
- dataKey: 'age',
378
- sortOrder: ASC,
379
- })
380
- // verify row 1 data
381
- .get('.TableBody > tr')
382
- .eq(0)
383
- .should('contain', 'Bruce')
384
- .should('contain', 'Banner')
385
- .should('contain', 'hulksmash@avengers.com')
386
- .should('contain', '36')
387
- // change Sort via the same Age header
388
- .get('.AvengersTableHeading-age')
389
- .click()
390
- .wait(500);
391
- cy.get('@sortChange')
392
- .should('be.calledWith', {
393
- dataKey: 'age',
394
- sortOrder: DESC,
395
- })
396
- // verify row 1 data
397
- .get('.TableBody > tr')
398
- .eq(0)
399
- .should('contain', 'Thor')
400
- .should('contain', 'Odinson')
401
- .should('contain', 'godofthunder@avengers.com')
402
- .should('contain', '1015');
403
- });
404
-
405
- it('Sorting functions properly - mobile via Select', () => {
406
- cy.viewport('ipad-2')
407
- // make sortable headers exist where they should (email doesn't sort)
408
- // verify headings have class names
409
- .get('.TableHeading')
410
- .eq(0)
411
- .should('have.class', 'TableHeading-sortable')
412
- .get('.TableHeading')
413
- .eq(1)
414
- .should('have.class', 'TableHeading-sortable')
415
- .get('.TableHeading')
416
- .eq(2)
417
- .should('not.have.class', 'TableHeading-sortable')
418
- .get('.TableHeading')
419
- .eq(3)
420
- .should('have.class', 'TableHeading-sortable')
421
- // make sure Last Name initially selected and sorted in Descending order
422
- .get('option:selected')
423
- .contains(`Last Name - ${DESC}`)
424
- .should('have.value', `lastName-${DESC}`)
425
- // verify first table row
426
- .get('.TableBody > tr')
427
- .eq(0)
428
- .should('contain', 'Tony')
429
- .should('contain', 'Stark')
430
- .should('contain', 'ironman@avengers.com')
431
- .should('contain', '38')
432
- // verify no Email option(s) in sort Select
433
- .get('.Select')
434
- .should('not.contain', 'Email')
435
- // change Sort via select - click the Age - Ascending option
436
- // cannot use selectItem method due to rerender of TabNavigation
437
- .get('select')
438
- .select(`age-${ASC}`)
439
- .wait(500);
440
- cy.get('@sortChange')
441
- .should('be.calledWith', {
442
- dataKey: 'age',
443
- sortOrder: ASC,
444
- })
445
- // verify row 1 data
446
- .get('.TableBody > tr')
447
- .eq(0)
448
- .should('contain', 'Bruce')
449
- .should('contain', 'Banner')
450
- .should('contain', 'hulksmash@avengers.com')
451
- .should('contain', '36')
452
- // change Sort via select - click the Age - Descending option
453
- // cannot use selectItem method due to rerender of TabNavigation
454
- .get('select')
455
- .select(`age-${DESC}`)
456
- .wait(500);
457
- cy.get('@sortChange')
458
- .should('be.calledWith', {
459
- dataKey: 'age',
460
- sortOrder: DESC,
461
- })
462
- // verify row 1 data
463
- .get('.TableBody > tr')
464
- .eq(0)
465
- .should('contain', 'Thor')
466
- .should('contain', 'Odinson')
467
- .should('contain', 'godofthunder@avengers.com')
468
- .should('contain', '1015');
469
- });
470
- });
471
-
472
- context('With sorting via function', () => {
473
- it('Sorting with function works properly', () => {
474
- cy.visitStory('v1/Table/Methods', 'WithSortingFunction', {
475
- onBeforeLoad: contentWindow => {
476
- // sorting function will be passed the item object
477
- // in this case, we have firstName, lastName, and email
478
- contentWindow.sorting = ({
479
- firstName,
480
- lastName,
481
- email,
482
- age,
483
- }) => {
484
- console.log('sorting'); // eslint-disable-line no-console
485
- };
486
- cy.stub(contentWindow, 'sorting').as('sorting');
487
- },
488
- })
489
- // verify first table row
490
- .get('.TableBody > tr')
491
- .eq(0)
492
- .should('contain', 'Bruce')
493
- .should('contain', 'Banner')
494
- .should('contain', 'hulksmash@avengers.com')
495
- .should('contain', '36')
496
- // verify sorting function was called 4 times, once per data object
497
- .get('@sorting')
498
- .should('have.callCount', 4)
499
- .should('be.calledWith', {
500
- firstName: 'Tony',
501
- lastName: 'Stark',
502
- email: 'ironman@avengers.com',
503
- age: 38,
504
- })
505
- .should('be.calledWith', {
506
- firstName: 'Bruce',
507
- lastName: 'Banner',
508
- email: 'hulksmash@avengers.com',
509
- age: 36,
510
- })
511
- .should('be.calledWith', {
512
- firstName: 'Steve',
513
- lastName: 'Rogers',
514
- email: 'captamerica@avengers.com',
515
- age: 104,
516
- })
517
- .should('be.calledWith', {
518
- firstName: 'Thor',
519
- lastName: 'Odinson',
520
- email: 'godofthunder@avengers.com',
521
- age: 1015,
522
- });
523
- });
524
- });
525
- });
526
- });
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import classNames from 'classnames';
3
- import TableCellPropTypes from './TableCellPropTypes';
4
-
5
- const TableCell = ({className, headingLabel, value}) => {
6
- const classes = classNames('TableCell', className);
7
-
8
- return (
9
- <td className={classes} data-label={headingLabel}>
10
- <div>{value}</div>
11
- </td>
12
- );
13
- };
14
-
15
- TableCell.propTypes = TableCellPropTypes;
16
-
17
- export default TableCell;
@@ -1,10 +0,0 @@
1
- import PropTypes from 'prop-types';
2
-
3
- export default {
4
- /** Additional class(es) to add to the component. */
5
- className: PropTypes.string,
6
- /** The header label that is used to display on smaller viewports above the cell's data. */
7
- headingLabel: PropTypes.string.isRequired,
8
- /** The data to populate inside of the cell. */
9
- value: PropTypes.any,
10
- };
@@ -1,61 +0,0 @@
1
- import times from 'lodash/times';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import IconChevronLeft from '@spothero/icons/chevron-left';
5
- import IconChevronRight from '@spothero/icons/chevron-right';
6
- import Button from 'v1/components/Button/Button';
7
- import Select from '../../../Select/Select';
8
-
9
- const TableControls = ({
10
- currentPage,
11
- totalPages,
12
- onPageChange,
13
- onPreviousPage,
14
- onNextPage,
15
- }) => {
16
- const pages = times(totalPages, value => {
17
- const page = (value + 1).toString();
18
-
19
- return {
20
- label: `Page ${page}`,
21
- value: page,
22
- };
23
- });
24
-
25
- return (
26
- <div className="TableControls">
27
- <div className="TableControls-pagination">
28
- <Button
29
- color="secondary"
30
- disabled={currentPage === 1}
31
- onClick={onPreviousPage}
32
- >
33
- <IconChevronLeft />
34
- </Button>
35
- <Select
36
- key={new Date()}
37
- defaultValue={currentPage.toString()}
38
- items={pages}
39
- onChange={onPageChange}
40
- />
41
- <Button
42
- color="secondary"
43
- disabled={currentPage === totalPages}
44
- onClick={onNextPage}
45
- >
46
- <IconChevronRight />
47
- </Button>
48
- </div>
49
- </div>
50
- );
51
- };
52
-
53
- TableControls.propTypes = {
54
- currentPage: PropTypes.number.isRequired,
55
- totalPages: PropTypes.number.isRequired,
56
- onPageChange: PropTypes.func.isRequired,
57
- onPreviousPage: PropTypes.func.isRequired,
58
- onNextPage: PropTypes.func.isRequired,
59
- };
60
-
61
- export default TableControls;