This commit is contained in:
2026-07-27 16:05:44 +08:00
parent aab0b7849b
commit 21143f9ff5
6 changed files with 471 additions and 448 deletions
+32 -9
View File
@@ -16,10 +16,16 @@ function readPlatformThemeCss() {
function getCssBlock(source: string, selector: string) {
const selectorIndex = source.indexOf(selector);
expect(selectorIndex, `${selector} should exist in src/index.css`).toBeGreaterThanOrEqual(0);
expect(
selectorIndex,
`${selector} should exist in src/index.css`,
).toBeGreaterThanOrEqual(0);
const openBraceIndex = source.indexOf('{', selectorIndex);
expect(openBraceIndex, `${selector} should open a CSS block`).toBeGreaterThanOrEqual(0);
expect(
openBraceIndex,
`${selector} should open a CSS block`,
).toBeGreaterThanOrEqual(0);
let depth = 0;
for (let index = openBraceIndex; index < source.length; index += 1) {
@@ -111,7 +117,9 @@ describe('index stylesheet unread dots', () => {
);
expect(generatingBlock).toContain('cursor: progress;');
expect(generatingScanBlock).toContain('animation: image-canvas-generation-scan');
expect(generatingScanBlock).toContain(
'animation: image-canvas-generation-scan',
);
expect(iconBlock).toContain('background: linear-gradient(');
expect(iconDecorationBlock).toContain('width: 42%;');
expect(css).not.toContain(
@@ -129,11 +137,16 @@ describe('index stylesheet unread dots', () => {
css,
'.project-gallery__canvas-cover-loading::before,\n.image-canvas-editor__layer-image-loading::before',
);
const keyframesBlock = getCssBlock(css, '@keyframes image-canvas-generation-scan');
const keyframesBlock = getCssBlock(
css,
'@keyframes image-canvas-generation-scan',
);
expect(loadingBlock).toContain('overflow: hidden;');
expect(loadingBlock).toContain('background: rgba(226, 232, 240, 0.72);');
expect(loadingBlock).not.toContain('animation: image-canvas-generation-scan');
expect(loadingBlock).not.toContain(
'animation: image-canvas-generation-scan',
);
expect(shimmerBlock).toContain('left: -64%;');
expect(shimmerBlock).toContain('width: 64%;');
@@ -215,7 +228,9 @@ describe('index stylesheet unread dots', () => {
);
expect(platformShellBlock).toContain('--platform-layout-viewport-height');
expect(platformShellBlock).not.toContain('translate3d');
expect(platformShellBlock).not.toContain('--platform-keyboard-focus-offset');
expect(platformShellBlock).not.toContain(
'--platform-keyboard-focus-offset',
);
});
it('uses warm brown tokens for draft unread markers instead of red literals', () => {
@@ -248,7 +263,9 @@ describe('index stylesheet unread dots', () => {
const css = readIndexCss();
const themeCss = readPlatformThemeCss();
const titleRuleIndex = css.indexOf('.selection-hero-brand__title');
const platformThemeRuleIndex = css.indexOf('.platform-theme,\n.platform-theme *');
const platformThemeRuleIndex = css.indexOf(
'.platform-theme,\n.platform-theme *',
);
expect(titleRuleIndex).toBeGreaterThanOrEqual(0);
expect(platformThemeRuleIndex).toBeGreaterThan(titleRuleIndex);
@@ -313,7 +330,10 @@ describe('index stylesheet draft mobile cards', () => {
const draftPanelSelector =
'#platform-tab-panel-saves,\n #platform-tab-panel-saves *';
const draftPanelSelectorIndex = css.indexOf(draftPanelSelector, mobileQueryIndex);
const draftPanelSelectorIndex = css.indexOf(
draftPanelSelector,
mobileQueryIndex,
);
expect(draftPanelSelectorIndex).toBeGreaterThanOrEqual(0);
const draftPanelBlock = getCssBlock(css, draftPanelSelector);
@@ -323,7 +343,10 @@ describe('index stylesheet draft mobile cards', () => {
const editableSelector =
"#platform-tab-panel-saves :is(input, textarea, [contenteditable='true'])";
const editableSelectorIndex = css.indexOf(editableSelector, mobileQueryIndex);
const editableSelectorIndex = css.indexOf(
editableSelector,
mobileQueryIndex,
);
expect(editableSelectorIndex).toBeGreaterThanOrEqual(0);
const editableBlock = getCssBlock(css, editableSelector);