mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-29 09:27:33 -05:00
test : pin the server mode in the add menu a11y story
The story asserts the add menu's first enabled item is the reasoning submenu, which is mounted only outside router mode. The vitest dev server proxies /props to whichever server is running, so the assertion depended on the machine's server mode and failed whenever a router was up. Pin the mode in the story, including props.role so a re-detection cannot flip it back. Assisted-by: pi:deepseek-ai/DeepSeek-V4.1-Flash
This commit is contained in:
@@ -2,8 +2,25 @@
|
||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
||||
import ChatScreenForm from '$lib/components/app/chat/ChatScreen/ChatScreenForm.svelte';
|
||||
import { ATTACHMENT_TOOLTIP_TEXT } from '$lib/constants';
|
||||
import { ServerRole } from '$lib/enums';
|
||||
import { serverStore } from '$lib/stores';
|
||||
import type { ApiLlamaCppServerProps } from '$lib/types';
|
||||
import { expect, screen, waitFor } from 'storybook/test';
|
||||
|
||||
/**
|
||||
* The add menu mounts the reasoning submenu only outside router mode, and the
|
||||
* dev server proxies /props to whichever server happens to be running, so pin
|
||||
* the mode this story asserts instead of inheriting it from the environment.
|
||||
*/
|
||||
function pinSingleModelMode(): void {
|
||||
serverStore.props = {
|
||||
...(serverStore.props ?? {}),
|
||||
role: ServerRole.MODEL
|
||||
} as ApiLlamaCppServerProps;
|
||||
|
||||
serverStore.role = ServerRole.MODEL;
|
||||
}
|
||||
|
||||
const { Story } = defineMeta({
|
||||
component: ChatScreenForm,
|
||||
parameters: {
|
||||
@@ -38,6 +55,8 @@
|
||||
args={{ class: 'max-w-[56rem] w-[calc(100vw-2rem)]' }}
|
||||
name="AddDropdownFocusesFirstEnabled"
|
||||
play={async ({ canvas, userEvent }) => {
|
||||
pinSingleModelMode();
|
||||
|
||||
const trigger = await canvas.findByRole('button', { name: ATTACHMENT_TOOLTIP_TEXT });
|
||||
|
||||
trigger.focus();
|
||||
|
||||
Reference in New Issue
Block a user