@@ -5,11 +5,49 @@ import { createRawSnippet } from "svelte";
55import { describe , expect , test , vi } from "vitest" ;
66
77describe ( "Button" , ( ) => {
8- test ( "should render component" , async ( ) => {
8+ const children = createRawSnippet ( ( ) => ( {
9+ render : ( ) => `<span>Button</span>` ,
10+ } ) ) ;
11+
12+ test ( "should render default button" , async ( ) => {
13+ const { container } = render ( Button , {
14+ children,
15+ } ) ;
16+
17+ expect ( container . children ) . toMatchSnapshot ( ) ;
18+ } ) ;
19+
20+ test ( "should render primary button" , async ( ) => {
21+ const { container } = render ( Button , {
22+ children,
23+ color : "primary" ,
24+ } ) ;
25+
26+ expect ( container . children ) . toMatchSnapshot ( ) ;
27+ } ) ;
28+
29+ test ( "should render small button" , async ( ) => {
30+ const { container } = render ( Button , {
31+ children,
32+ size : "small" ,
33+ } ) ;
34+
35+ expect ( container . children ) . toMatchSnapshot ( ) ;
36+ } ) ;
37+
38+ test ( "should render medium button" , async ( ) => {
39+ const { container } = render ( Button , {
40+ children,
41+ size : "medium" ,
42+ } ) ;
43+
44+ expect ( container . children ) . toMatchSnapshot ( ) ;
45+ } ) ;
46+
47+ test ( "should render large button" , async ( ) => {
948 const { container } = render ( Button , {
10- children : createRawSnippet ( ( ) => ( {
11- render : ( ) => `<span>Button</span>` ,
12- } ) ) ,
49+ children,
50+ size : "large" ,
1351 } ) ;
1452
1553 expect ( container . children ) . toMatchSnapshot ( ) ;
@@ -19,9 +57,7 @@ describe("Button", () => {
1957 const onclick = vi . fn ( ) ;
2058
2159 render ( Button , {
22- children : createRawSnippet ( ( ) => ( {
23- render : ( ) => `<span>Button</span>` ,
24- } ) ) ,
60+ children,
2561 onclick,
2662 } ) ;
2763
0 commit comments