1
+ import { userEvent , within } from '@storybook/test' ;
2
+
1
3
import { EditIcon , FilterIcon , RightIcon } from '../../../icons' ;
2
4
import { Button } from '../../actions/Button/Button' ;
3
5
import { Badge } from '../../content/Badge/Badge' ;
@@ -52,6 +54,11 @@ export const Default: Story = {
52
54
searchPlaceholder : 'Search options...' ,
53
55
width : 'max 30x' ,
54
56
} ,
57
+ play : async ( { canvasElement } ) => {
58
+ const canvas = within ( canvasElement ) ;
59
+ const trigger = canvas . getByRole ( 'button' ) ;
60
+ await userEvent . click ( trigger ) ;
61
+ } ,
55
62
render : ( args ) => (
56
63
< FilterPicker { ...args } >
57
64
< FilterPicker . Section title = "Fruits" >
@@ -114,6 +121,11 @@ export const CustomLabel: Story = {
114
121
return `${ selectedKeys . length } of 12 selected` ;
115
122
} ,
116
123
} ,
124
+ play : async ( { canvasElement } ) => {
125
+ const canvas = within ( canvasElement ) ;
126
+ const trigger = canvas . getByRole ( 'button' ) ;
127
+ await userEvent . click ( trigger ) ;
128
+ } ,
117
129
render : ( args ) => (
118
130
< FilterPicker { ...args } >
119
131
< FilterPicker . Section title = "Fruits" >
@@ -170,11 +182,16 @@ export const WithHeaderAndFooter: Story = {
170
182
searchPlaceholder : 'Search languages...' ,
171
183
width : 'max 30x' ,
172
184
} ,
185
+ play : async ( { canvasElement } ) => {
186
+ const canvas = within ( canvasElement ) ;
187
+ const trigger = canvas . getByRole ( 'button' ) ;
188
+ await userEvent . click ( trigger ) ;
189
+ } ,
173
190
render : ( args ) => (
174
191
< FilterPicker
175
192
{ ...args }
176
193
header = {
177
- < Space gap = "1x" placeContent = "space-between" flow = "row" >
194
+ < >
178
195
< Space gap = "1x" flow = "row" placeItems = "center" >
179
196
< Title level = { 6 } > Programming Languages</ Title >
180
197
< Badge type = "purple" > 12</ Badge >
@@ -185,22 +202,17 @@ export const WithHeaderAndFooter: Story = {
185
202
icon = { < FilterIcon /> }
186
203
aria-label = "Filter languages"
187
204
/>
188
- </ Space >
205
+ </ >
189
206
}
190
207
footer = {
191
- < Space
192
- gap = "1x"
193
- placeContent = "space-between"
194
- flow = "row"
195
- placeItems = "center"
196
- >
208
+ < >
197
209
< Text color = "#dark.50" preset = "t4" >
198
210
Popular languages shown
199
211
</ Text >
200
212
< Button type = "link" size = "small" rightIcon = { < RightIcon /> } >
201
213
View all
202
214
</ Button >
203
- </ Space >
215
+ </ >
204
216
}
205
217
>
206
218
< FilterPicker . Section title = "Frontend" >
@@ -258,6 +270,11 @@ export const SingleIcon: Story = {
258
270
icon : < EditIcon /> ,
259
271
rightIcon : null ,
260
272
} ,
273
+ play : async ( { canvasElement } ) => {
274
+ const canvas = within ( canvasElement ) ;
275
+ const trigger = canvas . getByRole ( 'button' ) ;
276
+ await userEvent . click ( trigger ) ;
277
+ } ,
261
278
render : ( args ) => (
262
279
< FilterPicker { ...args } >
263
280
< FilterPicker . Section title = "Fruits" >
0 commit comments