@loja-integrada/admin-components 0.12.8 → 0.14.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 (29) hide show
  1. package/dist/Components/Button/Button.d.ts +5 -0
  2. package/dist/Components/Button/Button.stories.d.ts +1 -0
  3. package/dist/Icons/icons-path/Back.d.ts +2 -0
  4. package/dist/Icons/icons-path/HalfBack.d.ts +2 -0
  5. package/dist/Icons/icons-path/User.d.ts +2 -0
  6. package/dist/Icons/icons-path/index.d.ts +3 -0
  7. package/dist/Navigation/Breadcrumb/Breadcrumb.stories.d.ts +4 -0
  8. package/dist/Navigation/Breadcrumb/index.d.ts +17 -0
  9. package/dist/admin-components.cjs.development.js +68 -17
  10. package/dist/admin-components.cjs.development.js.map +1 -1
  11. package/dist/admin-components.cjs.production.min.js +1 -1
  12. package/dist/admin-components.cjs.production.min.js.map +1 -1
  13. package/dist/admin-components.esm.js +68 -17
  14. package/dist/admin-components.esm.js.map +1 -1
  15. package/package.json +10 -6
  16. package/src/Components/Button/Button.spec.tsx +4 -0
  17. package/src/Components/Button/Button.stories.tsx +6 -0
  18. package/src/Components/Button/Button.tsx +19 -2
  19. package/src/Components/LoadingPlaceholder/LoadingPlaceholder.stories.tsx +1 -1
  20. package/src/Icons/Icon.stories.tsx +6 -4
  21. package/src/Icons/icons-path/Back.tsx +5 -0
  22. package/src/Icons/icons-path/HalfBack.tsx +12 -0
  23. package/src/Icons/icons-path/User.tsx +9 -0
  24. package/src/Icons/icons-path/index.ts +6 -0
  25. package/src/Layout/Sidebar/Sidebar.tsx +2 -2
  26. package/src/Navigation/Breadcrumb/Breadcrumb.spec.tsx +23 -1
  27. package/src/Navigation/Breadcrumb/Breadcrumb.stories.tsx +39 -0
  28. package/src/Navigation/Breadcrumb/index.tsx +81 -15
  29. package/src/Components/Button/Button.test.tsx +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loja-integrada/admin-components",
3
- "version": "0.12.8",
3
+ "version": "0.14.0",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -86,7 +86,7 @@
86
86
  "@types/react-table": "^7.7.1",
87
87
  "@types/react-text-mask": "^5.4.8",
88
88
  "@types/styled-components": "^5.1.14",
89
- "autoprefixer": "^9",
89
+ "autoprefixer": "^10.4.4",
90
90
  "babel-loader": "^8.2.2",
91
91
  "babel-plugin-module-name-mapper": "^1.2.0",
92
92
  "chromatic": "^5.9.2",
@@ -95,26 +95,30 @@
95
95
  "husky": "^5.1.3",
96
96
  "identity-obj-proxy": "^3.0.0",
97
97
  "list-selectors": "^2.0.0",
98
- "postcss": "^8",
98
+ "postcss": "^8.4.12",
99
99
  "postcss-loader": "^4.2.0",
100
100
  "react-is": "^17.0.1",
101
101
  "rollup-plugin-postcss": "^4.0.0",
102
102
  "size-limit": "^4.11.0",
103
103
  "storybook-addon-designs": "^6.2.1",
104
- "tailwindcss": "^2.2.4",
104
+ "tailwindcss": "^3.0.23",
105
105
  "tsdx": "^0.14.1",
106
106
  "tslib": "^2.1.0",
107
107
  "typescript": "^4.2.3",
108
108
  "webpack-dev-server": "^3.11.2"
109
109
  },
110
110
  "peerDependency": {
111
+ "@loja-integrada/tailwindcss-config": ">=1.5.0",
111
112
  "react": ">=17.0.1",
112
- "react-dom": ">=17.0.1"
113
+ "react-dom": ">=17.0.1",
114
+ "tailwindcss": ">=3.0.0"
113
115
  },
