diff --git a/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap b/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap index e38ccb6866ab6..ebebf49c5213f 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap +++ b/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap @@ -18,6 +18,32 @@ exports[`Form should not render no settings message when instructed not to 1`] = General + + + + + + + , + "settingsCount": -1, + } + } + /> + + + + + + + + + + , + "settingsCount": -1, + } + } + /> + + + + + + + + + + , + "settingsCount": -1, + } + } + /> + + + + + + + + + + , + "settingsCount": -1, + } + } + /> + + + { }) ); }); + + it('should save an array typed field when user provides an empty string correctly', async () => { + const wrapper = mountWithI18nProvider( +
+ ); + + (wrapper.instance() as Form).setState({ + unsavedChanges: { + 'general:test:array': { + value: '', + }, + }, + }); + + findTestSubject(wrapper.update(), `advancedSetting-saveButton`).simulate('click'); + expect(save).toHaveBeenCalledWith({ 'general:test:array': [] }); + }); + + it('should save an array typed field when user provides a comma separated string correctly', async () => { + const wrapper = mountWithI18nProvider( + + ); + + (wrapper.instance() as Form).setState({ + unsavedChanges: { + 'general:test:array': { + value: 'test1, test2', + }, + }, + }); + + findTestSubject(wrapper.update(), `advancedSetting-saveButton`).simulate('click'); + expect(save).toHaveBeenCalledWith({ 'general:test:array': ['test1', 'test2'] }); + }); });