/* @vitest-environment jsdom */ import { render, screen } from '@testing-library/react'; import { expect, test } from 'vitest'; import { PlatformBackActionButton } from './PlatformBackActionButton'; test('renders compact back action button by default', () => { render(); const button = screen.getByRole('button', { name: '返回' }); expect(button.className).toContain('platform-button--ghost'); expect(button.className).toContain('min-h-0'); expect(button.className).toContain('text-[11px]'); expect(button.className).toContain('gap-1.5'); expect(button.querySelector('svg')?.className.baseVal).toContain('h-3.5'); }); test('supports regular variant and editor dark surface', () => { render( , ); const button = screen.getByRole('button', { name: '返回编辑' }); expect(button.className).toContain('platform-action-button--editor-dark'); expect(button.className).toContain('text-sm'); expect(button.className).toContain('gap-2'); expect(button.querySelector('svg')?.className.baseVal).toContain('h-4'); });