@@ -6,7 +6,7 @@ import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
66import { ScrollableProduct } from './ScrollableProduct.importable' ;
77
88const meta = {
9- title : 'Article Carousel /Scrollable Products' ,
9+ title : 'Components /Scrollable Products' ,
1010 component : ScrollableProduct ,
1111 parameters : {
1212 chromatic : {
@@ -19,15 +19,32 @@ const meta = {
1919 } ,
2020 args : {
2121 products : [
22- { ...exampleProduct , h2Id : 'product' } ,
2322 {
2423 ...exampleProduct ,
24+ primaryHeadingHtml : '<em>Product 0</em>' ,
25+ h2Id : 'product' ,
26+ } ,
27+ {
28+ ...exampleProduct ,
29+ primaryHeadingHtml : '<em>Product 1</em>' ,
2530 h2Id : 'product-1' ,
2631 productName : 'Lorem ipsum dolor sit amet' ,
2732 } ,
28- { ...exampleProduct , h2Id : 'product-2' } ,
29- { ...exampleProduct , h2Id : 'product-3' } ,
30- { ...exampleProduct , h2Id : 'product-4' } ,
33+ {
34+ ...exampleProduct ,
35+ primaryHeadingHtml : '<em>Product 2</em>' ,
36+ h2Id : 'product-2' ,
37+ } ,
38+ {
39+ ...exampleProduct ,
40+ primaryHeadingHtml : '<em>Product 3</em>' ,
41+ h2Id : 'product-3' ,
42+ } ,
43+ {
44+ ...exampleProduct ,
45+ primaryHeadingHtml : '<em>Product 4</em>' ,
46+ h2Id : 'product-4' ,
47+ } ,
3148 ] ,
3249 format : {
3350 design : ArticleDesign . Review ,
@@ -78,3 +95,24 @@ export default meta;
7895type Story = StoryObj < typeof meta > ;
7996
8097export const With5Cards = { } satisfies Story ;
98+
99+ export const ClickForwardArrow = {
100+ play : async ( { canvas, userEvent } ) => {
101+ await userEvent . click ( canvas . getByTestId ( 'carousel-forward-button' ) ) ;
102+ } ,
103+ } satisfies Story ;
104+
105+ // Function to emulate pausing between interactions
106+ function sleep ( ms : number ) {
107+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
108+ }
109+
110+ export const ClickForwardTwiceAndBackOnce = {
111+ play : async ( { canvas, userEvent } ) => {
112+ await userEvent . click ( canvas . getByTestId ( 'carousel-forward-button' ) ) ;
113+ await sleep ( 500 ) ;
114+ await userEvent . click ( canvas . getByTestId ( 'carousel-forward-button' ) ) ;
115+ await sleep ( 500 ) ;
116+ await userEvent . click ( canvas . getByTestId ( 'carousel-back-button' ) ) ;
117+ } ,
118+ } satisfies Story ;
0 commit comments