@@ -2,6 +2,7 @@ import { Meta, StoryObj } from "@storybook/react";
22import ExampleContainer from "../../.storybook/components/ExampleContainer" ;
33import Title from "../../.storybook/components/Title" ;
44import DxcPaginator from "./Paginator" ;
5+ import { userEvent , within } from "@storybook/test" ;
56
67export default {
78 title : "Paginator" ,
@@ -28,6 +29,10 @@ const Paginator = () => (
2829 < Title title = "Default with items per page options" theme = "light" level = { 4 } />
2930 < DxcPaginator itemsPerPageOptions = { [ 5 , 10 , 15 ] } />
3031 </ ExampleContainer >
32+ < ExampleContainer >
33+ < Title title = "Default with items per page options virtualized" theme = "light" level = { 4 } />
34+ < DxcPaginator itemsPerPageOptions = { Array . from ( { length : 10000 } , ( _ , i ) => i + 1 ) } />
35+ </ ExampleContainer >
3136 < ExampleContainer >
3237 < Title title = "Default with show go to page selector" theme = "light" level = { 4 } />
3338 < DxcPaginator showGoToPage />
@@ -76,6 +81,13 @@ type Story = StoryObj<typeof DxcPaginator>;
7681
7782export const Chromatic : Story = {
7883 render : Paginator ,
84+ play : async ( { canvasElement } ) => {
85+ const canvas = within ( canvasElement ) ;
86+ const virtualizedSelect = canvas . getAllByRole ( "combobox" ) [ 1 ] ;
87+ if ( virtualizedSelect ) {
88+ await userEvent . click ( virtualizedSelect ) ;
89+ }
90+ } ,
7991} ;
8092
8193export const ResponsivePaginator : Story = {
@@ -84,4 +96,11 @@ export const ResponsivePaginator: Story = {
8496 viewport : { viewports : customViewports , defaultViewport : "resizedScreen" } ,
8597 chromatic : { viewports : [ 400 ] } ,
8698 } ,
99+ play : async ( { canvasElement } ) => {
100+ const canvas = within ( canvasElement ) ;
101+ const virtualizedSelect = canvas . getAllByRole ( "combobox" ) [ 1 ] ;
102+ if ( virtualizedSelect ) {
103+ await userEvent . click ( virtualizedSelect ) ;
104+ }
105+ } ,
87106} ;
0 commit comments