/* @vitest-environment jsdom */ import { render, screen, within } from '@testing-library/react'; import type { ComponentProps } from 'react'; import { describe, expect, it, vi } from 'vitest'; import { AuthUiContext } from '../auth/AuthUiContext'; import { ImageCanvasShortcutDialogView } from './ImageCanvasShortcutDialogView'; const DARK_AUTH_UI_VALUE = { platformTheme: 'dark', } as ComponentProps['value']; describe('ImageCanvasShortcutDialogView', () => { it('renders the Windows canvas shortcut table', () => { render( , ); const dialog = screen.getByRole('dialog', { name: '画布快捷键' }); expect(dialog.parentElement?.className).toContain('platform-theme--light'); expect(dialog.parentElement?.className).not.toContain( 'platform-theme--dark', ); expect(within(dialog).getByRole('heading', { name: '编辑' })).toBeTruthy(); expect(within(dialog).getByText('全选画布元素')).toBeTruthy(); expect(within(dialog).getAllByText('Ctrl').length).toBeGreaterThan(0); expect(within(dialog).getByText('A')).toBeTruthy(); expect(within(dialog).getByText('生成视频')).toBeTruthy(); expect(within(dialog).getAllByText('新增').length).toBeGreaterThan(0); }); });