Group events into five temporal sections with section headers, date subheaders, and context-aware time display (clock time for upcoming, relative for past). Includes new useEventGrouping composable, SectionHeader and DateSubheader components, full unit and E2E test coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import SectionHeader from '../SectionHeader.vue'
|
|
|
|
describe('SectionHeader', () => {
|
|
it('renders the section label as an h2', () => {
|
|
const wrapper = mount(SectionHeader, { props: { label: 'Today' } })
|
|
const h2 = wrapper.find('h2')
|
|
expect(h2.exists()).toBe(true)
|
|
expect(h2.text()).toBe('Today')
|
|
})
|
|
|
|
it('does not apply emphasized class by default', () => {
|
|
const wrapper = mount(SectionHeader, { props: { label: 'Later' } })
|
|
expect(wrapper.find('.section-header--emphasized').exists()).toBe(false)
|
|
})
|
|
|
|
it('applies emphasized class when emphasized prop is true', () => {
|
|
const wrapper = mount(SectionHeader, { props: { label: 'Today', emphasized: true } })
|
|
expect(wrapper.find('.section-header--emphasized').exists()).toBe(true)
|
|
})
|
|
|
|
it('does not apply emphasized class when emphasized prop is false', () => {
|
|
const wrapper = mount(SectionHeader, { props: { label: 'Past', emphasized: false } })
|
|
expect(wrapper.find('.section-header--emphasized').exists()).toBe(false)
|
|
})
|
|
})
|