@happyvertical/smrt-svelte 0.53.0 → 0.53.2
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,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component test for SearchInput (Sweep S11, #1416).
|
|
3
|
-
*
|
|
4
|
-
* Follows the golden pattern (src/components/ui/__tests__/Button.test.ts).
|
|
5
|
-
* A `type="search"` input surfaces as a `searchbox` role. The component is
|
|
6
|
-
* Provider-free (its i18n falls back to registered defaults outside a Provider).
|
|
7
|
-
*/
|
|
8
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
9
|
-
import { render, screen } from '@testing-library/svelte';
|
|
10
|
-
import userEvent from '@testing-library/user-event';
|
|
11
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
12
|
-
import SearchInput from '../SearchInput.svelte';
|
|
13
|
-
describe('SearchInput', () => {
|
|
14
|
-
it('renders a searchbox with its default accessible name', () => {
|
|
15
|
-
render(SearchInput);
|
|
16
|
-
expect(screen.getByRole('searchbox', { name: 'Search' })).toBeInTheDocument();
|
|
17
|
-
});
|
|
18
|
-
it('uses ariaLabel as the accessible name and shows the placeholder', () => {
|
|
19
|
-
render(SearchInput, {
|
|
20
|
-
props: { ariaLabel: 'Find articles', placeholder: 'Type to search…' },
|
|
21
|
-
});
|
|
22
|
-
const box = screen.getByRole('searchbox', { name: 'Find articles' });
|
|
23
|
-
expect(box).toHaveAttribute('placeholder', 'Type to search…');
|
|
24
|
-
});
|
|
25
|
-
it('reflects the value and disabled props', () => {
|
|
26
|
-
render(SearchInput, {
|
|
27
|
-
props: { ariaLabel: 'Search', value: 'hello', disabled: true },
|
|
28
|
-
});
|
|
29
|
-
const box = screen.getByRole('searchbox', { name: 'Search' });
|
|
30
|
-
expect(box).toHaveValue('hello');
|
|
31
|
-
expect(box).toBeDisabled();
|
|
32
|
-
});
|
|
33
|
-
it('fires oninput immediately while typing (no debounce)', async () => {
|
|
34
|
-
const oninput = vi.fn();
|
|
35
|
-
render(SearchInput, {
|
|
36
|
-
props: { ariaLabel: 'Search', debounce: 0, oninput },
|
|
37
|
-
});
|
|
38
|
-
await userEvent.type(screen.getByRole('searchbox', { name: 'Search' }), 'ab');
|
|
39
|
-
expect(oninput).toHaveBeenCalledTimes(2);
|
|
40
|
-
expect(oninput).toHaveBeenLastCalledWith('ab');
|
|
41
|
-
});
|
|
42
|
-
it('fires onsearch on Enter and onsubmit with the current value', async () => {
|
|
43
|
-
const onsearch = vi.fn();
|
|
44
|
-
const onsubmit = vi.fn();
|
|
45
|
-
render(SearchInput, {
|
|
46
|
-
props: { ariaLabel: 'Search', debounce: 0, onsearch, onsubmit },
|
|
47
|
-
});
|
|
48
|
-
const box = screen.getByRole('searchbox', { name: 'Search' });
|
|
49
|
-
await userEvent.type(box, 'query{Enter}');
|
|
50
|
-
expect(onsubmit).toHaveBeenCalledWith('query');
|
|
51
|
-
expect(onsearch).toHaveBeenLastCalledWith('query');
|
|
52
|
-
});
|
|
53
|
-
it('shows a clear button once there is a value and clears on click', async () => {
|
|
54
|
-
const oninput = vi.fn();
|
|
55
|
-
render(SearchInput, {
|
|
56
|
-
props: { ariaLabel: 'Search', debounce: 0, value: 'something', oninput },
|
|
57
|
-
});
|
|
58
|
-
const clear = screen.getByRole('button', { name: 'Clear search' });
|
|
59
|
-
await userEvent.click(clear);
|
|
60
|
-
expect(screen.getByRole('searchbox', { name: 'Search' })).toHaveValue('');
|
|
61
|
-
expect(oninput).toHaveBeenLastCalledWith('');
|
|
62
|
-
});
|
|
63
|
-
it('does not render a clear button when empty', () => {
|
|
64
|
-
render(SearchInput, { props: { ariaLabel: 'Search' } });
|
|
65
|
-
expect(screen.queryByRole('button', { name: 'Clear search' })).not.toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
it('is axe-clean in the default state', async () => {
|
|
68
|
-
const { container } = render(SearchInput, {
|
|
69
|
-
props: { ariaLabel: 'Search the catalog' },
|
|
70
|
-
});
|
|
71
|
-
await expectNoA11yViolations(container);
|
|
72
|
-
});
|
|
73
|
-
it('is axe-clean with a value (clear button visible)', async () => {
|
|
74
|
-
const { container } = render(SearchInput, {
|
|
75
|
-
props: { ariaLabel: 'Search the catalog', value: 'shoes' },
|
|
76
|
-
});
|
|
77
|
-
await expectNoA11yViolations(container);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep behavior tests for SelectInput (Sweep S11, #1416).
|
|
3
|
-
*
|
|
4
|
-
* The existing a11y suite only asserts labelling + describedby + axe. This
|
|
5
|
-
* suite drives the real selection pipeline: choosing an option → handleChange →
|
|
6
|
-
* updateValue → onchange + bindable value; the placeholder option (disabled +
|
|
7
|
-
* selected when empty); option rendering from the options prop; and the
|
|
8
|
-
* required/disabled wiring.
|
|
9
|
-
*
|
|
10
|
-
* SelectInput calls useAppState (it throws outside a <Provider>), so it is
|
|
11
|
-
* mocked to a non-listening stub — the reference pattern from
|
|
12
|
-
* rich-inputs-a11y.test.ts. (SelectInput does not use useSTT.)
|
|
13
|
-
*/
|
|
14
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
15
|
-
import { render, screen } from '@testing-library/svelte';
|
|
16
|
-
import userEvent from '@testing-library/user-event';
|
|
17
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
18
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
19
|
-
useAppState: () => ({ state: { mode: 'default' }, setMode: vi.fn() }),
|
|
20
|
-
}));
|
|
21
|
-
import SelectInput from '../SelectInput.svelte';
|
|
22
|
-
const COUNTRIES = [
|
|
23
|
-
{ value: 'us', label: 'United States' },
|
|
24
|
-
{ value: 'ca', label: 'Canada' },
|
|
25
|
-
{ value: 'mx', label: 'Mexico' },
|
|
26
|
-
];
|
|
27
|
-
describe('SelectInput — selection', () => {
|
|
28
|
-
it('fires onchange with the chosen option value', async () => {
|
|
29
|
-
const onchange = vi.fn();
|
|
30
|
-
render(SelectInput, {
|
|
31
|
-
props: {
|
|
32
|
-
name: 'country',
|
|
33
|
-
label: 'Country',
|
|
34
|
-
options: COUNTRIES,
|
|
35
|
-
onchange,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
await userEvent.selectOptions(screen.getByLabelText('Country'), 'ca');
|
|
39
|
-
expect(onchange).toHaveBeenCalledWith('ca');
|
|
40
|
-
});
|
|
41
|
-
it('reflects the selected value on the <select>', async () => {
|
|
42
|
-
render(SelectInput, {
|
|
43
|
-
props: { name: 'country', label: 'Country', options: COUNTRIES },
|
|
44
|
-
});
|
|
45
|
-
const select = screen.getByLabelText('Country');
|
|
46
|
-
await userEvent.selectOptions(select, 'mx');
|
|
47
|
-
expect(select).toHaveValue('mx');
|
|
48
|
-
});
|
|
49
|
-
it('renders the initial value prop as the selected option', () => {
|
|
50
|
-
render(SelectInput, {
|
|
51
|
-
props: {
|
|
52
|
-
name: 'country',
|
|
53
|
-
label: 'Country',
|
|
54
|
-
options: COUNTRIES,
|
|
55
|
-
value: 'us',
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
expect(screen.getByLabelText('Country')).toHaveValue('us');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('SelectInput — options & placeholder', () => {
|
|
62
|
-
it('renders one <option> per provided option plus the placeholder', () => {
|
|
63
|
-
render(SelectInput, {
|
|
64
|
-
props: {
|
|
65
|
-
name: 'country',
|
|
66
|
-
label: 'Country',
|
|
67
|
-
options: COUNTRIES,
|
|
68
|
-
placeholder: 'Choose a country…',
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
// 3 countries + 1 placeholder option.
|
|
72
|
-
expect(screen.getAllByRole('option')).toHaveLength(4);
|
|
73
|
-
expect(screen.getByRole('option', { name: 'United States' })).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
it('renders the placeholder as a disabled option, selected when value is empty', () => {
|
|
76
|
-
render(SelectInput, {
|
|
77
|
-
props: {
|
|
78
|
-
name: 'country',
|
|
79
|
-
label: 'Country',
|
|
80
|
-
options: COUNTRIES,
|
|
81
|
-
placeholder: 'Choose a country…',
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
const placeholder = screen.getByRole('option', {
|
|
85
|
-
name: 'Choose a country…',
|
|
86
|
-
});
|
|
87
|
-
expect(placeholder).toBeDisabled();
|
|
88
|
-
expect(placeholder.value).toBe('');
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe('SelectInput — states & attributes', () => {
|
|
92
|
-
it('reflects required onto the select', () => {
|
|
93
|
-
// NOTE: with required, the "*" lives inside the <label>, so the select's
|
|
94
|
-
// accessible name becomes "Country *" — query by id rather than label.
|
|
95
|
-
const { container } = render(SelectInput, {
|
|
96
|
-
props: {
|
|
97
|
-
name: 'country',
|
|
98
|
-
label: 'Country',
|
|
99
|
-
options: COUNTRIES,
|
|
100
|
-
required: true,
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
expect(container.querySelector('#country')).toBeRequired();
|
|
104
|
-
});
|
|
105
|
-
it('disables the select and ignores selection when disabled', async () => {
|
|
106
|
-
const onchange = vi.fn();
|
|
107
|
-
render(SelectInput, {
|
|
108
|
-
props: {
|
|
109
|
-
name: 'country',
|
|
110
|
-
label: 'Country',
|
|
111
|
-
options: COUNTRIES,
|
|
112
|
-
disabled: true,
|
|
113
|
-
onchange,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
const select = screen.getByLabelText('Country');
|
|
117
|
-
expect(select).toBeDisabled();
|
|
118
|
-
await userEvent.selectOptions(select, 'ca').catch(() => { });
|
|
119
|
-
expect(onchange).not.toHaveBeenCalled();
|
|
120
|
-
});
|
|
121
|
-
it('is axe-clean when labelled with a placeholder', async () => {
|
|
122
|
-
const { container } = render(SelectInput, {
|
|
123
|
-
props: {
|
|
124
|
-
name: 'country',
|
|
125
|
-
label: 'Country',
|
|
126
|
-
placeholder: 'Choose…',
|
|
127
|
-
options: COUNTRIES,
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
await expectNoA11yViolations(container);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep behavior tests for TextInput (Sweep S11, #1416).
|
|
3
|
-
*
|
|
4
|
-
* The existing a11y suite only asserts labelling + describedby + axe. This
|
|
5
|
-
* suite exercises the real value pipeline: typing → handleInput → updateValue →
|
|
6
|
-
* onchange + bindable value, the email-validation derived state (aria-invalid,
|
|
7
|
-
* the invalid-email supporting message), disabled/required wiring, and the
|
|
8
|
-
* placeholder-on-focus behavior.
|
|
9
|
-
*
|
|
10
|
-
* TextInput calls useAppState/useSTT (they throw outside a <Provider>), so both
|
|
11
|
-
* are mocked to non-listening stubs — the reference pattern from
|
|
12
|
-
* rich-inputs-a11y.test.ts.
|
|
13
|
-
*/
|
|
14
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
15
|
-
import { render, screen } from '@testing-library/svelte';
|
|
16
|
-
import userEvent from '@testing-library/user-event';
|
|
17
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
18
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
19
|
-
useAppState: () => ({ state: { mode: 'default' }, setMode: vi.fn() }),
|
|
20
|
-
}));
|
|
21
|
-
vi.mock('../../../hooks/useSTT.svelte.js', () => ({
|
|
22
|
-
useSTT: () => ({
|
|
23
|
-
isListening: false,
|
|
24
|
-
isInitializing: false,
|
|
25
|
-
isReady: false,
|
|
26
|
-
adapterType: null,
|
|
27
|
-
downloadProgress: 0,
|
|
28
|
-
lastResult: '',
|
|
29
|
-
initialize: vi.fn(),
|
|
30
|
-
start: vi.fn(),
|
|
31
|
-
stop: vi.fn(),
|
|
32
|
-
}),
|
|
33
|
-
}));
|
|
34
|
-
import TextInput from '../TextInput.svelte';
|
|
35
|
-
describe('TextInput — typing & value', () => {
|
|
36
|
-
it('fires onchange with the current value on each keystroke', async () => {
|
|
37
|
-
const onchange = vi.fn();
|
|
38
|
-
render(TextInput, {
|
|
39
|
-
props: { name: 'fullname', label: 'Full name', onchange },
|
|
40
|
-
});
|
|
41
|
-
await userEvent.type(screen.getByLabelText('Full name'), 'Ada');
|
|
42
|
-
expect(onchange).toHaveBeenLastCalledWith('Ada');
|
|
43
|
-
});
|
|
44
|
-
it('renders the initial value prop into the input', () => {
|
|
45
|
-
render(TextInput, {
|
|
46
|
-
props: { name: 'fullname', label: 'Full name', value: 'Seed' },
|
|
47
|
-
});
|
|
48
|
-
expect(screen.getByLabelText('Full name')).toHaveValue('Seed');
|
|
49
|
-
});
|
|
50
|
-
it('updates the input value as the user types', async () => {
|
|
51
|
-
render(TextInput, { props: { name: 'fullname', label: 'Full name' } });
|
|
52
|
-
const input = screen.getByLabelText('Full name');
|
|
53
|
-
await userEvent.type(input, 'Lovelace');
|
|
54
|
-
expect(input).toHaveValue('Lovelace');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('TextInput — email validation', () => {
|
|
58
|
-
it('marks aria-invalid when an email value is malformed', () => {
|
|
59
|
-
render(TextInput, {
|
|
60
|
-
props: {
|
|
61
|
-
name: 'email',
|
|
62
|
-
label: 'Email',
|
|
63
|
-
type: 'email',
|
|
64
|
-
value: 'not-an-email',
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
expect(screen.getByLabelText('Email')).toHaveAttribute('aria-invalid', 'true');
|
|
68
|
-
});
|
|
69
|
-
it('shows the invalid-email supporting message for a bad address', () => {
|
|
70
|
-
render(TextInput, {
|
|
71
|
-
props: { name: 'email', label: 'Email', type: 'email', value: 'nope' },
|
|
72
|
-
});
|
|
73
|
-
expect(screen.getByText('Invalid email address')).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
it('is valid (no aria-invalid) for a well-formed email', () => {
|
|
76
|
-
render(TextInput, {
|
|
77
|
-
props: {
|
|
78
|
-
name: 'email',
|
|
79
|
-
label: 'Email',
|
|
80
|
-
type: 'email',
|
|
81
|
-
value: 'ada@example.com',
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
expect(screen.getByLabelText('Email')).not.toHaveAttribute('aria-invalid', 'true');
|
|
85
|
-
});
|
|
86
|
-
it('treats an empty email as valid (no error until the user types)', () => {
|
|
87
|
-
render(TextInput, {
|
|
88
|
-
props: { name: 'email', label: 'Email', type: 'email' },
|
|
89
|
-
});
|
|
90
|
-
expect(screen.getByLabelText('Email')).not.toHaveAttribute('aria-invalid', 'true');
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('TextInput — states & attributes', () => {
|
|
94
|
-
it('reflects required onto the input', () => {
|
|
95
|
-
// NOTE: with required, the "*" lives inside the <label>, so the input's
|
|
96
|
-
// accessible name becomes "Full name *" — query by id rather than label.
|
|
97
|
-
const { container } = render(TextInput, {
|
|
98
|
-
props: { name: 'fullname', label: 'Full name', required: true },
|
|
99
|
-
});
|
|
100
|
-
expect(container.querySelector('#fullname')).toBeRequired();
|
|
101
|
-
});
|
|
102
|
-
it('disables the input and ignores typing when disabled', async () => {
|
|
103
|
-
const onchange = vi.fn();
|
|
104
|
-
render(TextInput, {
|
|
105
|
-
props: { name: 'fullname', label: 'Full name', disabled: true, onchange },
|
|
106
|
-
});
|
|
107
|
-
const input = screen.getByLabelText('Full name');
|
|
108
|
-
expect(input).toBeDisabled();
|
|
109
|
-
await userEvent.type(input, 'ignored');
|
|
110
|
-
expect(onchange).not.toHaveBeenCalled();
|
|
111
|
-
});
|
|
112
|
-
it('reveals the placeholder only while focused', async () => {
|
|
113
|
-
render(TextInput, {
|
|
114
|
-
props: {
|
|
115
|
-
name: 'fullname',
|
|
116
|
-
label: 'Full name',
|
|
117
|
-
placeholder: 'Enter name',
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
const input = screen.getByLabelText('Full name');
|
|
121
|
-
expect(input).toHaveAttribute('placeholder', '');
|
|
122
|
-
await userEvent.click(input);
|
|
123
|
-
expect(input).toHaveAttribute('placeholder', 'Enter name');
|
|
124
|
-
});
|
|
125
|
-
it('is axe-clean when labelled', async () => {
|
|
126
|
-
const { container } = render(TextInput, {
|
|
127
|
-
props: { name: 'fullname', label: 'Full name' },
|
|
128
|
-
});
|
|
129
|
-
await expectNoA11yViolations(container);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep behavior tests for TextareaInput (Sweep S11, #1416).
|
|
3
|
-
*
|
|
4
|
-
* The existing a11y suite only asserts labelling + describedby + axe. This
|
|
5
|
-
* suite drives the real value pipeline: typing → handleInput → updateValue →
|
|
6
|
-
* onchange + bindable value, plus the rows/required/disabled wiring and the
|
|
7
|
-
* focus-gated placeholder.
|
|
8
|
-
*
|
|
9
|
-
* TextareaInput calls useAppState/useSTT (they throw outside a <Provider>), so
|
|
10
|
-
* both are mocked to non-listening stubs — the reference pattern from
|
|
11
|
-
* rich-inputs-a11y.test.ts.
|
|
12
|
-
*/
|
|
13
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
14
|
-
import { render, screen } from '@testing-library/svelte';
|
|
15
|
-
import userEvent from '@testing-library/user-event';
|
|
16
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
17
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
18
|
-
useAppState: () => ({ state: { mode: 'default' }, setMode: vi.fn() }),
|
|
19
|
-
}));
|
|
20
|
-
vi.mock('../../../hooks/useSTT.svelte.js', () => ({
|
|
21
|
-
useSTT: () => ({
|
|
22
|
-
isListening: false,
|
|
23
|
-
isInitializing: false,
|
|
24
|
-
isReady: false,
|
|
25
|
-
adapterType: null,
|
|
26
|
-
downloadProgress: 0,
|
|
27
|
-
lastResult: '',
|
|
28
|
-
initialize: vi.fn(),
|
|
29
|
-
start: vi.fn(),
|
|
30
|
-
stop: vi.fn(),
|
|
31
|
-
}),
|
|
32
|
-
}));
|
|
33
|
-
import TextareaInput from '../TextareaInput.svelte';
|
|
34
|
-
describe('TextareaInput — typing & value', () => {
|
|
35
|
-
it('fires onchange with the current value as the user types', async () => {
|
|
36
|
-
const onchange = vi.fn();
|
|
37
|
-
render(TextareaInput, { props: { name: 'bio', label: 'Bio', onchange } });
|
|
38
|
-
await userEvent.type(screen.getByLabelText('Bio'), 'Hello');
|
|
39
|
-
expect(onchange).toHaveBeenLastCalledWith('Hello');
|
|
40
|
-
});
|
|
41
|
-
it('renders the initial value prop', () => {
|
|
42
|
-
render(TextareaInput, {
|
|
43
|
-
props: { name: 'bio', label: 'Bio', value: 'Seeded text' },
|
|
44
|
-
});
|
|
45
|
-
expect(screen.getByLabelText('Bio')).toHaveValue('Seeded text');
|
|
46
|
-
});
|
|
47
|
-
it('captures multi-line input', async () => {
|
|
48
|
-
render(TextareaInput, { props: { name: 'bio', label: 'Bio' } });
|
|
49
|
-
const textarea = screen.getByLabelText('Bio');
|
|
50
|
-
await userEvent.type(textarea, 'line one{enter}line two');
|
|
51
|
-
expect(textarea).toHaveValue('line one\nline two');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('TextareaInput — states & attributes', () => {
|
|
55
|
-
it('forwards the rows prop onto the textarea', () => {
|
|
56
|
-
render(TextareaInput, { props: { name: 'bio', label: 'Bio', rows: 8 } });
|
|
57
|
-
expect(screen.getByLabelText('Bio')).toHaveAttribute('rows', '8');
|
|
58
|
-
});
|
|
59
|
-
it('defaults to 4 rows when not specified', () => {
|
|
60
|
-
render(TextareaInput, { props: { name: 'bio', label: 'Bio' } });
|
|
61
|
-
expect(screen.getByLabelText('Bio')).toHaveAttribute('rows', '4');
|
|
62
|
-
});
|
|
63
|
-
it('reflects required onto the textarea', () => {
|
|
64
|
-
// NOTE: with required, the "*" lives inside the <label>, so the textarea's
|
|
65
|
-
// accessible name becomes "Bio *" — query by id rather than label.
|
|
66
|
-
const { container } = render(TextareaInput, {
|
|
67
|
-
props: { name: 'bio', label: 'Bio', required: true },
|
|
68
|
-
});
|
|
69
|
-
expect(container.querySelector('#bio')).toBeRequired();
|
|
70
|
-
});
|
|
71
|
-
it('disables the textarea and ignores typing when disabled', async () => {
|
|
72
|
-
const onchange = vi.fn();
|
|
73
|
-
render(TextareaInput, {
|
|
74
|
-
props: { name: 'bio', label: 'Bio', disabled: true, onchange },
|
|
75
|
-
});
|
|
76
|
-
const textarea = screen.getByLabelText('Bio');
|
|
77
|
-
expect(textarea).toBeDisabled();
|
|
78
|
-
await userEvent.type(textarea, 'ignored');
|
|
79
|
-
expect(onchange).not.toHaveBeenCalled();
|
|
80
|
-
});
|
|
81
|
-
it('reveals the placeholder only while focused', async () => {
|
|
82
|
-
render(TextareaInput, {
|
|
83
|
-
props: { name: 'bio', label: 'Bio', placeholder: 'Tell us about you' },
|
|
84
|
-
});
|
|
85
|
-
const textarea = screen.getByLabelText('Bio');
|
|
86
|
-
expect(textarea).toHaveAttribute('placeholder', '');
|
|
87
|
-
await userEvent.click(textarea);
|
|
88
|
-
expect(textarea).toHaveAttribute('placeholder', 'Tell us about you');
|
|
89
|
-
});
|
|
90
|
-
it('is axe-clean when labelled', async () => {
|
|
91
|
-
const { container } = render(TextareaInput, {
|
|
92
|
-
props: { name: 'bio', label: 'Bio' },
|
|
93
|
-
});
|
|
94
|
-
await expectNoA11yViolations(container);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte';
|
|
3
|
-
import {
|
|
4
|
-
type FieldDefinition,
|
|
5
|
-
tryGetFormContext,
|
|
6
|
-
} from '../../../state/form-context.js';
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
validate,
|
|
10
|
-
}: {
|
|
11
|
-
validate: () => boolean | Promise<boolean>;
|
|
12
|
-
} = $props();
|
|
13
|
-
|
|
14
|
-
const formContext = tryGetFormContext();
|
|
15
|
-
const label = 'Async invalid field';
|
|
16
|
-
|
|
17
|
-
onMount(() => {
|
|
18
|
-
const field: FieldDefinition = {
|
|
19
|
-
name: 'async-invalid',
|
|
20
|
-
type: 'text',
|
|
21
|
-
label,
|
|
22
|
-
getValue: () => 'proposal',
|
|
23
|
-
setValue: () => {},
|
|
24
|
-
validate,
|
|
25
|
-
};
|
|
26
|
-
return formContext?.registerField(field);
|
|
27
|
-
});
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<input aria-label={label} value="proposal" />
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
validate: () => boolean | Promise<boolean>;
|
|
3
|
-
};
|
|
4
|
-
declare const AsyncInvalidField: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
-
type AsyncInvalidField = ReturnType<typeof AsyncInvalidField>;
|
|
6
|
-
export default AsyncInvalidField;
|
|
7
|
-
//# sourceMappingURL=async-invalid-field.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-invalid-field.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/async-invalid-field.fixture.svelte.ts"],"names":[],"mappings":"AASC,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C,CAAC;AA6BF,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Form from '../Form.svelte';
|
|
3
|
-
import AsyncInvalidField from './async-invalid-field.fixture.svelte';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
onsubmit,
|
|
7
|
-
validate,
|
|
8
|
-
webmcp = true,
|
|
9
|
-
}: {
|
|
10
|
-
onsubmit: (data: Record<string, unknown>) => void | Promise<void>;
|
|
11
|
-
validate: () => boolean | Promise<boolean>;
|
|
12
|
-
webmcp?: boolean;
|
|
13
|
-
} = $props();
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<Form {onsubmit} {webmcp}>
|
|
17
|
-
<AsyncInvalidField {validate} />
|
|
18
|
-
<button type="submit">Submit</button>
|
|
19
|
-
</Form>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
onsubmit: (data: Record<string, unknown>) => void | Promise<void>;
|
|
3
|
-
validate: () => boolean | Promise<boolean>;
|
|
4
|
-
webmcp?: boolean;
|
|
5
|
-
};
|
|
6
|
-
declare const AsyncValidationForm: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type AsyncValidationForm = ReturnType<typeof AsyncValidationForm>;
|
|
8
|
-
export default AsyncValidationForm;
|
|
9
|
-
//# sourceMappingURL=async-validation-form.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-validation-form.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/async-validation-form.fixture.svelte.ts"],"names":[],"mappings":"AAMC,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,QAAQ,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAmBF,QAAA,MAAM,mBAAmB,sDAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Form from '../Form.svelte';
|
|
3
|
-
import TextInput from '../TextInput.svelte';
|
|
4
|
-
import AsyncInvalidField from './async-invalid-field.fixture.svelte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
onsubmit,
|
|
8
|
-
validate,
|
|
9
|
-
}: {
|
|
10
|
-
onsubmit: (data: Record<string, unknown>) => void | Promise<void>;
|
|
11
|
-
validate: () => boolean | Promise<boolean>;
|
|
12
|
-
} = $props();
|
|
13
|
-
|
|
14
|
-
let laterValue = $state('before');
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Form {onsubmit} webmcp>
|
|
18
|
-
<AsyncInvalidField {validate} />
|
|
19
|
-
<TextInput name="later" label="Later value" bind:value={laterValue} />
|
|
20
|
-
<button type="submit">Submit</button>
|
|
21
|
-
</Form>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
onsubmit: (data: Record<string, unknown>) => void | Promise<void>;
|
|
3
|
-
validate: () => boolean | Promise<boolean>;
|
|
4
|
-
};
|
|
5
|
-
declare const AsyncValidationSnapshotForm: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type AsyncValidationSnapshotForm = ReturnType<typeof AsyncValidationSnapshotForm>;
|
|
7
|
-
export default AsyncValidationSnapshotForm;
|
|
8
|
-
//# sourceMappingURL=async-validation-snapshot-form.fixture.svelte.d.ts.map
|
package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-validation-snapshot-form.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.ts"],"names":[],"mappings":"AAOC,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,QAAQ,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C,CAAC;AAsBF,QAAA,MAAM,2BAA2B,sDAAwC,CAAC;AAC1E,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,eAAe,2BAA2B,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accessibility golden tests for the multi-field composite form inputs
|
|
3
|
-
* (Sweep L1, #1420). Each sub-field is programmatically labelled and the
|
|
4
|
-
* shared/validation error is associated via aria-describedby + role="alert".
|
|
5
|
-
* Hooks are mocked (Provider-backed, throw otherwise).
|
|
6
|
-
*/
|
|
7
|
-
import { expectNoA11yViolations } from '@happyvertical/smrt-ui/test-support/a11y';
|
|
8
|
-
import { render, screen } from '@testing-library/svelte';
|
|
9
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
10
|
-
vi.mock('../../../hooks/useAppState.svelte.js', () => ({
|
|
11
|
-
useAppState: () => ({ state: { mode: 'default' }, setMode: vi.fn() }),
|
|
12
|
-
}));
|
|
13
|
-
vi.mock('../../../hooks/useSTT.svelte.js', () => ({
|
|
14
|
-
useSTT: () => ({
|
|
15
|
-
isListening: false,
|
|
16
|
-
isInitializing: false,
|
|
17
|
-
isReady: false,
|
|
18
|
-
adapterType: null,
|
|
19
|
-
downloadProgress: 0,
|
|
20
|
-
lastResult: '',
|
|
21
|
-
initialize: vi.fn(),
|
|
22
|
-
start: vi.fn(),
|
|
23
|
-
stop: vi.fn(),
|
|
24
|
-
}),
|
|
25
|
-
}));
|
|
26
|
-
import AddressInput from '../AddressInput.svelte';
|
|
27
|
-
import DateRangeInput from '../DateRangeInput.svelte';
|
|
28
|
-
import DateTimeInput from '../DateTimeInput.svelte';
|
|
29
|
-
import MeasurementInput from '../MeasurementInput.svelte';
|
|
30
|
-
import MoneyInput from '../MoneyInput.svelte';
|
|
31
|
-
describe('composite form inputs — accessibility', () => {
|
|
32
|
-
it('MoneyInput: labelled amount + axe-clean', async () => {
|
|
33
|
-
const { container } = render(MoneyInput, {
|
|
34
|
-
props: { name: 'price', label: 'Price' },
|
|
35
|
-
});
|
|
36
|
-
expect(screen.getByLabelText('Price')).toBeInTheDocument();
|
|
37
|
-
await expectNoA11yViolations(container);
|
|
38
|
-
});
|
|
39
|
-
it('MeasurementInput: labelled value + labelled unit select + axe-clean', async () => {
|
|
40
|
-
const { container } = render(MeasurementInput, {
|
|
41
|
-
props: { name: 'weight', label: 'Weight' },
|
|
42
|
-
});
|
|
43
|
-
expect(screen.getByLabelText('Weight')).toBeInTheDocument();
|
|
44
|
-
expect(screen.getByLabelText('Weight unit')).toBeInTheDocument();
|
|
45
|
-
await expectNoA11yViolations(container);
|
|
46
|
-
});
|
|
47
|
-
it('DateRangeInput: labelled start/end + axe-clean', async () => {
|
|
48
|
-
const { container } = render(DateRangeInput, {
|
|
49
|
-
props: { name: 'range', label: 'Dates' },
|
|
50
|
-
});
|
|
51
|
-
expect(screen.getByLabelText('Start')).toBeInTheDocument();
|
|
52
|
-
expect(screen.getByLabelText('End')).toBeInTheDocument();
|
|
53
|
-
await expectNoA11yViolations(container);
|
|
54
|
-
});
|
|
55
|
-
it('AddressInput: all fields labelled + axe-clean', async () => {
|
|
56
|
-
const { container } = render(AddressInput, {
|
|
57
|
-
props: { name: 'addr', label: 'Address' },
|
|
58
|
-
});
|
|
59
|
-
expect(screen.getAllByRole('textbox').length).toBeGreaterThan(0);
|
|
60
|
-
await expectNoA11yViolations(container);
|
|
61
|
-
});
|
|
62
|
-
it('DateTimeInput: labelled + axe-clean', async () => {
|
|
63
|
-
const { container } = render(DateTimeInput, {
|
|
64
|
-
props: { name: 'when', label: 'When' },
|
|
65
|
-
});
|
|
66
|
-
expect(screen.getByLabelText('When')).toBeInTheDocument();
|
|
67
|
-
await expectNoA11yViolations(container);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getFormContext } from '../../../state/form-context.js';
|
|
3
|
-
import CustomRegistrationField from './custom-registration-field.fixture.svelte';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
showFirst,
|
|
7
|
-
showReplacement,
|
|
8
|
-
legacyCleanup,
|
|
9
|
-
}: {
|
|
10
|
-
showFirst: boolean;
|
|
11
|
-
showReplacement: boolean;
|
|
12
|
-
legacyCleanup: boolean;
|
|
13
|
-
} = $props();
|
|
14
|
-
|
|
15
|
-
// Compound fields often read the context for their own coordination before
|
|
16
|
-
// mounting nested custom fields. Their descendants must still own cleanup.
|
|
17
|
-
const formId = getFormContext().formId;
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<div data-compound-form={formId}>
|
|
21
|
-
{#if showFirst}
|
|
22
|
-
<CustomRegistrationField name="custom-shared" label="Custom first" {legacyCleanup} />
|
|
23
|
-
{/if}
|
|
24
|
-
{#if showReplacement}
|
|
25
|
-
<CustomRegistrationField name="custom-shared" label="Custom replacement" {legacyCleanup} />
|
|
26
|
-
{/if}
|
|
27
|
-
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
showFirst: boolean;
|
|
3
|
-
showReplacement: boolean;
|
|
4
|
-
legacyCleanup: boolean;
|
|
5
|
-
};
|
|
6
|
-
declare const CompoundRegistrationWrapper: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type CompoundRegistrationWrapper = ReturnType<typeof CompoundRegistrationWrapper>;
|
|
8
|
-
export default CompoundRegistrationWrapper;
|
|
9
|
-
//# sourceMappingURL=compound-registration-wrapper.fixture.svelte.d.ts.map
|
package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compound-registration-wrapper.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.ts"],"names":[],"mappings":"AAMC,KAAK,gBAAgB,GAAI;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AA2BF,QAAA,MAAM,2BAA2B,sDAAwC,CAAC;AAC1E,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,eAAe,2BAA2B,CAAC"}
|