Skip to content

Commit d79a443

Browse files
committed
test: Storybook cleanup
1 parent c2e4b20 commit d79a443

File tree

5 files changed

+25
-138
lines changed

5 files changed

+25
-138
lines changed

tools/server/webui/src/lib/components/app/chat/ChatSidebar/ChatSidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
{#if filteredConversations.length === 0}
9191
<div class="px-2 py-4 text-center">
92-
<p class="text-muted-foreground text-sm">
92+
<p class="text-muted-foreground text-sm p-4 mb-4">
9393
{searchQuery.length > 0
9494
? 'No results found'
9595
: isSearchModeActive

tools/server/webui/src/stories/ChatForm.stories.svelte

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script module lang="ts">
22
import { defineMeta } from '@storybook/addon-svelte-csf';
33
import ChatForm from '$lib/components/app/chat/ChatForm/ChatForm.svelte';
4-
import { expect } from 'storybook/internal/test';
4+
import { expect, screen } from 'storybook/internal/test';
55
import { mockServerProps, mockConfigs } from './fixtures/storybook-mocks';
66
import jpgAsset from './fixtures/assets/1.jpg?url';
77
import svgAsset from './fixtures/assets/hf-logo.svg?url';
@@ -26,11 +26,11 @@
2626
},
2727
{
2828
id: '2',
29-
name: '1.svg',
29+
name: 'hf-logo.svg',
3030
type: 'image/svg+xml',
3131
size: 1234,
3232
preview: svgAsset,
33-
file: new File([''], '1.svg', { type: 'image/svg+xml' })
33+
file: new File([''], 'hf-logo.svg', { type: 'image/svg+xml' })
3434
},
3535
{
3636
id: '3',
@@ -169,6 +169,21 @@
169169
}}
170170
play={async ({ canvas }) => {
171171
mockServerProps(mockConfigs.bothModalities);
172-
console.log('✅ File Attachments: Both modalities enabled');
172+
173+
const jpgAttachment = canvas.getByAltText('1.jpg');
174+
const svgAttachment = canvas.getByAltText('hf-logo.svg');
175+
const pdfFileExtension = canvas.getByText('PDF');
176+
const pdfAttachment = canvas.getByText('example.pdf');
177+
const pdfSize = canvas.getByText('342.82 KB');
178+
179+
await expect(jpgAttachment).toBeInTheDocument();
180+
await expect(jpgAttachment).toHaveAttribute('src', jpgAsset);
181+
182+
await expect(svgAttachment).toBeInTheDocument();
183+
await expect(svgAttachment).toHaveAttribute('src', svgAsset);
184+
185+
await expect(pdfFileExtension).toBeInTheDocument();
186+
await expect(pdfAttachment).toBeInTheDocument();
187+
await expect(pdfSize).toBeInTheDocument();
173188
}}
174189
/>

tools/server/webui/src/stories/ChatSidebar.stories.svelte

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}, 0));
6060
}}
6161
>
62-
<div class="bg-background h-screen w-[18rem]">
62+
<div class="bg-background h-screen w-72 flex-column h-full">
6363

6464
<ChatSidebar />
6565
</div>
@@ -78,30 +78,23 @@
7878

7979
const searchTrigger = screen.getByText('Search conversations');
8080
userEvent.click(searchTrigger);
81-
82-
// canvas = within(canvasElement);
83-
84-
// const searchInput = canvas.getAllByPlaceholderText('Search conversations...');
85-
86-
console.log(canvasElement);
87-
88-
// await expect(canvas.getByRole('textbox')).toBeInTheDocument();
8981
}}
9082
>
91-
<div class="bg-background h-screen w-[18rem]">
83+
<div class="bg-background h-screen w-72 flex-column h-full">
9284
<ChatSidebar />
9385
</div>
9486
</Story>
9587

96-
<Story
88+
<Story
89+
asChild
9790
name="Empty"
9891
play={async ({ canvas }) => {
9992
// Mock empty conversations store
10093
const { chatStore } = await import('$lib/stores/chat.svelte');
10194
chatStore.conversations = [];
10295
}}
10396
>
104-
<div class="bg-background h-screen w-80 border-r">
97+
<div class="bg-background h-screen w-72 flex-column h-full">
10598
<ChatSidebar />
10699
</div>
107100
</Story>

tools/server/webui/src/stories/ChatSidebarConversationItem.stories.svelte

Lines changed: 0 additions & 92 deletions
This file was deleted.

tools/server/webui/src/stories/ChatSidebarSearch.stories.svelte

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)