diff --git a/package.json b/package.json index 45f68696438..352e75655a7 100644 --- a/package.json +++ b/package.json @@ -183,6 +183,7 @@ "dedent": "^0.7.0", "dts-generator": "^3.0.0", "enzyme": "^3.11.0", + "enzyme-adapter-react-16": "^1.15.7", "enzyme-to-json": "^3.5.0", "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", diff --git a/scripts/jest/setup/enzyme.js b/scripts/jest/setup/enzyme.js index 334d2c91e74..f60cfdf31ea 100644 --- a/scripts/jest/setup/enzyme.js +++ b/scripts/jest/setup/enzyme.js @@ -11,8 +11,10 @@ if (process.env.REACT_VERSION === '18') { // is not configured to support act()" errors for now // TODO: Remove when enzyme tests are replaced with RTL global.IS_REACT_ACT_ENVIRONMENT = true; -} else { +} else if (process.env.REACT_VERSION === '17') { Adapter = require('@wojtekmaj/enzyme-adapter-react-17'); +} else { + Adapter = require('enzyme-adapter-react-16'); } configure({ adapter: new Adapter() }); diff --git a/src/components/combo_box/combo_box.test.tsx b/src/components/combo_box/combo_box.test.tsx index 9b1559bfe00..e2e0a6c1bae 100644 --- a/src/components/combo_box/combo_box.test.tsx +++ b/src/components/combo_box/combo_box.test.tsx @@ -426,13 +426,7 @@ describe('behavior', () => { searchInput.simulate('focus'); }); - act(() => { - const searchInputNode = searchInput.getDOMNode(); - // React doesn't support `focusout` so we have to manually trigger it - searchInputNode.dispatchEvent( - new FocusEvent('focusout', { bubbles: true }) - ); - }); + searchInput.simulate('blur'); expect(onCreateOptionHandler).toHaveBeenCalledTimes(1); expect(onCreateOptionHandler).toHaveBeenNthCalledWith(1, 'foo', options); diff --git a/src/components/datagrid/controls/__snapshots__/column_selector.test.tsx.snap b/src/components/datagrid/controls/__snapshots__/column_selector.test.tsx.snap index e1e8d65ead3..936e7231fc4 100644 --- a/src/components/datagrid/controls/__snapshots__/column_selector.test.tsx.snap +++ b/src/components/datagrid/controls/__snapshots__/column_selector.test.tsx.snap @@ -1,5 +1,300 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`useDataGridColumnSelector columnSelector [React 16] renders a toolbar button/popover allowing users to set column visibility and order 1`] = ` +
+
+ +
+
+`; + +exports[`useDataGridColumnSelector columnSelector [React 16] renders a toolbar button/popover allowing users to set column visibility and order 2`] = ` +