@happyvertical/smrt-svelte 0.53.1 → 0.53.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +15 -15
- package/dist/__tests__/app-state.test.js +0 -156
- package/dist/__tests__/data-surface-bridge.test.js +0 -351
- package/dist/__tests__/provider-mode-harness.svelte +0 -14
- package/dist/__tests__/provider-mode-harness.svelte.d.ts +0 -11
- package/dist/__tests__/provider-mode-harness.svelte.d.ts.map +0 -1
- package/dist/__tests__/provider-mode-probe.svelte +0 -13
- package/dist/__tests__/provider-mode-probe.svelte.d.ts +0 -8
- package/dist/__tests__/provider-mode-probe.svelte.d.ts.map +0 -1
- package/dist/__tests__/provider-webmcp-harness.svelte +0 -14
- package/dist/__tests__/provider-webmcp-harness.svelte.d.ts +0 -8
- package/dist/__tests__/provider-webmcp-harness.svelte.d.ts.map +0 -1
- package/dist/__tests__/success-never-text.test.js +0 -100
- package/dist/__tests__/warm-clients.test.js +0 -186
- package/dist/browser-ai/adapters/llm/bitgpu-inference-backend.test.js +0 -464
- package/dist/browser-ai/adapters/llm/webllm-inference-backend.test.js +0 -646
- package/dist/browser-ai/adapters/stt/browser-speech.test.js +0 -113
- package/dist/browser-ai/adapters/stt/dictation-source.test.js +0 -52
- package/dist/browser-ai/svelte/components/__tests__/ModelStatusControl.test.js +0 -172
- package/dist/components/board/__tests__/Board.test.js +0 -498
- package/dist/components/board/__tests__/BoardSsrHarness.svelte +0 -30
- package/dist/components/board/__tests__/BoardSsrHarness.svelte.d.ts +0 -19
- package/dist/components/board/__tests__/BoardSsrHarness.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/AddressInput.behavior.test.js +0 -216
- package/dist/components/forms/__tests__/CheckboxInput.test.js +0 -92
- package/dist/components/forms/__tests__/DateRangeInput.behavior.test.js +0 -135
- package/dist/components/forms/__tests__/DateTimeInput.behavior.test.js +0 -113
- package/dist/components/forms/__tests__/FileUpload.error-alert.test.js +0 -37
- package/dist/components/forms/__tests__/FileUpload.native-form.test.js +0 -249
- package/dist/components/forms/__tests__/FileUpload.test.js +0 -90
- package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte +0 -24
- package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte.d.ts +0 -10
- package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/Form.behavior.test.js +0 -137
- package/dist/components/forms/__tests__/Form.extraction.test.js +0 -68
- package/dist/components/forms/__tests__/Form.stt-error.test.js +0 -57
- package/dist/components/forms/__tests__/Form.test.js +0 -86
- package/dist/components/forms/__tests__/Form.ui-controls.test.js +0 -119
- package/dist/components/forms/__tests__/Form.webmcp.test.js +0 -2336
- package/dist/components/forms/__tests__/FormMicButton.test.js +0 -92
- package/dist/components/forms/__tests__/FormScope.test.js +0 -39
- package/dist/components/forms/__tests__/MeasurementInput.behavior.test.js +0 -129
- package/dist/components/forms/__tests__/MoneyInput.behavior.test.js +0 -124
- package/dist/components/forms/__tests__/NumberInput.behavior.test.js +0 -151
- package/dist/components/forms/__tests__/PhoneInput.behavior.test.js +0 -96
- package/dist/components/forms/__tests__/SearchInput.test.js +0 -79
- package/dist/components/forms/__tests__/SelectInput.behavior.test.js +0 -132
- package/dist/components/forms/__tests__/TextInput.behavior.test.js +0 -131
- package/dist/components/forms/__tests__/TextareaInput.behavior.test.js +0 -96
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte +0 -30
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts +0 -7
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte +0 -19
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte +0 -21
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/composite-inputs-a11y.test.js +0 -69
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte +0 -27
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte +0 -48
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts +0 -10
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte +0 -26
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts +0 -13
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte +0 -52
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts +0 -16
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-scope.fixture.svelte +0 -30
- package/dist/components/forms/__tests__/form-scope.fixture.svelte.d.ts +0 -10
- package/dist/components/forms/__tests__/form-scope.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte +0 -158
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts +0 -51
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte +0 -24
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts +0 -11
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte +0 -105
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts +0 -42
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte +0 -84
- package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte.d.ts +0 -14
- package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte +0 -44
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/mic-keyboard-a11y.test.js +0 -74
- package/dist/components/forms/__tests__/policy-field.fixture.svelte +0 -35
- package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/rich-inputs-a11y.test.js +0 -87
- package/dist/components/settings/__tests__/SettingsCatalog.test.js +0 -69
- package/dist/components/settings/__tests__/catalog.test.js +0 -46
- package/dist/components/workspace/__tests__/AdminShell.responsive.test.js +0 -597
- package/dist/components/workspace/__tests__/AdminShell.test.js +0 -572
- package/dist/components/workspace/__tests__/RoleShell.test.js +0 -772
- package/dist/components/workspace/__tests__/TenantNav.test.js +0 -208
- package/dist/components/workspace/__tests__/WorkspaceAccountMenu.test.js +0 -79
- package/dist/components/workspace/__tests__/WorkspaceShell.test.js +0 -630
- package/dist/components/workspace/__tests__/admin-shell-header-overflow.test.js +0 -25
- package/dist/components/workspace/__tests__/admin-shell-hotkeys.test.js +0 -34
- package/dist/components/workspace/__tests__/admin-shell-mobile.test.js +0 -217
- package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte +0 -52
- package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte.d.ts +0 -23
- package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/admin-shell-page-contracts.test.js +0 -30
- package/dist/components/workspace/__tests__/admin-shell-responsive-state.test.js +0 -184
- package/dist/components/workspace/__tests__/admin-shell-settings.test.js +0 -25
- package/dist/components/workspace/__tests__/admin-shell-state.test.js +0 -286
- package/dist/components/workspace/__tests__/admin-shell-theme-hooks.test.js +0 -36
- package/dist/components/workspace/__tests__/breadcrumbs-helpers.test.js +0 -141
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte +0 -45
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts +0 -21
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/define-tools-dock.test.js +0 -1188
- package/dist/components/workspace/__tests__/harness.svelte +0 -25
- package/dist/components/workspace/__tests__/harness.svelte.d.ts +0 -14
- package/dist/components/workspace/__tests__/harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/index.test.js +0 -28
- package/dist/components/workspace/__tests__/legacy-index.test.js +0 -9
- package/dist/components/workspace/__tests__/manifest-nav-helpers.test.js +0 -24
- package/dist/components/workspace/__tests__/manifest-nav.test.js +0 -599
- package/dist/components/workspace/__tests__/nav-helpers.test.js +0 -95
- package/dist/components/workspace/__tests__/render-harness.svelte +0 -66
- package/dist/components/workspace/__tests__/render-harness.svelte.d.ts +0 -32
- package/dist/components/workspace/__tests__/render-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/render-tools-dock.test.js +0 -260
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte +0 -58
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts +0 -16
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte +0 -41
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts +0 -13
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/shell-chrome-components.test.js +0 -108
- package/dist/components/workspace/__tests__/system-feed.test.js +0 -327
- package/dist/components/workspace/__tests__/test-icon.svelte +0 -17
- package/dist/components/workspace/__tests__/test-icon.svelte.d.ts +0 -19
- package/dist/components/workspace/__tests__/test-icon.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte +0 -38
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts +0 -22
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts +0 -66
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.js +0 -115
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts +0 -15
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.js +0 -7
- package/dist/components/workspace/__tests__/typed-tool-fixture.test.js +0 -115
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte +0 -9
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts +0 -19
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/use-harness.svelte +0 -23
- package/dist/components/workspace/__tests__/use-harness.svelte.d.ts +0 -8
- package/dist/components/workspace/__tests__/use-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/__tests__/use-tools-dock.test.js +0 -33
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte +0 -43
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts +0 -11
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts.map +0 -1
- package/dist/components/workspace/server/__tests__/compose-availability.test.js +0 -383
- package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts +0 -78
- package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts.map +0 -1
- package/dist/components/workspace/server/__tests__/typed-context-fixture.js +0 -104
- package/dist/hooks/__tests__/stt-consumer.fixture.svelte +0 -25
- package/dist/hooks/__tests__/stt-consumer.fixture.svelte.d.ts +0 -15
- package/dist/hooks/__tests__/stt-consumer.fixture.svelte.d.ts.map +0 -1
- package/dist/hooks/__tests__/stt-ownership-harness.svelte +0 -42
- package/dist/hooks/__tests__/stt-ownership-harness.svelte.d.ts +0 -20
- package/dist/hooks/__tests__/stt-ownership-harness.svelte.d.ts.map +0 -1
- package/dist/hooks/__tests__/useSTT-ownership.test.js +0 -102
- package/dist/i18n/__tests__/server.spec.js +0 -57
- package/dist/internal/logger.test.js +0 -54
- package/dist/provider-mode.test.js +0 -86
- package/dist/provider-webmcp.test.js +0 -244
- package/dist/state/__tests__/app-state-ai-lifecycle.test.js +0 -240
- package/dist/state/__tests__/warm-clients.test.js +0 -40
- package/dist/web/__tests__/activity-feed-harness.svelte +0 -32
- package/dist/web/__tests__/activity-feed-harness.svelte.d.ts +0 -18
- package/dist/web/__tests__/activity-feed-harness.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/activity-feed.integration.svelte.test.js +0 -190
- package/dist/web/__tests__/activity-feed.svelte.test.js +0 -235
- package/dist/web/__tests__/assistant-dock.integration.svelte.test.js +0 -204
- package/dist/web/__tests__/data-surface-conformance.integration.svelte.test.js +0 -1392
- package/dist/web/__tests__/harness.svelte +0 -25
- package/dist/web/__tests__/harness.svelte.d.ts +0 -15
- package/dist/web/__tests__/harness.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/list-data-surface.fixture.svelte +0 -59
- package/dist/web/__tests__/list-data-surface.fixture.svelte.d.ts +0 -14
- package/dist/web/__tests__/list-data-surface.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/list-data-surface.svelte.test.js +0 -106
- package/dist/web/__tests__/list-data-surface.test.js +0 -651
- package/dist/web/__tests__/list-sort-surface.fixture.svelte +0 -41
- package/dist/web/__tests__/list-sort-surface.fixture.svelte.d.ts +0 -15
- package/dist/web/__tests__/list-sort-surface.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/list-sort-surface.svelte.test.js +0 -59
- package/dist/web/__tests__/live-collection.svelte.test.js +0 -185
- package/dist/web/__tests__/provider-ui-registry.fixture.svelte +0 -43
- package/dist/web/__tests__/provider-ui-registry.fixture.svelte.d.ts +0 -13
- package/dist/web/__tests__/provider-ui-registry.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/provider-ui-registry.test.js +0 -235
- package/dist/web/__tests__/remote-query-harness.svelte +0 -27
- package/dist/web/__tests__/remote-query-harness.svelte.d.ts +0 -11
- package/dist/web/__tests__/remote-query-harness.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/remote-query.svelte.test.js +0 -101
- package/dist/web/__tests__/surfaces.child.fixture.svelte +0 -69
- package/dist/web/__tests__/surfaces.child.fixture.svelte.d.ts +0 -16
- package/dist/web/__tests__/surfaces.child.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/surfaces.fixture.svelte +0 -26
- package/dist/web/__tests__/surfaces.fixture.svelte.d.ts +0 -18
- package/dist/web/__tests__/surfaces.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/surfaces.svelte.test.js +0 -140
- package/dist/web/__tests__/update-available-harness.svelte +0 -46
- package/dist/web/__tests__/update-available-harness.svelte.d.ts +0 -22
- package/dist/web/__tests__/update-available-harness.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/update-available.svelte.test.js +0 -137
- package/dist/web/__tests__/view-intent-provider.fixture.svelte +0 -28
- package/dist/web/__tests__/view-intent-provider.fixture.svelte.d.ts +0 -13
- package/dist/web/__tests__/view-intent-provider.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/view-intent.fixture.svelte +0 -33
- package/dist/web/__tests__/view-intent.fixture.svelte.d.ts +0 -15
- package/dist/web/__tests__/view-intent.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/view-intent.intents.d.ts +0 -14
- package/dist/web/__tests__/view-intent.intents.d.ts.map +0 -1
- package/dist/web/__tests__/view-intent.intents.js +0 -38
- package/dist/web/__tests__/view-intent.svelte.test.js +0 -244
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte +0 -73
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts +0 -8
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-composed.fixture.svelte +0 -52
- package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts +0 -12
- package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-composed.integration.svelte.test.js +0 -251
- package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte +0 -16
- package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte.d.ts +0 -19
- package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte +0 -11
- package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte.d.ts +0 -8
- package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte +0 -20
- package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte.d.ts +0 -7
- package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-harness-unannotated.svelte +0 -14
- package/dist/web/__tests__/webmcp-harness-unannotated.svelte.d.ts +0 -19
- package/dist/web/__tests__/webmcp-harness-unannotated.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-harness.svelte +0 -18
- package/dist/web/__tests__/webmcp-harness.svelte.d.ts +0 -7
- package/dist/web/__tests__/webmcp-harness.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte +0 -13
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts +0 -19
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts.map +0 -1
- package/dist/web/__tests__/webmcp-ui.test.js +0 -723
- package/dist/web/__tests__/webmcp.test.js +0 -234
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
/** Rich Form hosting smrt-ui primitives, native attributes, and `enhance`. */
|
|
3
|
-
import {
|
|
4
|
-
Combobox,
|
|
5
|
-
type ControlInteractionRegistry,
|
|
6
|
-
FormGroup,
|
|
7
|
-
Input,
|
|
8
|
-
Select,
|
|
9
|
-
} from '@happyvertical/smrt-ui/forms';
|
|
10
|
-
import type { Attachment } from 'svelte/attachments';
|
|
11
|
-
import Form, { type FormEnhance } from '../Form.svelte';
|
|
12
|
-
import TextInput from '../TextInput.svelte';
|
|
13
|
-
|
|
14
|
-
let {
|
|
15
|
-
enhance = undefined,
|
|
16
|
-
attach = undefined,
|
|
17
|
-
interactionRegistry = undefined,
|
|
18
|
-
nameValue = $bindable(''),
|
|
19
|
-
}: {
|
|
20
|
-
enhance?: FormEnhance;
|
|
21
|
-
attach?: Attachment<HTMLFormElement>;
|
|
22
|
-
interactionRegistry?: ControlInteractionRegistry;
|
|
23
|
-
nameValue?: string;
|
|
24
|
-
} = $props();
|
|
25
|
-
let kind = $state('news');
|
|
26
|
-
let town = $state('lacombe');
|
|
27
|
-
let tagline = $state('');
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
{#if attach}
|
|
31
|
-
<Form
|
|
32
|
-
formId="setup-network"
|
|
33
|
-
webmcp
|
|
34
|
-
method="POST"
|
|
35
|
-
action="?/create"
|
|
36
|
-
enctype="multipart/form-data"
|
|
37
|
-
novalidate
|
|
38
|
-
aria-label="Set up your network"
|
|
39
|
-
data-testid="network-form"
|
|
40
|
-
{enhance}
|
|
41
|
-
{interactionRegistry}
|
|
42
|
-
{@attach attach}
|
|
43
|
-
>
|
|
44
|
-
{@render fields()}
|
|
45
|
-
</Form>
|
|
46
|
-
{:else}
|
|
47
|
-
<Form
|
|
48
|
-
formId="setup-network"
|
|
49
|
-
webmcp
|
|
50
|
-
method="POST"
|
|
51
|
-
action="?/create"
|
|
52
|
-
enctype="multipart/form-data"
|
|
53
|
-
novalidate
|
|
54
|
-
aria-label="Set up your network"
|
|
55
|
-
data-testid="network-form"
|
|
56
|
-
{enhance}
|
|
57
|
-
{interactionRegistry}
|
|
58
|
-
>
|
|
59
|
-
{@render fields()}
|
|
60
|
-
</Form>
|
|
61
|
-
{/if}
|
|
62
|
-
|
|
63
|
-
{#snippet fields()}
|
|
64
|
-
<FormGroup label="Network name" id="name">
|
|
65
|
-
<Input name="name" bind:value={nameValue} />
|
|
66
|
-
</FormGroup>
|
|
67
|
-
<FormGroup label="Kind of network" id="kind">
|
|
68
|
-
<Select name="kind" bind:value={kind}>
|
|
69
|
-
<option value="news">News</option>
|
|
70
|
-
<option value="aggregator">Roundup</option>
|
|
71
|
-
</Select>
|
|
72
|
-
</FormGroup>
|
|
73
|
-
<Combobox
|
|
74
|
-
name="town"
|
|
75
|
-
label="Home town"
|
|
76
|
-
options={[
|
|
77
|
-
{ value: 'lacombe', label: 'Lacombe' },
|
|
78
|
-
{ value: 'blackfalds', label: 'Blackfalds' },
|
|
79
|
-
]}
|
|
80
|
-
bind:value={town}
|
|
81
|
-
/>
|
|
82
|
-
<TextInput name="tagline" label="Tagline" bind:value={tagline} />
|
|
83
|
-
<button type="submit">Create</button>
|
|
84
|
-
{/snippet}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** Rich Form hosting smrt-ui primitives, native attributes, and `enhance`. */
|
|
2
|
-
import { type ControlInteractionRegistry } from '@happyvertical/smrt-ui/forms';
|
|
3
|
-
import type { Attachment } from 'svelte/attachments';
|
|
4
|
-
import { type FormEnhance } from '../Form.svelte';
|
|
5
|
-
type $$ComponentProps = {
|
|
6
|
-
enhance?: FormEnhance;
|
|
7
|
-
attach?: Attachment<HTMLFormElement>;
|
|
8
|
-
interactionRegistry?: ControlInteractionRegistry;
|
|
9
|
-
nameValue?: string;
|
|
10
|
-
};
|
|
11
|
-
declare const FormWithUiControls: import("svelte").Component<$$ComponentProps, {}, "nameValue">;
|
|
12
|
-
type FormWithUiControls = ReturnType<typeof FormWithUiControls>;
|
|
13
|
-
export default FormWithUiControls;
|
|
14
|
-
//# sourceMappingURL=form-with-ui-controls.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-with-ui-controls.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/form-with-ui-controls.fixture.svelte.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,OAAO,EAEL,KAAK,0BAA0B,EAIhC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGvD,KAAK,gBAAgB,GAAI;IACxB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IACrC,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAiDF,QAAA,MAAM,kBAAkB,+DAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createControlInteractionRegistry } from '@happyvertical/smrt-ui/forms';
|
|
3
|
-
import {
|
|
4
|
-
type FieldDefinition,
|
|
5
|
-
type SMRTFormContext,
|
|
6
|
-
setFormContext,
|
|
7
|
-
} from '../../../state/form-context.js';
|
|
8
|
-
import TextInput from '../TextInput.svelte';
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
showField = true,
|
|
12
|
-
onregister,
|
|
13
|
-
onunregister,
|
|
14
|
-
}: {
|
|
15
|
-
showField?: boolean;
|
|
16
|
-
onregister?: (name: string) => void;
|
|
17
|
-
onunregister?: (name: string) => void;
|
|
18
|
-
} = $props();
|
|
19
|
-
|
|
20
|
-
const fields = new Map<string, FieldDefinition>();
|
|
21
|
-
const legacyContext: SMRTFormContext = {
|
|
22
|
-
mode: 'default',
|
|
23
|
-
registerField(field) {
|
|
24
|
-
fields.set(field.name, field);
|
|
25
|
-
onregister?.(field.name);
|
|
26
|
-
},
|
|
27
|
-
unregisterField(name) {
|
|
28
|
-
fields.delete(name);
|
|
29
|
-
onunregister?.(name);
|
|
30
|
-
},
|
|
31
|
-
getFieldSchema: () => Array.from(fields.values()),
|
|
32
|
-
isFormListening: false,
|
|
33
|
-
isExtracting: false,
|
|
34
|
-
toggleListening: () => {},
|
|
35
|
-
interactionRegistry: createControlInteractionRegistry(),
|
|
36
|
-
formId: 'legacy-context',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
setFormContext(legacyContext);
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
{#if showField}
|
|
43
|
-
<TextInput name="legacy-field" label="Legacy field" />
|
|
44
|
-
{/if}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
showField?: boolean;
|
|
3
|
-
onregister?: (name: string) => void;
|
|
4
|
-
onunregister?: (name: string) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const LegacyFormContext: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type LegacyFormContext = ReturnType<typeof LegacyFormContext>;
|
|
8
|
-
export default LegacyFormContext;
|
|
9
|
-
//# sourceMappingURL=legacy-form-context.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-form-context.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/legacy-form-context.fixture.svelte.ts"],"names":[],"mappings":"AAWC,KAAK,gBAAgB,GAAI;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAwCF,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Regression: per-field voice mics are keyboard-operable (C1, WCAG 2.1.1).
|
|
3
|
-
*
|
|
4
|
-
* Before the fix the mic <button>s were bound only to mousedown/up + touch
|
|
5
|
-
* handlers (onclick was a no-op preventDefault), so a keyboard user could focus
|
|
6
|
-
* the mic but never record. The fix adds Enter/Space toggle activation, mirror-
|
|
7
|
-
* ing FormMicButton. TextInput is the representative editable field;
|
|
8
|
-
* DateTimeInput is covered too because its SMRT-mode text input is read-only —
|
|
9
|
-
* the mic is the ONLY keyboard entry path there.
|
|
10
|
-
*
|
|
11
|
-
* useAppState/useSTT throw outside a <Provider>, so both are mocked. The STT
|
|
12
|
-
* stub starts `isReady: true` so the hold flow skips initialize() and the
|
|
13
|
-
* start()/stop() spies fire synchronously enough to assert.
|
|
14
|
-
*/
|
|
15
|
-
import { render, screen } from '@testing-library/svelte';
|
|
16
|
-
import userEvent from '@testing-library/user-event';
|
|
17
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
18
|
-
const sttStub = {
|
|
19
|
-
isListening: false,
|
|
20
|
-
isInitializing: false,
|
|
21
|
-
isReady: true,
|
|
22
|
-
adapterType: 'whisper-wasm',
|
|
23
|
-
downloadProgress: 0,
|
|
24
|
-
lastResult: '',
|
|
25
|
-
initialize: vi.fn(async () => { }),
|
|
26
|
-
start: vi.fn(async () => { }),
|
|
27
|
-
stop: vi.fn(async () => { }),
|
|
28
|
-
};
|
|
29
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
30
|
-
useAppState: () => ({ state: { mode: 'smrt' }, setMode: vi.fn() }),
|
|
31
|
-
}));
|
|
32
|
-
vi.mock('../../../hooks/useSTT.svelte.js', () => ({
|
|
33
|
-
useSTT: () => sttStub,
|
|
34
|
-
}));
|
|
35
|
-
import DateTimeInput from '../DateTimeInput.svelte';
|
|
36
|
-
import TextInput from '../TextInput.svelte';
|
|
37
|
-
beforeEach(() => {
|
|
38
|
-
vi.clearAllMocks();
|
|
39
|
-
sttStub.adapterType = 'whisper-wasm';
|
|
40
|
-
});
|
|
41
|
-
describe('TextInput mic — keyboard activation (C1)', () => {
|
|
42
|
-
it('exposes the mic as a focusable button with an accessible name', () => {
|
|
43
|
-
render(TextInput, { props: { name: 'note', label: 'Note' } });
|
|
44
|
-
const mic = screen.getByRole('button', { name: /speak|mic|voice/i });
|
|
45
|
-
expect(mic).toBeInTheDocument();
|
|
46
|
-
// Native <button> => in the tab order (not an empty/dead tab stop).
|
|
47
|
-
expect(mic).not.toHaveAttribute('tabindex', '-1');
|
|
48
|
-
});
|
|
49
|
-
it('starts recording on Enter and stops on the next Enter (toggle)', async () => {
|
|
50
|
-
render(TextInput, { props: { name: 'note', label: 'Note' } });
|
|
51
|
-
const mic = screen.getByRole('button', { name: /speak|mic|voice/i });
|
|
52
|
-
mic.focus();
|
|
53
|
-
await userEvent.keyboard('{Enter}');
|
|
54
|
-
expect(sttStub.start).toHaveBeenCalledTimes(1);
|
|
55
|
-
await userEvent.keyboard('{Enter}');
|
|
56
|
-
expect(sttStub.stop).toHaveBeenCalledTimes(1);
|
|
57
|
-
});
|
|
58
|
-
it('starts recording on Space', async () => {
|
|
59
|
-
render(TextInput, { props: { name: 'note', label: 'Note' } });
|
|
60
|
-
const mic = screen.getByRole('button', { name: /speak|mic|voice/i });
|
|
61
|
-
mic.focus();
|
|
62
|
-
await userEvent.keyboard(' ');
|
|
63
|
-
expect(sttStub.start).toHaveBeenCalledTimes(1);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe('DateTimeInput mic — keyboard activation (C1)', () => {
|
|
67
|
-
it('records via keyboard even though the text field is read-only', async () => {
|
|
68
|
-
render(DateTimeInput, { props: { name: 'when', label: 'When' } });
|
|
69
|
-
const mic = screen.getByRole('button', { name: /speak|mic|voice|date/i });
|
|
70
|
-
mic.focus();
|
|
71
|
-
await userEvent.keyboard('{Enter}');
|
|
72
|
-
expect(sttStub.start).toHaveBeenCalledTimes(1);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte';
|
|
3
|
-
import { tryGetFormContext } from '../../../state/form-context.js';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
sensitivity = 'public',
|
|
7
|
-
writable = true,
|
|
8
|
-
}: {
|
|
9
|
-
sensitivity?: 'public' | 'secret';
|
|
10
|
-
writable?: boolean;
|
|
11
|
-
} = $props();
|
|
12
|
-
let value = $state('Ada');
|
|
13
|
-
const policyLabel = 'Policy field';
|
|
14
|
-
const formContext = tryGetFormContext();
|
|
15
|
-
|
|
16
|
-
onMount(() => {
|
|
17
|
-
return formContext?.registerField({
|
|
18
|
-
name: 'policy',
|
|
19
|
-
type: 'text',
|
|
20
|
-
label: policyLabel,
|
|
21
|
-
get sensitivity() {
|
|
22
|
-
return sensitivity;
|
|
23
|
-
},
|
|
24
|
-
get writable() {
|
|
25
|
-
return writable;
|
|
26
|
-
},
|
|
27
|
-
setValue: (next) => {
|
|
28
|
-
value = String(next ?? '');
|
|
29
|
-
},
|
|
30
|
-
getValue: () => value,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<input name="policy" aria-label={policyLabel} bind:value />
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
sensitivity?: 'public' | 'secret';
|
|
3
|
-
writable?: boolean;
|
|
4
|
-
};
|
|
5
|
-
declare const PolicyField: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type PolicyField = ReturnType<typeof PolicyField>;
|
|
7
|
-
export default PolicyField;
|
|
8
|
-
//# sourceMappingURL=policy-field.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy-field.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/policy-field.fixture.svelte.ts"],"names":[],"mappings":"AAMC,KAAK,gBAAgB,GAAI;IACxB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAoCF,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accessibility golden tests for the standalone rich form inputs (Sweep L1,
|
|
3
|
-
* #1420). These inputs carry their own <label> + supporting/error text (they do
|
|
4
|
-
* NOT compose the base primitives), so each was given aria-describedby →
|
|
5
|
-
* supporting text and aria-invalid on its error state.
|
|
6
|
-
*
|
|
7
|
-
* They depend on the Provider-backed useAppState/useSTT hooks (which throw
|
|
8
|
-
* outside a <Provider>), so both are mocked once here to non-listening stubs.
|
|
9
|
-
*/
|
|
10
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
11
|
-
import { render, screen } from '@testing-library/svelte';
|
|
12
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
13
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
14
|
-
useAppState: () => ({ state: { mode: 'default' }, setMode: vi.fn() }),
|
|
15
|
-
}));
|
|
16
|
-
vi.mock('../../../hooks/useSTT.svelte.js', () => ({
|
|
17
|
-
useSTT: () => ({
|
|
18
|
-
isListening: false,
|
|
19
|
-
isInitializing: false,
|
|
20
|
-
isReady: false,
|
|
21
|
-
adapterType: null,
|
|
22
|
-
downloadProgress: 0,
|
|
23
|
-
lastResult: '',
|
|
24
|
-
initialize: vi.fn(),
|
|
25
|
-
start: vi.fn(),
|
|
26
|
-
stop: vi.fn(),
|
|
27
|
-
}),
|
|
28
|
-
}));
|
|
29
|
-
import NumberInput from '../NumberInput.svelte';
|
|
30
|
-
import PhoneInput from '../PhoneInput.svelte';
|
|
31
|
-
import SelectInput from '../SelectInput.svelte';
|
|
32
|
-
import TextareaInput from '../TextareaInput.svelte';
|
|
33
|
-
import TextInput from '../TextInput.svelte';
|
|
34
|
-
describe('rich form inputs — accessibility', () => {
|
|
35
|
-
it('TextInput: labelled + describedby + axe-clean', async () => {
|
|
36
|
-
const { container } = render(TextInput, {
|
|
37
|
-
props: { name: 'fullname', label: 'Full name' },
|
|
38
|
-
});
|
|
39
|
-
const input = screen.getByLabelText('Full name');
|
|
40
|
-
expect(input).toHaveAttribute('aria-describedby', 'fullname-supporting');
|
|
41
|
-
await expectNoA11yViolations(container);
|
|
42
|
-
});
|
|
43
|
-
it('TextareaInput: labelled + describedby + axe-clean', async () => {
|
|
44
|
-
const { container } = render(TextareaInput, {
|
|
45
|
-
props: { name: 'bio', label: 'Bio' },
|
|
46
|
-
});
|
|
47
|
-
const input = screen.getByLabelText('Bio');
|
|
48
|
-
expect(input).toHaveAttribute('aria-describedby', 'bio-supporting');
|
|
49
|
-
await expectNoA11yViolations(container);
|
|
50
|
-
});
|
|
51
|
-
it('SelectInput: labelled + describedby + axe-clean', async () => {
|
|
52
|
-
const { container } = render(SelectInput, {
|
|
53
|
-
props: {
|
|
54
|
-
name: 'country',
|
|
55
|
-
label: 'Country',
|
|
56
|
-
placeholder: 'Choose…',
|
|
57
|
-
options: [{ value: 'us', label: 'United States' }],
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
const select = screen.getByLabelText('Country');
|
|
61
|
-
expect(select).toHaveAttribute('aria-describedby', 'country-supporting');
|
|
62
|
-
await expectNoA11yViolations(container);
|
|
63
|
-
});
|
|
64
|
-
it('PhoneInput: labelled + axe-clean', async () => {
|
|
65
|
-
const { container } = render(PhoneInput, {
|
|
66
|
-
props: { name: 'phone', label: 'Phone' },
|
|
67
|
-
});
|
|
68
|
-
expect(screen.getByLabelText('Phone')).toBeInTheDocument();
|
|
69
|
-
await expectNoA11yViolations(container);
|
|
70
|
-
});
|
|
71
|
-
it('NumberInput: labelled + axe-clean', async () => {
|
|
72
|
-
const { container } = render(NumberInput, {
|
|
73
|
-
props: { name: 'age', label: 'Age' },
|
|
74
|
-
});
|
|
75
|
-
expect(screen.getByLabelText('Age')).toBeInTheDocument();
|
|
76
|
-
await expectNoA11yViolations(container);
|
|
77
|
-
});
|
|
78
|
-
it('NumberInput: sets aria-invalid + links the error when out of range', () => {
|
|
79
|
-
render(NumberInput, {
|
|
80
|
-
props: { name: 'age', label: 'Age', max: 10, value: 99 },
|
|
81
|
-
});
|
|
82
|
-
const input = screen.getByLabelText('Age');
|
|
83
|
-
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
84
|
-
expect(input).toHaveAttribute('aria-describedby', 'age-error');
|
|
85
|
-
expect(document.getElementById('age-error')).toHaveAttribute('role', 'alert');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
2
|
-
import { render, screen } from '@testing-library/svelte';
|
|
3
|
-
import { createRawSnippet } from 'svelte';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
import SettingsCatalog from '../SettingsCatalog.svelte';
|
|
6
|
-
const first = {
|
|
7
|
-
id: 'first',
|
|
8
|
-
label: 'First setting',
|
|
9
|
-
description: 'First description',
|
|
10
|
-
eyebrow: 'General',
|
|
11
|
-
status: 'Default',
|
|
12
|
-
template: 'First template',
|
|
13
|
-
};
|
|
14
|
-
const second = {
|
|
15
|
-
id: 'second',
|
|
16
|
-
label: 'Second setting',
|
|
17
|
-
description: 'Second description',
|
|
18
|
-
eyebrow: 'Advanced',
|
|
19
|
-
status: 'Override',
|
|
20
|
-
template: 'Second template',
|
|
21
|
-
};
|
|
22
|
-
function detailSnippet() {
|
|
23
|
-
return createRawSnippet((context) => ({
|
|
24
|
-
render: () => `<h2>${context().item.label} editor</h2><p>${context().item.template}</p>`,
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
describe('SettingsCatalog', () => {
|
|
28
|
-
it('renders a compact page, selected detail, and query-preserving links', () => {
|
|
29
|
-
const { container } = render((SettingsCatalog), {
|
|
30
|
-
props: {
|
|
31
|
-
baseUrl: '/settings/prompts',
|
|
32
|
-
detail: detailSnippet(),
|
|
33
|
-
preservedParams: { locale: 'fr-CA' },
|
|
34
|
-
page: {
|
|
35
|
-
items: [first, second],
|
|
36
|
-
selected: second,
|
|
37
|
-
query: 'tenant copy',
|
|
38
|
-
page: 2,
|
|
39
|
-
pageSize: 2,
|
|
40
|
-
total: 6,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
expect(screen.getByRole('searchbox')).toHaveValue('tenant copy');
|
|
45
|
-
expect(screen.getByRole('heading', { name: 'Second setting editor' })).toBeInTheDocument();
|
|
46
|
-
expect(container.querySelector('a[aria-current="true"]')).toHaveAttribute('href', '/settings/prompts?locale=fr-CA&q=tenant+copy&page=2&selected=second');
|
|
47
|
-
expect(screen.getByRole('link', { name: 'Previous' })).toHaveAttribute('href', '/settings/prompts?locale=fr-CA&q=tenant+copy');
|
|
48
|
-
expect(screen.getByRole('link', { name: 'Next' })).toHaveAttribute('href', '/settings/prompts?locale=fr-CA&q=tenant+copy&page=3');
|
|
49
|
-
});
|
|
50
|
-
it('renders an empty state and remains axe-clean', async () => {
|
|
51
|
-
const { container } = render((SettingsCatalog), {
|
|
52
|
-
props: {
|
|
53
|
-
baseUrl: '/settings/prompts',
|
|
54
|
-
detail: detailSnippet(),
|
|
55
|
-
page: {
|
|
56
|
-
items: [],
|
|
57
|
-
selected: null,
|
|
58
|
-
query: 'missing',
|
|
59
|
-
page: 1,
|
|
60
|
-
pageSize: 50,
|
|
61
|
-
total: 0,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
expect(screen.getByText('No settings match this search.')).toBeInTheDocument();
|
|
66
|
-
expect(screen.getByText('Select a setting to edit.')).toBeInTheDocument();
|
|
67
|
-
await expectNoA11yViolations(container);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { paginateSettingsCatalog } from '../catalog.js';
|
|
3
|
-
const items = Array.from({ length: 125 }, (_, index) => ({
|
|
4
|
-
id: `setting-${index + 1}`,
|
|
5
|
-
label: `Setting ${index + 1}`,
|
|
6
|
-
description: index % 2 === 0 ? 'Alpha group' : 'Beta group',
|
|
7
|
-
}));
|
|
8
|
-
describe('paginateSettingsCatalog', () => {
|
|
9
|
-
it('filters before paging and keeps the DOM-sized slice bounded', () => {
|
|
10
|
-
const page = paginateSettingsCatalog(items, {
|
|
11
|
-
query: 'alpha',
|
|
12
|
-
page: 2,
|
|
13
|
-
pageSize: 20,
|
|
14
|
-
});
|
|
15
|
-
expect(page.total).toBe(63);
|
|
16
|
-
expect(page.items).toHaveLength(20);
|
|
17
|
-
expect(page.page).toBe(2);
|
|
18
|
-
expect(page.items.every((item) => item.description === 'Alpha group')).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
it('clamps invalid pages and page sizes', () => {
|
|
21
|
-
const page = paginateSettingsCatalog(items, {
|
|
22
|
-
page: 999,
|
|
23
|
-
pageSize: 1_000,
|
|
24
|
-
});
|
|
25
|
-
expect(page.pageSize).toBe(100);
|
|
26
|
-
expect(page.page).toBe(2);
|
|
27
|
-
expect(page.items).toHaveLength(25);
|
|
28
|
-
});
|
|
29
|
-
it('selects an explicit item or falls back to the first visible item', () => {
|
|
30
|
-
expect(paginateSettingsCatalog(items, { selectedId: 'setting-73' }).selected?.id).toBe('setting-73');
|
|
31
|
-
expect(paginateSettingsCatalog(items).selected?.id).toBe('setting-1');
|
|
32
|
-
});
|
|
33
|
-
it('keeps a very large code-first registry to one bounded result page', () => {
|
|
34
|
-
const largeRegistry = Array.from({ length: 10_000 }, (_, index) => ({
|
|
35
|
-
id: `large-${index}`,
|
|
36
|
-
label: `Large setting ${index}`,
|
|
37
|
-
}));
|
|
38
|
-
const page = paginateSettingsCatalog(largeRegistry, {
|
|
39
|
-
page: 100,
|
|
40
|
-
pageSize: 50,
|
|
41
|
-
});
|
|
42
|
-
expect(page.total).toBe(10_000);
|
|
43
|
-
expect(page.items).toHaveLength(50);
|
|
44
|
-
expect(page.items[0]?.id).toBe('large-4950');
|
|
45
|
-
});
|
|
46
|
-
});
|