114
116
  "dependencies": {
115
- "@loja-integrada/tailwindcss-config": "^1.4.1",
117
+ "@loja-integrada/tailwindcss-config": "^1.5.0",
116
118
  "@tippyjs/react": "^4.2.5",
117
119
  "@types/react-select": "^4.0.17",
120
+ "react": "^17.0.2",
121
+ "react-dom": "^17.0.2",
118
122
  "react-modal": "^3.14.3",
119
123
  "react-select": "^4.3.1",
120
124
  "react-table": "^7.7.0",
@@ -47,6 +47,10 @@ describe('Button tests', () => {
47
47
  it('WithIcon', () => {
48
48
  mount(<Default icon="edit" />)
49
49
  cy.get('button svg').should('have.class', 'icon-edit')
50
+ cy.get('button svg').should('have.class', 'ml-3')
51
+
52
+ mount(<Default icon="edit" iconPosition="left" />)
53
+ cy.get('button svg').should('have.class', 'mr-2')
50
54
  })
51
55
 
52
56
  it('Variants', () => {
@@ -55,3 +55,9 @@ WithLink.args = {
55
55
  href: "https://google.com",
56
56
  target: "_blank"
57
57
  }
58
+
59
+ export const WithIcon = Template.bind({})
60
+ WithIcon.args = {
61
+ icon: 'app',
62
+ children: 'With Icon',
63
+ }
@@ -96,6 +96,7 @@ const ButtonComponent = (
96
96
  className,
97
97
  onClick,
98
98
  size = 'default',
99
+ iconPosition = 'right',
99
100
  ...props
100
101
  }: ButtonProps,
101
102
  ref: React.ForwardedRef<HTMLButtonAnchorElement>
@@ -129,9 +130,20 @@ const ButtonComponent = (
129
130
  onClick={handleClick}
130
131
  {...props}
131
132
  >
133
+ {currentIcon && iconPosition === 'left' && (
134
+ <Icon
135
+ icon={currentIcon}
136
+ size={size === 'small' ? 3 : 4}
137
+ className="mr-2 inline-block"
138
+ />
139
+ )}
132
140
  {children}
133
- {currentIcon && (
134
- <Icon icon={currentIcon} size={4} className="ml-3 inline-block" />
141
+ {currentIcon && iconPosition === 'right' && (
142
+ <Icon
143
+ icon={currentIcon}
144
+ size={size === 'small' ? 3 : 4}
145
+ className="ml-3 inline-block"
146
+ />
135
147
  )}
136
148
  </ButtonType>
137
149
  )
@@ -178,6 +190,11 @@ export interface ButtonProps extends ButtonAnchorProps {
178
190
  * Icon of the button
179
191
  */
180
192
  icon?: IconProps['icon']
193
+ /**
194
+ * Icon of the button
195
+ * @default 'right'
196
+ */
197
+ iconPosition?: 'left' | 'right'
181
198
  /**
182
199
  * React children
183
200
  * Also support render prop
@@ -9,6 +9,6 @@ export default {
9
9
  args: {},
10
10
  } as Meta
11
11
 
12
- const Template: Story<LoadingPlaceholderProps> = args => <LoadingPlaceholder {...args} />
12
+ const Template: Story<LoadingPlaceholderProps> = args => <div className="w-40"><LoadingPlaceholder {...args} /></div>
13
13
 
14
14
  export const Default = Template.bind({})
@@ -17,11 +17,13 @@ export const IconsList = () => {
17
17
  <div className="text-center">
18
18
  There are {Object.keys(icons).length} icons
19
19
  </div>
20
- <ul className="grid grid-cols-7 gap-4 list-none">
20
+ <ul className="grid grid-cols-6 gap-4 list-none">
21
21
  {(Object.keys(icons) as Array<keyof typeof icons>).map(key => (
22
- <li key={key} className="flex items-center py-4">
23
- <IconComponent icon={key} />
24
- <div className="pl-2">{key}</div>
22
+ <li key={key} className="flex items-center py-4 min-w-0">
23
+ <div className="shrink-0">
24
+ <IconComponent icon={key} />
25
+ </div>
26
+ <div className="pl-2 overflow-hidden text-ellipsis min-w-0">{key}</div>
25
27
  </li>
26
28
  ))}
27
29
  </ul>
@@ -0,0 +1,5 @@
1
+ import React from 'react'
2
+
3
+ export const Back = () => (
4
+ <path d="M5.5495 4.26c.282-.303.265-.777-.039-1.06-.304-.281-.778-.264-1.061.039l-3.25 3.5c-.266.289-.266.734 0 1.021l3.25 3.5c.149.159.349.24.55.24.183 0 .366-.066.511-.2.304-.282.321-.757.039-1.061L3.4695 8H13V6.5H3.4695l2.08-2.24ZM13 6.5V8c.5926-.00007 1.1679.22038 1.6206.60807.4916.42109.8001 1.01704.8599 1.66163.0599.6445-.1335 1.2871-.5393 1.7915-.4057.5044-.9918.8311-1.6342.9108l.1858 1.4976c1.0316-.1281 1.9728-.6526 2.6243-1.4626.6515-.81.9621-1.8418.866-2.8769-.0962-1.03499-.5914-1.99196-1.3809-2.66814C14.8753 6.83943 13.9516 6.49992 13 6.5Z" />
5
+ )
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+
3
+ export const HalfBack = () => (
4
+ <>
5
+ <path
6
+ fillRule="evenodd"
7
+ clipRule="evenodd"
8
+ d="m15.8384 13.3186-.0174-.0196-.9881-1.1119c.0374-.0406.0735-.0826.1083-.1259.4058-.5044.5992-1.1469.5393-1.7915-.0598-.64458-.3683-1.24053-.8599-1.66162-.4527-.38769-1.028-.60814-1.6206-.60807h-1.8884l-1.33319-1.5H13c.9516-.00008 1.8753.33943 2.6022.96196.7895.67618 1.2847 1.63314 1.3809 2.66823.0961 1.035-.2145 2.0668-.866 2.8768-.0878.1091-.1808.2131-.2787.3116Zm-1.2441.85c-.3479.1512-.7185.2534-1.1015.301l-.1858-1.4976c.0657-.0081.1308-.0188.1951-.0321l1.0922 1.2287ZM9.11111 8.00001l-1.33333-1.5H3.4695l2.08-2.24c.04231-.04545.07788-.09476.10677-.14669l-.9404-1.05796c-.0981.03985-.18931.10115-.26637.18365l-3.25 3.5c-.266.289-.266.734 0 1.021l3.25 3.49999c.149.159.349.24.55.24.183 0 .366-.066.511-.2.304-.282.321-.757.039-1.061l-2.08-2.23899h5.64161Z"
9
+ />
10
+ <path d="m14.366 13.912-.545-.613-2.476-2.786-5.289-5.951-2.028-2.281L2 0H0l2.02756 2.281L16 18h2l-3.634-4.088Z" />
11
+ </>
12
+ )
@@ -0,0 +1,9 @@
1
+ import React from 'react'
2
+
3
+ export const User = () => (
4
+ <path
5
+ fillRule="evenodd"
6
+ d="M10.707 0H7.293C5.803 0 4.644 1.295 4.809 2.776L5.253 6.776C5.394 8.042 6.464 9 7.737 9H10.263C11.536 9 12.606 8.042 12.747 6.776L13.191 2.776C13.356 1.295 12.196 0 10.707 0M10.707 1.5C11.096 1.5 11.341 1.709 11.452 1.833C11.563 1.958 11.743 2.224 11.701 2.61L11.256 6.61C11.2 7.118 10.772 7.5 10.263 7.5H7.737C7.228 7.5 6.8 7.118 6.743 6.61L6.299 2.61C6.256 2.224 6.436 1.958 6.548 1.833C6.659 1.709 6.904 1.5 7.293 1.5H10.707M14.012 11.5H3.988C1.658 11.5 0 13.228 0 15.807C0 17.578 0.783 18 2.02 18H15.979C17.43 18 18 17.152 18 15.807C18 13.231 16.342 11.5 14.012 11.5M14.012 13C14.716 13 15.367 13.285 15.846 13.801C16.324 14.318 16.504 14.84 16.504 15.692C16.504 16.158 16.384 16.5 15.979 16.5H2.02C1.723 16.5 1.496 16.267 1.496 15.692C1.496 14.974 1.675 14.318 2.154 13.801C2.633 13.285 3.284 13 3.988 13H14.012"
7
+ clipRule="evenodd"
8
+ />
9
+ )
@@ -4,6 +4,7 @@ import { App } from './App'
4
4
  import { ArrowLeft } from './ArrowLeft'
5
5
  import { SortDown } from './SortDown'
6
6
  import { ArrowRight } from './ArrowRight'
7
+ import { Back } from './Back'
7
8
  import { Ban } from './Ban'
8
9
  import { BarcodeRead } from './BarcodeRead'
9
10
  import { Bell } from './Bell'
@@ -24,6 +25,7 @@ import { Eye } from './Eye'
24
25
  import { ExclamationCircle } from './ExclamationCircle'
25
26
  import { ExclamationTriangle } from './ExclamationTriangle'
26
27
  import { ExternalLink } from './ExternalLink'
28
+ import { HalfBack } from './HalfBack'
27
29
  import { Home } from './Home'
28
30
  import { Image } from './Image'
29
31
  import { MoneyBill } from './MoneyBill'
@@ -50,6 +52,7 @@ import { Sync } from './Sync'
50
52
  import { AngleDiagonal } from './AngleDiagonal'
51
53
  import { AngleHeight } from './AngleHeight'
52
54
  import { AngleWidth } from './AngleWidth'
55
+ import { User } from './User'
53
56
 
54
57
  export const icons = {
55
58
  angleLeft: AngleLeft,
@@ -61,6 +64,7 @@ export const icons = {
61
64
  arrowLeft: ArrowLeft,
62
65
  arrowRight: ArrowRight,
63
66
  sortDown: SortDown,
67
+ back: Back,
64
68
  ban: Ban,
65
69
  barcodeRead: BarcodeRead,
66
70
  bell: Bell,
@@ -81,6 +85,7 @@ export const icons = {
81
85
  exclamationCircle: ExclamationCircle,
82
86
  exclamationTriangle: ExclamationTriangle,
83
87
  externalLink: ExternalLink,
88
+ halfBack: HalfBack,
84
89
  home: Home,
85
90
  image: Image,
86
91
  moneyBill: MoneyBill,
@@ -105,4 +110,5 @@ export const icons = {
105
110
  usdCircle: UsdCircle,
106
111
  questionCircle: QuestionCircle,
107
112
  sync: Sync,
113
+ user: User,
108
114
  }
@@ -16,13 +16,13 @@ export const Sidebar = React.memo(
16
16
  className="sidebar-mode-toggle hidden lg:flex items-center justify-center h-6 w-6 bg-base-3 absolute top-3 -right-3 z-10 border-4 border-base-2 rounded-md transition-all hover:bg-base-4"
17
17
  href=""
18
18
  >
19
- <Icon icon="angleLeft" className="w-3 h-3 transform transition-all" />
19
+ <Icon icon="angleLeft" size={3} className="transform transition-all" />
20
20
  </a>
21
21
  <a
22
22
  className="sidebar-mobile-close hidden items-center justify-center h-6 w-6 bg-base-3 absolute top-3 -right-3 z-10 border-4 border-base-2 rounded-md transition-all hover:bg-base-4"
23
23
  href=""
24
24
  >
25
- <Icon icon="angleLeft" className="w-3 h-3 transform transition-all" />
25
+ <Icon icon="angleLeft" size={3} className="transform transition-all" />
26
26
  </a> */}
27
27
  <nav className={`sidebar-content ${sidebarContentClasses}`}>
28
28
  {children}
@@ -3,7 +3,7 @@ import { composeStories } from "@storybook/testing-react"
3
3
  import { mount } from "@cypress/react"
4
4
  import * as stories from "./Breadcrumb.stories"
5
5
 
6
- const { Default, NoPrevious, WithPrevious, WithPreviousCustom } = composeStories(stories)
6
+ const { Default, NoPrevious, WithPrevious, WithPreviousCustom, WithMobileCenter, WithHelp, WithActions } = composeStories(stories)
7
7
 
8
8
  describe('Breadcrumb tests', () => {
9
9
 
@@ -37,4 +37,26 @@ describe('Breadcrumb tests', () => {
37
37
  })
38
38
  })
39
39
 
40
+ it('WithMobileCenter', () => {
41
+ mount(<WithMobileCenter />)
42
+ cy.get('.header-navigation .header-navigation-breadcrumb').within(() => {
43
+ cy.get('.header-navigation-current').should('have.class', 'w-full lg:w-auto text-center lg:text-left')
44
+ })
45
+ })
46
+
47
+ it('WithHelp', () => {
48
+ mount(<WithHelp />)
49
+ cy.get('.header-navigation .header-navigation-content').within(() => {
50
+ cy.get('.header-navigation-help a').contains('Saiba mais')
51
+ cy.get('.header-navigation-help a svg').should('have.class', 'icon-questionCircle')
52
+ })
53
+ })
54
+
55
+ it('WithActions', () => {
56
+ mount(<WithActions />)
57
+ cy.get('.header-navigation .header-navigation-content').within(() => {
58
+ cy.get('.header-navigation-actions button').should('exist')
59
+ })
60
+ })
61
+
40
62
  })
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import { Story, Meta } from '@storybook/react'
3
3
 
4
4
  import { Breadcrumb, BreadcrumbProps } from '.'
5
+ import { Button } from '../../Components/Button'
5
6
 
6
7
  export default {
7
8
  title: 'Navigation/Breadcrumb',
@@ -38,3 +39,41 @@ WithPreviousCustom.args = {
38
39
  previousTitle: 'Página anterior',
39
40
  Link: Link
40
41
  }
42
+
43
+ export const WithoutPreviousTitle = Template.bind({})
44
+ WithoutPreviousTitle.args = {
45
+ currentTitle: 'Página atual',
46
+ previousHref: 'https://www.google.com'
47
+ }
48
+
49
+ export const WithMobileCenter = Template.bind({})
50
+ WithMobileCenter.args = {
51
+ currentTitle: 'Página atual',
52
+ previousTitle: 'Página anterior',
53
+ previousHref: 'https://www.google.com',
54
+ mobileAlign: 'center'
55
+ }
56
+
57
+ export const WithHelp = Template.bind({})
58
+ WithHelp.args = {
59
+ currentTitle: 'Página atual',
60
+ previousHref: 'https://www.google.com',
61
+ mobileAlign: 'center',
62
+ help: {
63
+ title: 'Saiba mais',
64
+ href: 'https://www.google.com'
65
+ }
66
+ }
67
+
68
+ export const WithActions = Template.bind({})
69
+ WithActions.args = {
70
+ currentTitle: 'Página atual',
71
+ previousHref: 'https://www.google.com',
72
+ mobileAlign: 'center',
73
+ actions: (
74
+ <>
75
+ <Button variant="outline" className="hidden lg:block">Cancelar</Button>
76
+ <Button variant="outline" icon="app" iconPosition="left">Salvar</Button>
77
+ </>
78
+ )
79
+ }
@@ -2,12 +2,26 @@ import React from 'react'
2
2
  import { Icon } from '../../Icons/Icon'
3
3
 
4
4
  export const Breadcrumb: React.FC<BreadcrumbProps> = React.memo(
5
- ({ Link, currentTitle, previousTitle, previousHref, className = '' }) => {
5
+ ({
6
+ Link,
7
+ currentTitle,
8
+ previousTitle,
9
+ previousHref,
10
+ mobileAlign = 'left',
11
+ help,
12
+ actions,
13
+ className = '',
14
+ }) => {
6
15
  const renderPrevTitle = (
7
- <span className="hidden lg:inline">{previousTitle}</span>
16
+ <span className="hidden lg:inline truncate">{previousTitle}</span>
8
17
  )
9
18
  const renderPrevIcon = (
10
- <Icon icon="arrowLeft" className="w-4 h-4 inline-flex mr-3 lg:-mt-1" />
19
+ <Icon
20
+ icon="arrowLeft"
21
+ size={4}
22
+ className="inline-flex mr-3 -mt-1"
23
+ block
24
+ />
11
25
  )
12
26
  const renderPrevLink = () => {
13
27
  if (!previousHref && !Link) {
@@ -35,28 +49,63 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = React.memo(
35
49
  return (
36
50
  <div
37
51
  aria-label="breadcrumbs"
38
- className={`header-navigation flex flex-wrap items-center justify-between mb-4 lg:mb-7 ${className}`}
52
+ className={`header-navigation flex items-center justify-between mb-4 lg:mb-7 ${className}`}
39
53
  >
40
- <div className="header-navigation-breadcrumb max-w-full truncate">
41
- <div className="inline-flex self-center items-center font-semibold tracking-5 text-f5 sm:text-f4 lg:text-f3">
42
- {previousTitle && (
43
- <span className="header-navigation-previous inline-flex items-center text-on-base-2 text-xl -mr-px">
54
+ <div
55
+ className={`header-navigation-breadcrumb max-w-full truncate w-full`}
56
+ >
57
+ <div className="w-full inline-flex self-center items-center font-semibold tracking-5 text-f5 sm:text-f4 lg:text-f3">
58
+ {(previousTitle || previousHref) && (
59
+ <span className="header-navigation-previous inline-flex items-center text-on-base-2 text-xl -mr-px truncate">
44
60
  {renderPrevLink()}
45
- <span className="hidden lg:inline px-2 -ml-px"> / </span>
61
+ {previousTitle && (
62
+ <span className="hidden lg:inline px-2 -ml-px"> / </span>
63
+ )}
46
64
  </span>
47
65
  )}
48
- <span className="header-navigation-current text-on-base">
66
+ <span
67
+ className={`header-navigation-current text-on-base truncate ${
68
+ mobileAlign === 'center'
69
+ ? 'w-full lg:w-auto text-center lg:text-left'
70
+ : ''
71
+ }`}
72
+ >
49
73
  {currentTitle}
50
74
  </span>
51
75
  </div>
52
76
  </div>
53
- <div className="header-navigation-content flex items-center flex-grow justify-end">
77
+ <div className="header-navigation-content flex shrink-0 max-w-1/2 items-center flex-grow justify-end gap-5 ml-2 whitespace-nowrap">
54
78
  <div className="header-navigation-help help flex items-center">
55
- {/* NOT IMPLEMENTED */}
56
- </div>
57
- <div className="header-navigation-actions flex items-center">
58
- {/* NOT IMPLEMENTED */}
79
+ {help && (
80
+ <a
81
+ href={help.href}
82
+ target="_blank"
83
+ rel="noreferrer"
84
+ className={`flex p-1 pr-0 text-on-base-2 hover:text-on-base duration-200 transition-colors items-center`}
85
+ >
86
+ <Icon
87
+ icon="questionCircle"
88
+ size={4}
89
+ className="shrink-0"
90
+ block
91
+ />
92
+ {help.title && (
93
+ <span
94
+ className={`text-f6 font-semibold tracking-4 leading-6 ml-2 ${
95
+ !help.mobileText ? 'hidden md:inline' : ''
96
+ }`}
97
+ >
98
+ {help.title}
99
+ </span>
100
+ )}
101
+ </a>
102
+ )}
59
103
  </div>
104
+ {actions && (
105
+ <div className="header-navigation-actions flex items-center gap-5">
106
+ {actions}
107
+ </div>
108
+ )}
60
109
  </div>
61
110
  </div>
62
111
  )
@@ -85,4 +134,21 @@ export interface BreadcrumbProps {
85
134
  * Example: `const Link = (props: any) => { return <a href="https://www.google.com" target="_blank" className={`underline ` + props.className}>{props.children}</a> }`
86
135
  * */
87
136
  Link?: React.ElementType
137
+ /**
138
+ * Aligment of `currentTitle` at mobile
139
+ * @default 'left'
140
+ * */
141
+ mobileAlign?: 'left' | 'center'
142
+ /**
143
+ * Help link (external page)
144
+ * */
145
+ help?: {
146
+ title?: string
147
+ href: string
148
+ mobileText?: boolean
149
+ }
150
+ /**
151
+ * Custom actions and buttons
152
+ * */
153
+ actions?: React.ReactNode
88
154
  }
@@ -1,31 +0,0 @@
1
- import { expect } from '@jest/globals'
2
-
3
- import React from 'react'
4
- import { render } from '@testing-library/react'
5
-
6
- import { Button } from './Button'
7
-
8
- describe('Button tests', () => {
9
- it('should have overridable styles', () => {
10
- const { container } = render(
11
- <Button data-testid="button">Black Button</Button>
12
- )
13
-
14
- expect(container).toBeDefined()
15
- })
16
-
17
- it('should not have a11y violations', async () => {
18
- const { container } = render(
19
- <>
20
- <Button>Button</Button>
21
- <Button>Button</Button>
22
- <Button variant="secondary">Button</Button>
23
- <Button variant="tertiary">Button</Button>
24
- <Button size="small">Button</Button>
25
- <Button variant="danger">Button</Button>
26
- </>
27
- )
28
-
29
- expect(container).toBeDefined()
30
- })
31
- })