diff --git a/code/addons/interactions/template/stories/basics.stories.ts b/code/addons/interactions/template/stories/basics.stories.ts index 774ee5b07d8a..ece3bc5daa11 100644 --- a/code/addons/interactions/template/stories/basics.stories.ts +++ b/code/addons/interactions/template/stories/basics.stories.ts @@ -47,7 +47,7 @@ export const Callback = { await fireEvent.click(canvas.getByRole('button')); }); - await expect(args.onSuccess).toHaveBeenCalled(); + await expect(args.onSuccess).toHaveBeenCalledWith('test'); }, }; @@ -113,7 +113,7 @@ export const UserEventSetup = { await user.keyboard('{enter}'); const submitButton = await canvas.findByRole('button'); await expect(submitButton).toHaveFocus(); - await expect(args.onSuccess).toHaveBeenCalled(); + await expect(args.onSuccess).toHaveBeenCalledWith('Pasting: foobar'); }); }, }; diff --git a/code/frameworks/angular/template/components/form.component.ts b/code/frameworks/angular/template/components/form.component.ts index 2bc4c00298e8..b3415c745430 100644 --- a/code/frameworks/angular/template/components/form.component.ts +++ b/code/frameworks/angular/template/components/form.component.ts @@ -6,7 +6,7 @@ import { Component, Output, EventEmitter } from '@angular/core';
`; - container.innerHTML = getInnerHTML({ complete: false }); + container.innerHTML = getInnerHTML({ complete: false, value: '' }); const form = container.querySelector('form'); form.addEventListener('submit', (e) => { e.preventDefault(); + const { value } = form.querySelector('input'); // Store the current value + setTimeout(() => { - container.innerHTML = getInnerHTML({ complete: true }); + container.innerHTML = getInnerHTML({ complete: true, value }); }, 500); setTimeout(() => { - container.innerHTML = getInnerHTML({ complete: false }); + container.innerHTML = getInnerHTML({ complete: false, value }); }, 1500); - onSuccess(e); + onSuccess(value); }); return container; diff --git a/code/renderers/preact/template/components/Form.jsx b/code/renderers/preact/template/components/Form.jsx index f12e905f0dba..fb58cbb10508 100644 --- a/code/renderers/preact/template/components/Form.jsx +++ b/code/renderers/preact/template/components/Form.jsx @@ -24,7 +24,7 @@ export const Form = ({ onSuccess }) => { data-testid="value" value={value} required - onChange={(event) => setValue(event.target.value)} + onInput={(event) => setValue(event.target.value)} /> diff --git a/code/renderers/svelte/template/components/Form.svelte b/code/renderers/svelte/template/components/Form.svelte index 467c31d4974b..3b2f7a5b9d97 100644 --- a/code/renderers/svelte/template/components/Form.svelte +++ b/code/renderers/svelte/template/components/Form.svelte @@ -26,8 +26,8 @@ + \ No newline at end of file diff --git a/code/renderers/vue/template/components/Form.vue b/code/renderers/vue/template/components/Form.vue index fc46f159e337..2375a381eb7a 100644 --- a/code/renderers/vue/template/components/Form.vue +++ b/code/renderers/vue/template/components/Form.vue @@ -2,7 +2,13 @@