import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' const indexCss = readFileSync ( resolve (process.cwd (), 'src/index.css'), 'utf8') const compactIndexCss = indexCss.replace (/\s+/g, ' ') const mobileActiveRule = '.top-nav-mobile-active {' + ' background: var(--top-nav-mobile-active-bg); }' const mobileSubmenuRule = '.top-nav-mobile-menu .top-nav-submenu {' + ' background: var(--top-nav-mobile-active-bg); }' describe ('TopNav mobile menu colours', () => { it ('uses one background variable for active rows and expanded submenus', () => { expect (compactIndexCss).toContain (mobileActiveRule) expect (compactIndexCss).toContain (mobileSubmenuRule) }) })