diff --git a/awx/ui_next/src/screens/Setting/shared/SharedFields.jsx b/awx/ui_next/src/screens/Setting/shared/SharedFields.jsx index 13ec5dc11c..877aa2be35 100644 --- a/awx/ui_next/src/screens/Setting/shared/SharedFields.jsx +++ b/awx/ui_next/src/screens/Setting/shared/SharedFields.jsx @@ -48,10 +48,10 @@ const SettingGroup = withI18n()( { test('BooleanField renders the expected content', async () => { - const wrapper = mountWithContexts( - - {() => ( - - )} - + const outerNode = document.createElement('div'); + document.body.appendChild(outerNode); + const wrapper = mount( + + + {() => ( + + )} + + , + { + attachTo: outerNode, + } ); expect(wrapper.find('Switch')).toHaveLength(1); expect(wrapper.find('Switch').prop('isChecked')).toBe(true); expect(wrapper.find('Switch').prop('isDisabled')).toBe(false); await act(async () => { - wrapper.find('Switch').invoke('onChange')(false); + wrapper + .find('Switch label') + .instance() + .dispatchEvent(new Event('click')); }); wrapper.update(); expect(wrapper.find('Switch').prop('isChecked')).toBe(false);