This commit is contained in:
2026-05-13 00:28:07 +08:00
parent ef4f91a75e
commit 01c5ab985a
101 changed files with 10635 additions and 2292 deletions

View File

@@ -213,12 +213,14 @@ test('puzzle workspace keeps the reference image upload as a primary panel', ()
);
expect(screen.getByText('拼图画面')).toBeTruthy();
expect(
screen.queryByText('若没有合适的图片可以通过填写画面描述生成画面'),
).toBeNull();
expect(
screen
.getByText('若没有合适的图片可以通过填写画面描述生成画面')
.getByText('上传图片/填写画面描述')
.closest('.puzzle-image-upload-card'),
).toBeTruthy();
expect(screen.getByText('点击上传拼图图片').closest('.puzzle-image-upload-card')).toBeTruthy();
expect(screen.queryByRole('switch', { name: 'AI重绘' })).toBeNull();
expect(screen.queryByLabelText('拼图创作模板')).toBeNull();
expect(
@@ -276,6 +278,9 @@ test('puzzle workspace selects a history image from the upload card', async () =
const historyButton = screen.getByRole('button', { name: '选择历史图片' });
expect(historyButton.closest('.puzzle-image-upload-card')).toBeTruthy();
expect(historyButton.className).toContain('top-3');
expect(historyButton.className).toContain('right-3');
expect(historyButton.className).not.toContain('bottom-3');
expect(screen.getByText('历史').closest('.puzzle-image-upload-card')).toBeTruthy();
fireEvent.click(historyButton);
@@ -321,7 +326,7 @@ test('puzzle upload card stays light in light theme', () => {
);
expect(container.querySelector('.puzzle-image-upload-card')).toBeTruthy();
const uploadLabel = screen.getByText('点击上传拼图图片');
const uploadLabel = screen.getByText('上传图片/填写画面描述');
expect(uploadLabel).toBeTruthy();
expect(uploadLabel.closest('.puzzle-image-upload-card')).toBeTruthy();
expect(uploadLabel.className).not.toContain('rounded-full');
@@ -571,7 +576,13 @@ test('puzzle workspace shows AI redraw switch only after upload', async () => {
screen.getByRole('switch', { name: 'AI重绘' }).closest('.puzzle-image-upload-card'),
).toBeTruthy();
expect(screen.getByRole('button', { name: '移除拼图图片' })).toBeTruthy();
expect(screen.queryByText('点击上传拼图图片')).toBeNull();
expect(screen.getByRole('button', { name: '移除拼图图片' }).className).toContain(
'left-3',
);
expect(screen.getByRole('button', { name: '选择历史图片' }).className).toContain(
'right-3',
);
expect(screen.queryByText('上传图片/填写画面描述')).toBeNull();
});
test('puzzle workspace confirms before removing uploaded image', async () => {
@@ -611,7 +622,7 @@ test('puzzle workspace confirms before removing uploaded image', async () => {
fireEvent.click(screen.getByRole('button', { name: '移除' }));
expect(screen.queryByAltText('拼图图片')).toBeNull();
expect(screen.queryByRole('switch', { name: 'AI重绘' })).toBeNull();
expect(screen.getByText('点击上传拼图图片')).toBeTruthy();
expect(screen.getByText('上传图片/填写画面描述')).toBeTruthy();
});
test('puzzle workspace opens crop tool for non-square uploads', async () => {