抽取配色css (#79)
Co-authored-by: 段舒康 <kdletters@qq.com> Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/79 Reviewed-by: 段舒康 <kdletters@qq.com> Co-authored-by: kvtodev <kvtodev@outlook.com> Co-committed-by: kvtodev <kvtodev@outlook.com>
This commit was merged in pull request #79.
This commit is contained in:
+2
-534
File diff suppressed because it is too large
Load Diff
+30
-4
@@ -7,6 +7,13 @@ function readIndexCss() {
|
||||
return fs.readFileSync(path.resolve(process.cwd(), 'src/index.css'), 'utf8');
|
||||
}
|
||||
|
||||
function readPlatformThemeCss() {
|
||||
return fs.readFileSync(
|
||||
path.resolve(process.cwd(), 'packages/shared/src/theme.css'),
|
||||
'utf8',
|
||||
);
|
||||
}
|
||||
|
||||
function getCssBlock(source: string, selector: string) {
|
||||
const selectorIndex = source.indexOf(selector);
|
||||
expect(selectorIndex, `${selector} should exist in src/index.css`).toBeGreaterThanOrEqual(0);
|
||||
@@ -194,11 +201,16 @@ describe('index stylesheet unread dots', () => {
|
||||
|
||||
it('uses warm brown tokens for draft unread markers instead of red literals', () => {
|
||||
const css = readIndexCss();
|
||||
const themeCss = readPlatformThemeCss();
|
||||
|
||||
expect(css).toContain('--platform-unread-dot-fill: #8b5a3d;');
|
||||
expect(css).toContain('--platform-unread-dot-glow: rgba(139, 90, 61, 0.34);');
|
||||
expect(css).toContain('--platform-unread-dot-fill: #d6a27c;');
|
||||
expect(css).toContain('--platform-unread-dot-glow: rgba(214, 162, 124, 0.24);');
|
||||
expect(themeCss).toContain('--platform-unread-dot-fill: #8b5a3d;');
|
||||
expect(themeCss).toContain(
|
||||
'--platform-unread-dot-glow: rgba(139, 90, 61, 0.34);',
|
||||
);
|
||||
expect(themeCss).toContain('--platform-unread-dot-fill: #d6a27c;');
|
||||
expect(themeCss).toContain(
|
||||
'--platform-unread-dot-glow: rgba(214, 162, 124, 0.24);',
|
||||
);
|
||||
|
||||
for (const selector of [
|
||||
'.creation-work-card__unread-dot',
|
||||
@@ -213,6 +225,20 @@ describe('index stylesheet unread dots', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps platform font overrides after branded title typography', () => {
|
||||
const css = readIndexCss();
|
||||
const themeCss = readPlatformThemeCss();
|
||||
const titleRuleIndex = css.indexOf('.selection-hero-brand__title');
|
||||
const platformThemeRuleIndex = css.indexOf('.platform-theme,\n.platform-theme *');
|
||||
|
||||
expect(titleRuleIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(platformThemeRuleIndex).toBeGreaterThan(titleRuleIndex);
|
||||
expect(getCssBlock(css, '.platform-theme,\n.platform-theme *')).toContain(
|
||||
'font-family: var(--platform-font-family) !important;',
|
||||
);
|
||||
expect(themeCss).not.toContain('.platform-theme,\n.platform-theme *');
|
||||
});
|
||||
|
||||
it('keeps the creation shelf share button on a visible surface', () => {
|
||||
const css = readIndexCss();
|
||||
const block = getCssBlock(css, '.creation-work-card__quick-action-button');
|
||||
|
||||
Reference in New Issue
Block a user