File tree Expand file tree Collapse file tree 2 files changed +11
-43
lines changed
Expand file tree Collapse file tree 2 files changed +11
-43
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { within , expect } from '@storybook/test'
12import DsfrPagination from './DsfrPagination.vue'
23
34/**
@@ -61,7 +62,6 @@ export const Pagination = (args) => ({
6162 />
6263 ` ,
6364} )
64-
6565Pagination . args = {
6666 pages : [
6767 {
@@ -92,6 +92,16 @@ Pagination.args = {
9292 ] ,
9393 currentPage : 0 ,
9494}
95+ Pagination . play = async ( { canvasElement } ) => {
96+ const canvas = within ( canvasElement )
97+ const links = canvas . getAllByRole ( 'link' )
98+ expect ( links ) . toHaveLength ( 9 )
99+
100+ const currentPageLink = canvas . getByText ( `${ Pagination . args . currentPage + 1 } ` )
101+ expect ( currentPageLink ) . toHaveAttribute ( 'aria-current' , 'page' )
102+ const secondPageLink = canvas . getByText ( `${ Pagination . args . currentPage + 2 } ` )
103+ expect ( secondPageLink ) . not . toHaveAttribute ( 'aria-current' , 'page' )
104+ }
95105
96106export const PaginationTruncated = ( args ) => ( {
97107 components : {
@@ -109,7 +119,6 @@ export const PaginationTruncated = (args) => ({
109119 />
110120 ` ,
111121} )
112-
113122PaginationTruncated . args = {
114123 pages : [
115124 {
You can’t perform that action at this time.
0 commit comments