Files
Supra4E8C 23564214a2 fix(plugins): use theme backgrounds for resource pages
Replace hard-coded white shell, transition-layer, page and iframe backgrounds with the theme background token. Add source regression checks.

Refs #443
2026-09-20 16:43:20 +08:00

26 lines
1.1 KiB
TypeScript

import { describe, expect, test } from 'bun:test';
import { readFileSync } from 'node:fs';
const readSource = (path: string) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8');
// Source contracts only: these do not verify iframe painting in a browser.
describe('plugin resource theme backgrounds', () => {
const page = readSource('src/features/plugins/PluginResourcePage.module.scss');
const layout = readSource('src/styles/layout.scss');
for (const selector of ['page', 'frame']) {
test(`${selector} uses the theme background`, () => {
const block = page.match(new RegExp(`\\.${selector}\\s*\\{([^}]+)\\}`))?.[1];
expect(block).toContain('background: var(--bg-secondary);');
expect(block).not.toMatch(/#fff(?:fff)?\b/i);
});
}
test('plugin shell and transition layers use the theme background', () => {
const block = layout.match(/&\.main-content-plugin-resource\s*\{([\s\S]*?)\n {2}\}/)?.[1];
expect(block).toBeDefined();
expect(block?.match(/background: var\(--bg-secondary\);/g)).toHaveLength(2);
expect(block).not.toMatch(/#fff(?:fff)?\b/i);
});
});