feat: unify phase one creation flow
This commit is contained in:
42
src/components/unified-creation/UnifiedCreationPage.test.tsx
Normal file
42
src/components/unified-creation/UnifiedCreationPage.test.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
/* @vitest-environment jsdom */
|
||||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { UnifiedCreationPage } from './UnifiedCreationPage';
|
||||
import { getUnifiedCreationSpec } from './unifiedCreationSpecs';
|
||||
|
||||
describe('UnifiedCreationPage', () => {
|
||||
test('按后端字段 spec 暴露统一创作页字段契约', () => {
|
||||
render(
|
||||
<UnifiedCreationPage spec={getUnifiedCreationSpec('wooden-fish')}>
|
||||
<div>敲木鱼工作台</div>
|
||||
</UnifiedCreationPage>,
|
||||
);
|
||||
|
||||
const root = screen
|
||||
.getByText('敲木鱼工作台')
|
||||
.closest('.unified-creation-page');
|
||||
expect(root?.getAttribute('data-play-id')).toBe('wooden-fish');
|
||||
expect(root?.getAttribute('data-field-kinds')).toBe(
|
||||
'text,image,audio,text',
|
||||
);
|
||||
expect(root?.getAttribute('data-workspace-stage')).toBe(
|
||||
'wooden-fish-workspace',
|
||||
);
|
||||
expect(root?.getAttribute('data-generation-stage')).toBe(
|
||||
'wooden-fish-generating',
|
||||
);
|
||||
expect(root?.getAttribute('data-result-stage')).toBe('wooden-fish-result');
|
||||
|
||||
const fields = screen.getAllByTestId('unified-creation-field');
|
||||
expect(fields.map((field) => field.getAttribute('data-field-id'))).toEqual([
|
||||
'hitObjectPrompt',
|
||||
'hitObjectReferenceImage',
|
||||
'hitSoundAsset',
|
||||
'floatingWords',
|
||||
]);
|
||||
expect(fields[2]?.getAttribute('data-field-kind')).toBe('audio');
|
||||
expect(fields[3]?.getAttribute('data-required')).toBe('true');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user