@@ -10,9 +10,10 @@ import {expect, fn, userEvent, waitFor, within} from 'storybook/test';
1010
1111import FormioComponent from '@/components/FormioComponent' ;
1212import type { FormioFormProps } from '@/components/FormioForm' ;
13+ import type { FormSettings } from '@/context' ;
1314import { getRegistryEntry } from '@/registry' ;
1415import { renderComponentInForm } from '@/registry/storybook-helpers' ;
15- import { withFormik } from '@/sb-decorators' ;
16+ import { withFormSettingsProvider , withFormik } from '@/sb-decorators' ;
1617import type { JSONObject } from '@/types' ;
1718
1819import { FormioEditGrid } from './' ;
@@ -819,3 +820,60 @@ export const MutationsTriggerRevalidation: ValidationStory = {
819820 } ) ;
820821 } ,
821822} ;
823+
824+ export const WithAdressNL : Story = {
825+ decorators : [ withFormSettingsProvider , withFormik ] ,
826+ args : {
827+ componentDefinition : {
828+ id : 'component1' ,
829+ type : 'editgrid' ,
830+ key : 'editgrid' ,
831+ label : 'Various combinations of value display' ,
832+ disableAddingRemovingRows : false ,
833+ groupLabel : 'Nested item' ,
834+ components : [
835+ {
836+ id : 'addressNL' ,
837+ type : 'addressNL' ,
838+ key : 'addressNL' ,
839+ label : 'AddressNL' ,
840+ layout : 'singleColumn' ,
841+ deriveAddress : true ,
842+ } ,
843+ ] ,
844+ } ,
845+ } ,
846+ parameters : {
847+ formik : {
848+ initialValues : {
849+ editgrid : [
850+ {
851+ addressNL : {
852+ postcode : '1043GR' ,
853+ houseNumber : '151' ,
854+ houseLetter : 'A' ,
855+ houseNumberAddition : '9' ,
856+ streetName : 'Kingsfordweg' ,
857+ city : 'Amsterdam' ,
858+ } satisfies AddressData ,
859+ } ,
860+ ] ,
861+ } ,
862+ } ,
863+ formSettings : {
864+ componentParameters : {
865+ addressNL : {
866+ addressAutoComplete : async ( ) => ( {
867+ streetName : 'Autofilled street' ,
868+ city : 'Autofilled' ,
869+ secretStreetCity : 'some-hashed-security-thing' ,
870+ } ) ,
871+ } ,
872+ } satisfies FormSettings [ 'componentParameters' ] ,
873+ } ,
874+ } ,
875+ play : async ( { canvasElement} ) => {
876+ const canvas = within ( canvasElement ) ;
877+ await userEvent . click ( canvas . getByRole ( 'button' , { name : 'Edit item 1' } ) ) ;
878+ } ,
879+ } ;
0 commit comments