Files
Genarrative/src/components/image-editor/ImageCanvasTextAreaStyles.test.ts
T
k88936 99d239c8bf
Project CI / Repository checks (push) Successful in 50s
Project CI / Backend tests (push) Successful in 3m30s
Project CI / Frontend tests (push) Successful in 3m42s
Project CI / Native shell tests (push) Successful in 11m34s
style: 画布编辑器多行输入框样式调整 (#130)
复用了画布agent的输入框:

* 高度自适应
* 滑动条样式变为浅色和位置不再出界

before
![shotmd-1785745933-compressed.webp](/attachments/95727f6d-63e1-48f7-b806-8203cd73d1eb)
after
![shotmd-1785745957-compressed.webp](/attachments/b5af077d-d3b9-4572-9135-39e288291e24)

Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/130
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-08-04 17:07:30 +08:00

56 lines
1.9 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const stylesheet = readFileSync(
new URL('../../index.css', import.meta.url),
'utf8',
);
function readCssRule(selector: string) {
const ruleStart = stylesheet.indexOf(selector);
expect(ruleStart).toBeGreaterThanOrEqual(0);
const bodyStart = stylesheet.indexOf('{', ruleStart) + 1;
const bodyEnd = stylesheet.indexOf('}', bodyStart);
expect(bodyEnd).toBeGreaterThan(bodyStart);
return stylesheet.slice(bodyStart, bodyEnd);
}
describe('image canvas textarea chrome', () => {
it('keeps complete chrome in the canonical generation prompt styles', () => {
const generationRule = readCssRule(
'.image-canvas-editor__generation-prompt',
);
expect(generationRule).toContain('border: 1px solid');
expect(generationRule).toContain('border-radius: 1.05rem;');
expect(generationRule).toContain('background: #f8fafc;');
expect(generationRule).toContain('padding: 0.52rem 0.82rem;');
const generationFocusRule = readCssRule(
'.image-canvas-editor__generation-prompt:focus,',
);
expect(generationFocusRule).toContain(
'border-color: var(--image-canvas-brand-border-strong);',
);
expect(generationFocusRule).toContain(
'box-shadow: 0 0 0 3px var(--image-canvas-brand-focus-ring);',
);
const modalRule = readCssRule('.image-canvas-editor__generate-prompt');
expect(modalRule).toContain('border: 1px solid #d9dee8;');
expect(modalRule).toContain('border-radius: 0.45rem;');
expect(modalRule).toContain('background: #f8fafc;');
expect(modalRule).toContain('padding: 0.7rem;');
const modalFocusRule = readCssRule(
'.image-canvas-editor__generate-prompt:focus',
);
expect(modalFocusRule).toContain(
'border-color: var(--image-canvas-brand-border-strong);',
);
expect(modalFocusRule).toContain(
'box-shadow: 0 0 0 3px var(--image-canvas-brand-focus-ring);',
);
});
});