style: 恢复标签页分隔线并统一工具栏与图标按钮
This commit is contained in:
@@ -27,13 +27,12 @@ function selectTheme(key: string | number) {
|
||||
<template #trigger>
|
||||
<NButton
|
||||
quaternary
|
||||
circle
|
||||
class="theme-toggle"
|
||||
class="theme-toggle icon-button"
|
||||
:aria-label="`主题模式:${current.label}`"
|
||||
aria-haspopup="menu"
|
||||
:aria-expanded="open"
|
||||
>
|
||||
<component :is="current.icon" :size="18" aria-hidden="true" />
|
||||
<template #icon><component :is="current.icon" :size="18" aria-hidden="true" /></template>
|
||||
</NButton>
|
||||
</template>
|
||||
{{ current.label }} · 切换主题
|
||||
|
||||
@@ -35,9 +35,14 @@ const host = inject(workspaceHostKey, undefined)
|
||||
<template #header
|
||||
><div class="workspace-tools-heading">
|
||||
<span>{{ title }}</span
|
||||
><NButton quaternary circle aria-label="关闭操作面板" @click="open = false"
|
||||
><X :size="18"
|
||||
/></NButton></div
|
||||
><NButton
|
||||
quaternary
|
||||
class="icon-button"
|
||||
aria-label="关闭操作面板"
|
||||
title="关闭操作面板"
|
||||
@click="open = false"
|
||||
><template #icon><X :size="18" /></template
|
||||
></NButton></div
|
||||
></template>
|
||||
<slot />
|
||||
<template #footer><span class="text-xs text-muted">关闭面板不会取消已提交的后台任务。</span></template>
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
import { h } from 'vue'
|
||||
import { mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { NAlert, NButton, NCard, NCheckbox, NConfigProvider, NInput, NSelect, NTable, NTag } from 'naive-ui'
|
||||
import {
|
||||
NAlert,
|
||||
NButton,
|
||||
NCard,
|
||||
NCheckbox,
|
||||
NConfigProvider,
|
||||
NInput,
|
||||
NSelect,
|
||||
NTable,
|
||||
NTag,
|
||||
NTabPane,
|
||||
NTabs
|
||||
} from 'naive-ui'
|
||||
import { readFileSync, readdirSync } from 'node:fs'
|
||||
import { useTheme } from '../../composables/useTheme'
|
||||
|
||||
@@ -74,6 +86,10 @@ describe('全站平面主题', () => {
|
||||
h(NAlert, { type: 'error' }, () => '生成失败'),
|
||||
h(NCard, {}, () => '内容'),
|
||||
h(NTag, {}, () => '待设计'),
|
||||
h(NTabs, { type: 'line', value: 'one' }, () => [
|
||||
h(NTabPane, { name: 'one', tab: '人物' }, () => '人物内容'),
|
||||
h(NTabPane, { name: 'two', tab: '场景' }, () => '场景内容')
|
||||
]),
|
||||
h(NTable, { striped: true }, () => h('tbody', [h('tr', [h('td', '记录')])]))
|
||||
])
|
||||
}
|
||||
@@ -103,6 +119,31 @@ describe('全站平面主题', () => {
|
||||
expect(theme.common?.borderColor).not.toBe('transparent')
|
||||
expect(theme.Checkbox).not.toHaveProperty('border')
|
||||
expect(theme.Tabs?.barColor).toBe('#07c160')
|
||||
expect(value('.n-tabs', '--n-tab-border-color')).toBe(dark ? '#333333' : '#e5e5e5')
|
||||
})
|
||||
|
||||
it('单图标按钮以当前控件高度为边长,尺寸与内容按钮互不影响', () => {
|
||||
// happy-dom 不计算几何尺寸,此项约束共用样式和调用方,实际布局仍需浏览器验收。
|
||||
const css = readFileSync('src/admin.css', 'utf8')
|
||||
expect(css).toMatch(
|
||||
/\.n-button\.icon-button\s*\{[^}]*width:\s*var\(--n-height\);[^}]*min-width:\s*var\(--n-height\);[^}]*height:\s*var\(--n-height\);[^}]*padding:\s*0/
|
||||
)
|
||||
expect(css).toMatch(
|
||||
/\.project-status-filters \.n-radio-button\s*\{[^}]*min-width:\s*76px;[^}]*padding-inline:\s*18px/
|
||||
)
|
||||
expect(css).toMatch(/\.project-status-filters\.n-radio-group\s*\{[^}]*flex-wrap:\s*wrap;[^}]*height:\s*auto;/)
|
||||
for (const file of [
|
||||
'src/App.vue',
|
||||
'src/components/ui/ThemeToggle.vue',
|
||||
'src/components/ui/WorkspaceTools.vue',
|
||||
'src/features/projects/ProjectsPage.vue',
|
||||
'src/features/subject-identity/SubjectIdentityPage.vue'
|
||||
]) {
|
||||
const source = readFileSync(file, 'utf8')
|
||||
expect(source).toContain('icon-button')
|
||||
expect(source).not.toMatch(/<NButton\b[^>]*\bcircle\b/)
|
||||
}
|
||||
expect(readFileSync('src/components/ui/DirectoryItem.vue', 'utf8')).not.toContain('icon-button')
|
||||
})
|
||||
|
||||
it('业务面板、列表分组和标签以背景区分,保留键盘焦点与选中指示', () => {
|
||||
|
||||
Reference in New Issue
Block a user