|
| 1 | +import test from 'node:test'; |
| 2 | +import assert from 'node:assert/strict'; |
| 3 | +import { readFileSync } from 'node:fs'; |
| 4 | +import path from 'node:path'; |
| 5 | +import { fileURLToPath } from 'node:url'; |
| 6 | + |
| 7 | +// Expanded Codex activity grows with its content and lets the transcript own |
| 8 | +// vertical scrolling. Nested scroll traps make completed commands and results |
| 9 | +// look truncated and are especially awkward with a trackpad. |
| 10 | + |
| 11 | +const rendererDir = path.dirname(fileURLToPath(import.meta.url)); |
| 12 | +const css = readFileSync(path.join(rendererDir, 'styles/turn-summary.css'), 'utf8'); |
| 13 | + |
| 14 | +function declarationsFor(selector) { |
| 15 | + const stripped = css.replace(/\/\*[\s\S]*?\*\//g, ''); |
| 16 | + const rulePattern = /([^{}]+)\{([^{}]*)\}/g; |
| 17 | + let match; |
| 18 | + while ((match = rulePattern.exec(stripped)) !== null) { |
| 19 | + const selectors = match[1].split(',').map((part) => part.trim()); |
| 20 | + if (selectors.includes(selector)) { |
| 21 | + return match[2] |
| 22 | + .split(';') |
| 23 | + .map((part) => part.trim()) |
| 24 | + .filter(Boolean); |
| 25 | + } |
| 26 | + } |
| 27 | + assert.fail(`missing tool trace rule ${selector}`); |
| 28 | +} |
| 29 | + |
| 30 | +test('expanded tool activity grows naturally without nested vertical scrolling', () => { |
| 31 | + for (const selector of ['.tool-trace-group-list', '.tool-trace-children-scroll']) { |
| 32 | + const declarations = declarationsFor(selector); |
| 33 | + assert.ok( |
| 34 | + declarations.includes('overflow: visible'), |
| 35 | + `${selector} must leave vertical scrolling to the transcript`, |
| 36 | + ); |
| 37 | + assert.ok( |
| 38 | + declarations.every((declaration) => !declaration.startsWith('max-height:')), |
| 39 | + `${selector} must not cap expanded activity height`, |
| 40 | + ); |
| 41 | + assert.ok( |
| 42 | + declarations.every((declaration) => !declaration.startsWith('overflow-y:')), |
| 43 | + `${selector} must not create a nested vertical scroller`, |
| 44 | + ); |
| 45 | + } |
| 46 | +}); |
0 commit comments