fix: ci
This commit is contained in:
@@ -16,8 +16,8 @@ const icons = Object.fromEntries(
|
||||
const iconNames = Object.keys(icons)
|
||||
|
||||
describe('ic_ds_ icon set', () => {
|
||||
it('exports the full icon set (46 deepsuite + 20 figma extracts + three product glyphs outside those sets)', () => {
|
||||
expect(iconNames.length).toBe(69)
|
||||
it('exports the full icon set (46 deepsuite + 20 figma extracts + four product glyphs outside those sets)', () => {
|
||||
expect(iconNames.length).toBe(70)
|
||||
})
|
||||
|
||||
it.each(iconNames)('%s renders an svg with currentColor fills and no hardcoded palette', (name) => {
|
||||
|
||||
+75
-6
@@ -3,6 +3,7 @@
|
||||
exports[`sidebar shell snapshots > renders the collapsed rail after the crossfade settles, in place 1`] = `
|
||||
<div
|
||||
data-slot="sidebar"
|
||||
style="display: contents;"
|
||||
>
|
||||
<div
|
||||
class="root collapsed railIn quietBars"
|
||||
@@ -52,10 +53,32 @@ exports[`sidebar shell snapshots > renders the collapsed rail after the crossfad
|
||||
</button>
|
||||
<div
|
||||
class="regionArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.workspaces"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="footArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
class="footerActions"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.footer.action"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="settingsArea"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.settings"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -63,6 +86,7 @@ exports[`sidebar shell snapshots > renders the collapsed rail after the crossfad
|
||||
exports[`sidebar shell snapshots > renders the expanded column (wordmark, capsule, empty holes) 1`] = `
|
||||
<div
|
||||
data-slot="sidebar"
|
||||
style="display: contents;"
|
||||
>
|
||||
<div
|
||||
class="root quietBars"
|
||||
@@ -122,10 +146,32 @@ exports[`sidebar shell snapshots > renders the expanded column (wordmark, capsul
|
||||
</button>
|
||||
<div
|
||||
class="regionArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.workspaces"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="footArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
class="footerActions"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.footer.action"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="settingsArea"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.settings"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -133,6 +179,7 @@ exports[`sidebar shell snapshots > renders the expanded column (wordmark, capsul
|
||||
exports[`sidebar shell snapshots > renders the expanded column in the default locale (zh, no setLocale) 1`] = `
|
||||
<div
|
||||
data-slot="sidebar"
|
||||
style="display: contents;"
|
||||
>
|
||||
<div
|
||||
class="root quietBars"
|
||||
@@ -192,10 +239,32 @@ exports[`sidebar shell snapshots > renders the expanded column in the default lo
|
||||
</button>
|
||||
<div
|
||||
class="regionArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.workspaces"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="footArea"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
class="footerActions"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.footer.action"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="settingsArea"
|
||||
>
|
||||
<div
|
||||
data-slot="sidebar.settings"
|
||||
style="display: contents;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -2,7 +2,11 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { stubSettingsScope, type StubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { ThemeSettings, ThemeSnapshot } from '@deepseek-ai/dsh-client-ui-theme/client'
|
||||
import type {
|
||||
ThemeSettings,
|
||||
ThemeSnapshot,
|
||||
ThemeTokenOverrides,
|
||||
} from '@deepseek-ai/dsh-client-ui-theme/client'
|
||||
import { ThemeRuntime } from '@deepseek-ai/dsh-client-ui-theme/client'
|
||||
|
||||
const make = (host = stubSettingsScope<ThemeSettings>()): {
|
||||
@@ -103,6 +107,91 @@ describe('ThemeRuntime', () => {
|
||||
expect(events.map(e => e.revision)).toEqual([1, 2, 3, 4])
|
||||
})
|
||||
|
||||
it('stacks reversible token overrides in call order and selects the active palette value', () => {
|
||||
const { theme } = make()
|
||||
const firstTokens: ThemeTokenOverrides = {
|
||||
'--shared': { light: 'first-light', dark: 'first-dark' },
|
||||
'--first': { light: 'first-only-light', dark: 'first-only-dark' },
|
||||
}
|
||||
const disposeFirst = theme.overrideTokens('first', firstTokens)
|
||||
firstTokens['--shared']!.light = 'mutated-after-call'
|
||||
const disposeSecond = theme.overrideTokens('second', {
|
||||
'--shared': { light: 'second-light', dark: 'second-dark' },
|
||||
})
|
||||
|
||||
expect(theme.getTheme().active.tokens).toMatchObject({
|
||||
'--first': 'first-only-light',
|
||||
'--shared': 'second-light',
|
||||
})
|
||||
theme.setTheme('dark')
|
||||
expect(theme.getTheme().active.tokens).toMatchObject({
|
||||
'--first': 'first-only-dark',
|
||||
'--shared': 'second-dark',
|
||||
})
|
||||
|
||||
disposeSecond()
|
||||
expect(theme.getTheme().active.tokens['--shared']).toBe('first-dark')
|
||||
disposeFirst()
|
||||
expect(theme.getTheme().active.tokens['--shared']).toBeUndefined()
|
||||
})
|
||||
|
||||
it('replacing one source leaves its stale disposer harmless', () => {
|
||||
const { theme, events } = make()
|
||||
const stale = theme.overrideTokens('package', {
|
||||
'--old': { light: 'old-light', dark: 'old-dark' },
|
||||
})
|
||||
const current = theme.overrideTokens('package', {
|
||||
'--new': { light: 'new-light', dark: 'new-dark' },
|
||||
})
|
||||
stale()
|
||||
expect(theme.getTheme().active.tokens).toEqual({ '--new': 'new-light' })
|
||||
current()
|
||||
current()
|
||||
expect(theme.getTheme().active.tokens).toEqual({})
|
||||
expect(events).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('exports sorted built-in, registered, and override-only token descriptions as copies', () => {
|
||||
const { theme } = make()
|
||||
theme.register({
|
||||
id: 'custom',
|
||||
colorScheme: 'light',
|
||||
tokens: {
|
||||
'--dsw-alias-bg-base': 'duplicate-built-in',
|
||||
'--registered': 'registered',
|
||||
},
|
||||
})
|
||||
theme.overrideTokens('package', {
|
||||
'--registered': { light: 'duplicate-registered', dark: 'duplicate-registered' },
|
||||
semanticAccent: { light: 'pink', dark: 'red' },
|
||||
})
|
||||
|
||||
const tokens = theme.exportInspectTokens()
|
||||
expect(tokens.map(token => token.name)).toEqual([...tokens.map(token => token.name)].sort())
|
||||
expect(tokens.find(token => token.name === '--registered')).toMatchObject({
|
||||
valueType: 'CSS value',
|
||||
cssVariable: '--registered',
|
||||
})
|
||||
const semantic = tokens.find(token => token.name === 'semanticAccent')
|
||||
expect(semantic).toMatchObject({ valueType: 'CSS value' })
|
||||
expect(semantic).not.toHaveProperty('cssVariable')
|
||||
expect(tokens.filter(token => token.name === '--dsw-alias-bg-base')).toHaveLength(1)
|
||||
|
||||
tokens[0]!.description = 'caller mutation'
|
||||
expect(theme.exportInspectTokens()[0]!.description).not.toBe('caller mutation')
|
||||
})
|
||||
|
||||
it('rejects every malformed token override value with a teaching error', () => {
|
||||
const { theme } = make()
|
||||
const override = (value: unknown): void => {
|
||||
theme.overrideTokens('package', { '--bad': value } as unknown as ThemeTokenOverrides)
|
||||
}
|
||||
expect(() => { override('red') }).toThrow(/bare string.*light.*dark/)
|
||||
for (const value of [1, null, {}, { light: 1, dark: 'dark' }, { light: 'light' }]) {
|
||||
expect(() => { override(value) }).toThrow(/must map to a \{ light, dark \} pair/)
|
||||
}
|
||||
})
|
||||
|
||||
it('context dispose releases the scope subscription', async () => {
|
||||
const { ctx, host } = make()
|
||||
expect(host.listenerCount()).toBe(1)
|
||||
|
||||
Reference in New Issue
Block a user