mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-21 21:47:00 +08:00
feat: 统一按钮
This commit is contained in:
@@ -14,6 +14,11 @@ import {
|
||||
SelectValue,
|
||||
Switch
|
||||
} from '../../src/renderer/src/components/ui'
|
||||
import { IconButton } from '../../src/renderer/src/components/ui/icon-button'
|
||||
import {
|
||||
SegmentedControl,
|
||||
SegmentedControlItem
|
||||
} from '../../src/renderer/src/components/ui/segmented-control'
|
||||
|
||||
describe('TraceMemo UI control states', () => {
|
||||
it('uses the compact, standard, and form control height contract', () => {
|
||||
@@ -32,6 +37,43 @@ describe('TraceMemo UI control states', () => {
|
||||
expect(screen.getByRole('textbox', { name: '表单输入' })).toHaveClass('h-control-form')
|
||||
})
|
||||
|
||||
it('keeps secondary and icon actions visually quiet by default', () => {
|
||||
render(
|
||||
<>
|
||||
<Button variant="outline">次要操作</Button>
|
||||
<IconButton label="刷新" tooltip="">
|
||||
↻
|
||||
</IconButton>
|
||||
</>
|
||||
)
|
||||
|
||||
expect(screen.getByRole('button', { name: '次要操作' })).toHaveClass(
|
||||
'border-border-subtle',
|
||||
'bg-transparent'
|
||||
)
|
||||
expect(screen.getByRole('button', { name: '刷新' })).toHaveClass(
|
||||
'text-foreground',
|
||||
'hover:bg-accent'
|
||||
)
|
||||
expect(screen.getByRole('button', { name: '刷新' })).not.toHaveClass('bg-primary')
|
||||
})
|
||||
|
||||
it('uses a surface-free selected contract for segmented choices', () => {
|
||||
render(
|
||||
<SegmentedControl aria-label="模式" defaultValue="one">
|
||||
<SegmentedControlItem value="one">一</SegmentedControlItem>
|
||||
<SegmentedControlItem value="two">二</SegmentedControlItem>
|
||||
</SegmentedControl>
|
||||
)
|
||||
|
||||
const selected = screen.getByRole('radio', { name: '一' })
|
||||
expect(selected).toHaveClass(
|
||||
'data-[state=checked]:bg-accent',
|
||||
'data-[state=checked]:font-semibold'
|
||||
)
|
||||
expect(selected).not.toHaveClass('data-[state=checked]:shadow-surface')
|
||||
})
|
||||
|
||||
it('keeps disabled controls readable without the old opacity and surface shadow', () => {
|
||||
render(
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user