summaryrefslogtreecommitdiff
path: root/llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-02-12 20:57:17 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-02-12 20:57:17 +0100
commitb333b06772c89d96aacb5490d6a219fba7c09cc6 (patch)
tree211df60083a5946baa2ed61d33d8121b7e251b06 /llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte
downloadllmnpc-b333b06772c89d96aacb5490d6a219fba7c09cc6.tar.gz
Engage!
Diffstat (limited to 'llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte')
-rw-r--r--llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte97
1 files changed, 97 insertions, 0 deletions
diff --git a/llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte b/llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte
new file mode 100644
index 0000000..42cea87
--- /dev/null
+++ b/llama.cpp/tools/server/webui/tests/stories/ChatSidebar.stories.svelte
@@ -0,0 +1,97 @@
+<script module lang="ts">
+ import { defineMeta } from '@storybook/addon-svelte-csf';
+ import ChatSidebar from '$lib/components/app/chat/ChatSidebar/ChatSidebar.svelte';
+ import { waitFor } from 'storybook/test';
+ import { screen } from 'storybook/test';
+
+ const { Story } = defineMeta({
+ title: 'Components/ChatSidebar',
+ component: ChatSidebar,
+ parameters: {
+ layout: 'centered'
+ }
+ });
+
+ // Mock conversations for the sidebar
+ const mockConversations: DatabaseConversation[] = [
+ {
+ id: 'conv-1',
+ name: 'Getting Started with AI',
+ lastModified: Date.now() - 1000 * 60 * 5, // 5 minutes ago
+ currNode: 'msg-1'
+ },
+ {
+ id: 'conv-2',
+ name: 'Python Programming Help',
+ lastModified: Date.now() - 1000 * 60 * 60 * 2, // 2 hours ago
+ currNode: 'msg-2'
+ },
+ {
+ id: 'conv-3',
+ name: 'Creative Writing Ideas',
+ lastModified: Date.now() - 1000 * 60 * 60 * 24, // 1 day ago
+ currNode: 'msg-3'
+ },
+ {
+ id: 'conv-4',
+ name: 'This is a very long conversation title that should be truncated properly when displayed',
+ lastModified: Date.now() - 1000 * 60 * 60 * 24 * 3, // 3 days ago
+ currNode: 'msg-4'
+ },
+ {
+ id: 'conv-5',
+ name: 'Math Problem Solving',
+ lastModified: Date.now() - 1000 * 60 * 60 * 24 * 7, // 1 week ago
+ currNode: 'msg-5'
+ }
+ ];
+</script>
+
+<Story
+ asChild
+ name="Default"
+ play={async () => {
+ const { conversationsStore } = await import('$lib/stores/conversations.svelte');
+
+ waitFor(() => setTimeout(() => {
+ conversationsStore.conversations = mockConversations;
+ }, 0));
+ }}
+>
+ <div class="flex-column h-full h-screen w-72 bg-background">
+ <ChatSidebar />
+ </div>
+</Story>
+
+<Story
+ asChild
+ name="SearchActive"
+ play={async ({ userEvent }) => {
+ const { conversationsStore } = await import('$lib/stores/conversations.svelte');
+
+ waitFor(() => setTimeout(() => {
+ conversationsStore.conversations = mockConversations;
+ }, 0));
+
+ const searchTrigger = screen.getByText('Search conversations');
+ userEvent.click(searchTrigger);
+ }}
+>
+ <div class="flex-column h-full h-screen w-72 bg-background">
+ <ChatSidebar />
+ </div>
+</Story>
+
+<Story
+ asChild
+ name="Empty"
+ play={async () => {
+ // Mock empty conversations store
+ const { conversationsStore } = await import('$lib/stores/conversations.svelte');
+ conversationsStore.conversations = [];
+ }}
+>
+ <div class="flex-column h-full h-screen w-72 bg-background">
+ <ChatSidebar />
+ </div>
+</Story>