test: update snapshots and add mock for ui components

Update test snapshots to reflect changes in component styling and structure
Add mock for @cherrystudio/ui components in CodeBlock tests
This commit is contained in:
icarus 2025-10-22 07:26:08 +08:00
parent e69260defa
commit b8a8f19892
4 changed files with 21 additions and 12 deletions

View File

@ -8,7 +8,7 @@ exports[`InputEmbeddingDimension > basic rendering > should match snapshot with
<input
data-testid="input-number"
placeholder="请输入维度大小"
style="flex: 1 1 0%;"
style="flex: 1;"
type="number"
value="1536"
/>
@ -43,7 +43,7 @@ exports[`InputEmbeddingDimension > basic rendering > should match snapshot with
<input
data-testid="input-number"
placeholder="请输入维度大小"
style="flex: 1 1 0%;"
style="flex: 1;"
type="number"
value=""
/>

View File

@ -24,7 +24,6 @@ exports[`Spinner > should match snapshot 1`] = `
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
style="color: unset;"
viewBox="0 0 24 24"
width="16"
xmlns="http://www.w3.org/2000/svg"

View File

@ -58,6 +58,12 @@ vi.mock('@renderer/hooks/useSettings', () => ({
useSettings: () => mocks.useSettings()
}))
vi.mock('@cherrystudio/ui', () => ({
cn: vi.fn((...classes) => classes.filter(Boolean).join(' ')),
Spinner: vi.fn(() => <div data-testid="spinner" />),
BlockingOverlay: vi.fn(({ children }) => <div>{children}</div>)
}))
vi.mock('@renderer/components/CodeBlockView', () => ({
CodeBlockView: mocks.CodeBlockView,
HtmlArtifactsCard: mocks.HtmlArtifactsCard

View File

@ -2,15 +2,19 @@
exports[`CodeBlock > rendering > should render a snapshot 1`] = `
<div>
<div>
<code>
console.log("hello world")
</code>
<button
type="button"
>
Save
</button>
<div
class="relative"
>
<div>
<code>
console.log("hello world")
</code>
<button
type="button"
>
Save
</button>
</div>
</div>
</div>
`;