33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { readFileSync } from 'fs'
|
|
import { fileURLToPath } from 'url'
|
|
import { dirname, join } from 'path'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
const themeCss = readFileSync(join(__dirname, '../src/theme.css'), 'utf-8')
|
|
|
|
describe('theme.css contrast fixes', () => {
|
|
it('strengthens --color-border to a WCAG-compliant value in light mode', () => {
|
|
expect(themeCss).toContain('--color-border: #8c8c91;')
|
|
})
|
|
|
|
it('strengthens --color-border to a WCAG-compliant value in dark mode', () => {
|
|
expect(themeCss).toContain('--color-border: #64646e;')
|
|
})
|
|
|
|
it('darkens --modality-bh_text for 4.5:1 contrast with white text', () => {
|
|
expect(themeCss).toContain('--modality-bh_text: #8c643f;')
|
|
})
|
|
|
|
it('darkens --modality-nd_messenger for 4.5:1 contrast with white text', () => {
|
|
expect(themeCss).toContain('--modality-nd_messenger: #597186;')
|
|
})
|
|
|
|
it('differentiates --modality-fb_messenger from --modality-bh_email', () => {
|
|
const bhEmailMatch = themeCss.match(/--modality-bh_email: (#[0-9a-f]{6});/)
|
|
const fbMessengerMatch = themeCss.match(/--modality-fb_messenger: (#[0-9a-f]{6});/)
|
|
expect(bhEmailMatch).not.toBeNull()
|
|
expect(fbMessengerMatch).not.toBeNull()
|
|
expect(bhEmailMatch[1]).not.toBe(fbMessengerMatch[1])
|
|
})
|
|
})
|