@@ -3,6 +3,7 @@ import ExampleContainer from "../../.storybook/components/ExampleContainer";
33import DxcChip from "./Chip" ;
44import { Meta , StoryObj } from "@storybook/react-vite" ;
55import { useEffect } from "react" ;
6+ import { userEvent , within } from "storybook/internal/test" ;
67
78export default {
89 title : "Chip" ,
@@ -133,6 +134,32 @@ const Chip = () => (
133134 />
134135 </ ExampleContainer >
135136
137+ < Title title = "Default" theme = "light" level = { 4 } />
138+ < ExampleContainer >
139+ < DxcChip label = "Default" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
140+ </ ExampleContainer >
141+ < Title title = "Hover" theme = "light" level = { 4 } />
142+ < ExampleContainer pseudoState = "pseudo-hover" >
143+ < DxcChip label = "Hover" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
144+ </ ExampleContainer >
145+ < Title title = "Focus" theme = "light" level = { 4 } />
146+ < ExampleContainer pseudoState = { [ "pseudo-focus" , "pseudo-focus-within" ] } >
147+ < DxcChip label = "Focus" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
148+ </ ExampleContainer >
149+ < Title title = "Active" theme = "light" level = { 4 } />
150+ < ExampleContainer pseudoState = "pseudo-active" >
151+ < DxcChip label = "Active" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
152+ </ ExampleContainer >
153+ < Title title = "Disabled" theme = "light" level = { 4 } />
154+ < ExampleContainer >
155+ < DxcChip
156+ label = "Disabled"
157+ action = { { icon : "filled_delete" , onClick : ( ) => { } } }
158+ prefix = { { color : "primary" } }
159+ disabled
160+ />
161+ </ ExampleContainer >
162+
136163 < Title title = "Margins" theme = "light" level = { 2 } />
137164 < Title title = "Xxsmall margin" theme = "light" level = { 4 } />
138165 < ExampleContainer >
@@ -164,37 +191,6 @@ const Chip = () => (
164191 </ ExampleContainer >
165192 </ >
166193) ;
167-
168- const ChipActionStates = ( ) => (
169- < >
170- < Title title = "Default" theme = "light" level = { 4 } />
171- < ExampleContainer >
172- < DxcChip label = "Default" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
173- </ ExampleContainer >
174- < Title title = "Hover" theme = "light" level = { 4 } />
175- < ExampleContainer pseudoState = "pseudo-hover" >
176- < DxcChip label = "Hover" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
177- </ ExampleContainer >
178- < Title title = "Focus" theme = "light" level = { 4 } />
179- < ExampleContainer pseudoState = { [ "pseudo-focus" , "pseudo-focus-within" ] } >
180- < DxcChip label = "Focus" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
181- </ ExampleContainer >
182- < Title title = "Active" theme = "light" level = { 4 } />
183- < ExampleContainer pseudoState = "pseudo-active" >
184- < DxcChip label = "Active" action = { { icon : "filled_delete" , onClick : ( ) => { } } } prefix = { { color : "primary" } } />
185- </ ExampleContainer >
186- < Title title = "Disabled" theme = "light" level = { 4 } />
187- < ExampleContainer >
188- < DxcChip
189- label = "Disabled"
190- action = { { icon : "filled_delete" , onClick : ( ) => { } } }
191- prefix = { { color : "primary" } }
192- disabled
193- />
194- </ ExampleContainer >
195- </ >
196- ) ;
197-
198194const ChipTooltip = ( ) => (
199195 < >
200196 < Title title = "Chip with Tooltip" theme = "light" level = { 4 } />
@@ -214,10 +210,11 @@ export const Chromatic: Story = {
214210 render : Chip ,
215211} ;
216212
217- export const ActionStates : Story = {
218- render : ChipActionStates ,
219- } ;
220-
221213export const Tooltip : Story = {
222214 render : ChipTooltip ,
215+ play : async ( { canvasElement } ) => {
216+ const canvas = within ( canvasElement ) ;
217+ const button = await canvas . findByText ( "Default with tooltip" ) ;
218+ await userEvent . hover ( button ) ;
219+ } ,
223220} ;
0 commit comments