fix: 同步制作接口并修复浅色主题层次

This commit is contained in:
GouJ
2026-09-14 10:08:54 +08:00
parent 2eea0ea72e
commit 7ea3f2a0b4
19 changed files with 641 additions and 93 deletions
+5 -4
View File
@@ -52,7 +52,7 @@ describe('微信风格明暗主题', () => {
const color = overrides.value.Tabs!.tabBorderColor!
if (typeof color !== 'string') throw new Error('Tabs 分隔线颜色必须为字符串')
expect(color).toBe('#dadada')
expect(contrast(color, '#ededed')).toBeGreaterThan(1.15)
expect(contrast(color, '#ffffff')).toBeGreaterThan(1.15)
expect(contrast(color, '#ffffff')).toBeGreaterThan(1.15)
})
@@ -86,7 +86,7 @@ describe('微信风格明暗主题', () => {
it('深浅模式同时更新 Naive 主题和业务颜色标记', async () => {
const state = setup()
expect(state.overrides.value.common?.primaryColor).toBe('#07c160')
expect(state.overrides.value.common?.bodyColor).toBe('#ededed')
expect(state.overrides.value.common?.bodyColor).toBe('#ffffff')
state.preference.value = 'dark'
await nextTick()
expect(state.theme.value?.name).toBe('dark')
@@ -158,13 +158,13 @@ describe('微信风格明暗主题', () => {
document.head.appendChild(meta)
try {
const state = setup()
expect(meta.content).toBe('#ededed')
expect(meta.content).toBe('#ffffff')
state.change(true)
await nextTick()
expect(meta.content).toBe('#111111')
state.preference.value = 'light'
await nextTick()
expect(meta.content).toBe('#ededed')
expect(meta.content).toBe('#ffffff')
} finally {
meta.remove()
}
@@ -190,3 +190,4 @@ describe('微信风格明暗主题', () => {
expect(document.documentElement.dataset.theme).toBe('dark')
})
})