import { readFile } from 'node:fs/promises' import { test } from 'node:test' import assert from 'node:assert/strict' const styles = await readFile(new URL('../src/style.css', import.meta.url), 'utf8') const main = await readFile(new URL('../src/main.ts', import.meta.url), 'utf8') test('Pack toolbar is sized for the complete five-control row', () => { assert.match(styles, /\.pack-mode \.toolbar\s*{[^}]*flex:\s*1 1 760px;/s) assert.doesNotMatch(styles, /\.pack-mode \.toolbar\s*{[^}]*flex:\s*0 1 400px;/s) }) test('short landscape Pack mode protects scene height and offers compact controls', () => { assert.match(styles, /@media \(max-height: 540px\) and \(min-aspect-ratio: 4\/3\)[\s\S]*?\.pack-mode \.topbar\s*{[^}]*flex-wrap:\s*nowrap;/) assert.match(styles, /@media \(max-height: 540px\) and \(min-aspect-ratio: 4\/3\)[\s\S]*?\.pack-mode footer\s*{[^}]*display:\s*none;/) assert.match(styles, /@media \(max-height: 540px\) and \(min-aspect-ratio: 4\/3\) and \(max-width: 1120px\)[\s\S]*?\.pack-mode \.controls-toggle\s*{[^}]*display:\s*inline-flex;/) }) test('responsive control collapse follows viewport breakpoint changes', () => { assert.match(main, /const narrowControlsMedia = window\.matchMedia\('\(max-width: 880px\)'\)/) assert.match(main, /const shortPackControlsMedia = window\.matchMedia\(/) assert.match(main, /narrowControlsMedia\.addEventListener\('change', syncResponsiveControls\)/) assert.match(main, /shortPackControlsMedia\.addEventListener\('change', syncResponsiveControls\)/) assert.match(main, /mode === 'Pack' && shortPackControlsMedia\.matches/) })