Skip to content

Commit a5f8164

Browse files
committed
chore: update
1 parent 3d8a4be commit a5f8164

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

app/components/DateTime.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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"

test/nuxt/components/DateTime.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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', () => {

0 commit comments

Comments
 (0)