File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ const titleValue = computed(() => {
5151 </script >
5252
5353<template >
54- <button type =" button" @click =" toggleRelativeDates" >
54+ <button type =" button" :aria-pressed = " relativeDates " @click =" toggleRelativeDates" >
5555 <ClientOnly >
5656 <NuxtTime
5757 v-if =" relativeDates"
Original file line number Diff line number Diff line change @@ -130,6 +130,19 @@ describe('DateTime', () => {
130130 } )
131131 expect ( component . find ( 'time' ) . attributes ( 'title' ) ) . toContain ( testYear )
132132 } )
133+
134+ it ( 'always toggle relative dates settings when click' , async ( ) => {
135+ const component = await mountSuspended ( DateTime , {
136+ props : { datetime : testDate } ,
137+ } )
138+ const button = component . find ( 'button' )
139+
140+ await button . trigger ( 'click' )
141+ expect ( button . attributes ( 'aria-pressed' ) ) . toBe ( 'true' )
142+
143+ await button . trigger ( 'click' )
144+ expect ( button . attributes ( 'aria-pressed' ) ) . toBe ( 'false' )
145+ } )
133146 } )
134147
135148 describe ( 'SSR fallback' , ( ) => {
You can’t perform that action at this time.
0 commit comments