Skip to content

Commit 29b7cb0

Browse files
author
Hanbin Cho
committed
Fix test
1 parent d354422 commit 29b7cb0

File tree

4 files changed

+15
-67
lines changed

4 files changed

+15
-67
lines changed

packages/components/src/components/Button/__tests__/__snapshots__/index.browser.test.tsx.snap

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -226,25 +226,6 @@ exports[`Button > should not render error color when danger is false and variant
226226
</button>
227227
`;
228228

229-
exports[`Button > should not render error color when isError is false and variant is default 1`] = `
230-
<button
231-
aria-label="button"
232-
class=" outline-0-2px solid-17005923944751620165-1 boxSizing-0-border-box--1 cursor-0-pointer--1 fontWeight-0-700--1 outlineOffset-0-2px--1 position-0-relative--1 transition-0-.25s--1 color-0-#000-15425828959012638752-1 background-0-color-mix(in srgb,var(--primary,#8163E1) 20%,#FFF 80%)-15425828959012638752-1 border-0-1px solid var(--primary,#8163E1)-15425828959012638752-1 color-0-#D6D7DE-14172363753176421546-1 backgroundColor-0-#F0F0F3-14172363753176421546-1 cursor-0-not-allowed-14172363753176421546-1 borderColor-0-var(--border,#E4E4E4)-14172363753176421546-1 outlineColor-0-var(--primaryFocus,#9385D3)-17005923944751620165-1 borderColor-0-var(--primary,#8163E1)-8380715471663921674-1 background-0-color-mix(in srgb,var(--primary,#8163E1) 10%,#FFF 90%)-8380715471663921674-1 color-0-var(--text,#F6F6F6)-2922352740838246662-1 background-0-var(--primary,#8163E1)-2922352740838246662-1 color-0-#373737-878116160589243838-1 backgroundColor-0-#47474A-878116160589243838-1 borderColor-0-transparent-878116160589243838-1 borderColor-0-var(--primary,#8163E1)-6232724021015440856-1 background-0-color-mix(in srgb,var(--primary,#674DC7) 10%,var(--inputBackground,#2E2E2E) 90%)-6232724021015440856-1 outlineColor-0-var(--primaryFocus,#927CE4)-13318702800233181468-1 background-0-var(--inputBackground,#2E2E2E)-6667598448774358329-1 background-0-var(--inputBackground,#FFF)--1 border-0-1px solid var(--border,#E4E4E4)--1 borderRadius-0-10px--1 color-0-var(--text,#272727)--1 fontSize-0-14px--1 fontSize-4-15px--1 letterSpacing-0--0.02em--1 letterSpacing-4--0.03em--1 px-0-16px--1 py-0-10px--1 "
233-
data-testid="button"
234-
type="button"
235-
>
236-
<div
237-
class="maxWidth-0-100%--255 mx-0-auto--255 position-0-relative--255 width-0-fit-content--255"
238-
>
239-
<div
240-
class=" lineHeight-0-1.2--255 minHeight-0-1.2em--255 "
241-
>
242-
Click me
243-
</div>
244-
</div>
245-
</button>
246-
`;
247-
248229
exports[`Button > should render 1`] = `
249230
<div>
250231
<button
@@ -305,26 +286,6 @@ exports[`Button > should render error style when danger is true and variant is d
305286
</div>
306287
`;
307288

308-
exports[`Button > should render error style when isError is true and variant is default 1`] = `
309-
<div>
310-
<button
311-
aria-label="button"
312-
class=" outline-0-2px solid-17005923944751620165-1 boxSizing-0-border-box--1 cursor-0-pointer--1 fontWeight-0-700--1 outlineOffset-0-2px--1 position-0-relative--1 transition-0-.25s--1 color-0-#000-15425828959012638752-1 background-0-var(--error,#D52B2E)-15425828959012638752-1 border-0-1px solid var(--error,#D52B2E)-15425828959012638752-1 color-0-#D6D7DE-14172363753176421546-1 backgroundColor-0-#F0F0F3-14172363753176421546-1 cursor-0-not-allowed-14172363753176421546-1 borderColor-0-var(--border,#E4E4E4)-14172363753176421546-1 outlineColor-0-var(--error,#FF5B5E)-17005923944751620165-1 borderColor-0-var(--error,#D52B2E)-8380715471663921674-1 color-0-var(--text,#F6F6F6)-2922352740838246662-1 background-0-var(--error,#FF5B5E)-2922352740838246662-1 color-0-#373737-878116160589243838-1 backgroundColor-0-#47474A-878116160589243838-1 borderColor-0-transparent-878116160589243838-1 borderColor-0-var(--error,#FF5B5E)-6232724021015440856-1 outlineColor-0-var(--error,#D52B2E)-13318702800233181468-1 background-0-var(--inputBackground,#2E2E2E)-6667598448774358329-1 background-0-var(--inputBackground,#FFF)--1 border-0-1px solid var(--border,#E4E4E4)--1 borderRadius-0-10px--1 color-0-var(--error,#D52B2E)--1 fontSize-0-14px--1 fontSize-4-15px--1 letterSpacing-0--0.02em--1 letterSpacing-4--0.03em--1 px-0-16px--1 py-0-10px--1 "
313-
type="button"
314-
>
315-
<div
316-
class="maxWidth-0-100%--255 mx-0-auto--255 position-0-relative--255 width-0-fit-content--255"
317-
>
318-
<div
319-
class=" lineHeight-0-1.2--255 minHeight-0-1.2em--255 "
320-
>
321-
Click me
322-
</div>
323-
</div>
324-
</button>
325-
</div>
326-
`;
327-
328289
exports[`Button > should render icon when icon is provided 1`] = `
329290
<div>
330291
<button
@@ -383,23 +344,3 @@ exports[`Button > should render primary background color when danger is true and
383344
</button>
384345
</div>
385346
`;
386-
387-
exports[`Button > should render primary background color when isError is true and variant is primary 1`] = `
388-
<div>
389-
<button
390-
aria-label="button"
391-
class=" outline-0-2px solid-17005923944751620165-1 boxSizing-0-border-box--1 cursor-0-pointer--1 fontWeight-0-700--1 outlineOffset-0-2px--1 position-0-relative--1 transition-0-.25s--1 background-0-color-mix(in srgb,var(--primary,#674DC7) 100%,#000 30%)-15425828959012638752-1 color-0-#D6D7DE-14172363753176421546-1 backgroundColor-0-#F0F0F3-14172363753176421546-1 cursor-0-not-allowed-14172363753176421546-1 outlineColor-0-var(--primaryFocus,#9385D3)-17005923944751620165-1 background-0-color-mix(in srgb,var(--primary,#674DC7) 100%,#000 15%)-8380715471663921674-1 background-0-color-mix(in srgb,var(--primary,#8163E1) 100%,#FFF 30%)-2922352740838246662-1 color-0-#373737-878116160589243838-1 backgroundColor-0-#47474A-878116160589243838-1 borderColor-0-transparent-878116160589243838-1 background-0-color-mix(in srgb,var(--primary,#8163E1) 100%,#FFF 15%)-6232724021015440856-1 outlineColor-0-var(--primary,#674DC7)-6232724021015440856-1 outlineColor-0-var(--primaryFocus,#927CE4)-13318702800233181468-1 background-0-var(--primary,#8163E1)-6667598448774358329-1 background-0-var(--primary,#8163E1)--1 border-0-none--1 borderRadius-0-8px--1 color-0-#FFF--1 fontSize-0-15px--1 fontSize-4-16px--1 letterSpacing-0-0--1 letterSpacing-4--0.01em--1 px-0-16px--1 py-0-10px--1 "
392-
type="button"
393-
>
394-
<div
395-
class="maxWidth-0-100%--255 mx-0-auto--255 position-0-relative--255 width-0-fit-content--255"
396-
>
397-
<div
398-
class=" lineHeight-0-1.2--255 minHeight-0-1.2em--255 "
399-
>
400-
Click me
401-
</div>
402-
</div>
403-
</button>
404-
</div>
405-
`;

packages/components/src/components/Button/__tests__/index.browser.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ describe('Button', () => {
4444
})
4545

4646
it('should not render error color when danger is false and variant is default', async () => {
47-
const { getByTestId } = render(
48-
<Button data-testid="button">Click me</Button>,
49-
)
50-
const button = getByTestId('button')
47+
const { container } = render(<Button data-testid="button">Click me</Button>)
48+
const button = container.querySelector('button')
5149
expect(button).toHaveStyle({
5250
color: 'var(--text, #272727)',
5351
})
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
// @ts-nocheck
22
import { Box } from '@devup-ui/react'
3-
import { render } from '@testing-library/react'
3+
import { render, waitFor } from '@testing-library/react'
44

55
describe('Box', () => {
6-
it('should render', () => {
6+
it('should render', async () => {
77
const { container } = render(<Box bg="blue" />)
8-
expect(container.children[0]).toHaveStyle('background-color: blue')
8+
9+
await waitFor(
10+
() => {
11+
expect(container.children[0]).toHaveClass('background-0-blue--255')
12+
},
13+
{
14+
timeout: 1000,
15+
interval: 10,
16+
},
17+
)
918
})
1019
})

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default defineConfig({
1111
'packages/*/src/**/__tests__',
1212
'**/*.stories.{ts,tsx}',
1313
],
14-
reportOnFailure: true,
1514
cleanOnRerun: true,
1615
reporter: ['text', 'json', 'html'],
1716
},
@@ -42,5 +41,6 @@ export default defineConfig({
4241
],
4342
},
4443
],
44+
cache: false,
4545
},
4646
})

0 commit comments

Comments
 (0)