File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import DateTime from '~/components/DateTime.vue'
55// Mock the useRelativeDates composable
66const mockRelativeDates = shallowRef ( false )
77vi . mock ( '~/composables/useSettings' , ( ) => ( {
8- useRelativeDates : ( ) => mockRelativeDates ,
98 useSettings : ( ) => ( {
109 settings : ref ( { relativeDates : mockRelativeDates . value } ) ,
1110 } ) ,
@@ -128,6 +127,18 @@ describe('DateTime', () => {
128127 } )
129128 expect ( component . find ( 'time' ) . attributes ( 'title' ) ) . toContain ( testYear )
130129 } )
130+
131+ it ( 'click to toggle relative dates setting' , async ( ) => {
132+ const component = await mountSuspended ( DateTime , {
133+ props : { datetime : testDate } ,
134+ } )
135+
136+ const button = component . find ( 'button' )
137+ button . trigger ( 'click' )
138+ expect ( mockRelativeDates . value ) . toBeTruthy ( )
139+ button . trigger ( 'click' )
140+ expect ( mockRelativeDates . value ) . toBeFalsy ( )
141+ } )
131142 } )
132143
133144 describe ( 'SSR fallback' , ( ) => {
You can’t perform that action at this time.
0 commit comments