diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx index cb18abee15359..669bbae2e3167 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.test.tsx @@ -122,6 +122,9 @@ describe('BuilderEntryItem', () => { expect(wrapper.find('.euiFormHelpText.euiFormRow__text').at(0).text()).toEqual( i18n.CUSTOM_COMBOBOX_OPTION_TEXT ); + expect(wrapper.find('[data-test-subj="exceptionBuilderEntryField"]').at(0).props()).toEqual( + expect.objectContaining({ acceptsCustomOptions: true }) + ); }); test('it does not render custom option text when "allowCustomOptions" is "true" and it is a nested entry', () => { @@ -154,6 +157,44 @@ describe('BuilderEntryItem', () => { ); expect(wrapper.find('.euiFormHelpText.euiFormRow__text').exists()).toBeFalsy(); + expect(wrapper.find('[data-test-subj="exceptionBuilderEntryField"]').at(0).props()).toEqual( + expect.objectContaining({ acceptsCustomOptions: false }) + ); + }); + + test('it does not render custom option text when "allowCustomOptions" is "false"', () => { + wrapper = mount( + + ); + + expect(wrapper.find('.euiFormHelpText.euiFormRow__text').exists()).toBeFalsy(); + expect(wrapper.find('[data-test-subj="exceptionBuilderEntryField"]').at(0).props()).toEqual( + expect.objectContaining({ acceptsCustomOptions: false }) + ); }); test('it render mapping issues warning text when field has mapping conflicts', () => { diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx index 4a271bb4e851d..2b75c0c6bbe50 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/entry_renderer.tsx @@ -205,7 +205,7 @@ export const BuilderEntryItem: React.FC = ({ isLoading={false} isDisabled={isDisabled || indexPattern == null} onChange={handleFieldChange} - acceptsCustomOptions={entry.nested == null} + acceptsCustomOptions={entry.nested == null && allowCustomOptions} data-test-subj="exceptionBuilderEntryField" showMappingConflicts={true} />