diff --git a/src/components/drag_and_drop/__snapshots__/drag_drop_context.test.tsx.snap b/src/components/drag_and_drop/__snapshots__/drag_drop_context.test.tsx.snap index 0cebb4a6dc4..1514a4db265 100644 --- a/src/components/drag_and_drop/__snapshots__/drag_drop_context.test.tsx.snap +++ b/src/components/drag_and_drop/__snapshots__/drag_drop_context.test.tsx.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EuiDragDropContext is rendered 1`] = `
`; +exports[`EuiDragDropContext renders 1`] = `
`; diff --git a/src/components/drag_and_drop/drag_drop_context.test.tsx b/src/components/drag_and_drop/drag_drop_context.test.tsx index 6768442df9f..5e800d8f726 100644 --- a/src/components/drag_and_drop/drag_drop_context.test.tsx +++ b/src/components/drag_and_drop/drag_drop_context.test.tsx @@ -7,59 +7,40 @@ */ import React from 'react'; -import { mount, ReactWrapper } from 'enzyme'; - -import { findTestSubject } from '../../test'; +import { render } from '../../test/rtl'; import { requiredProps } from '../../test/required_props'; -import { EuiDragDropContext } from './'; -import { EuiDragDropContextContext } from './drag_drop_context'; - -function snapshotDragDropContext(component: ReactWrapper) { - // Get the Portal's sibling and return its html - const renderedHtml = component.html(); - const container = document.createElement('div'); - container.innerHTML = renderedHtml; - return container.firstChild; -} +import { + EuiDragDropContext, + EuiDragDropContextContext, +} from './drag_drop_context'; describe('EuiDragDropContext', () => { - test('is rendered', () => { - const handler = jest.fn(); - const component = mount( - + it('renders', () => { + const { container } = render( + {}} {...requiredProps}>
); - expect(snapshotDragDropContext(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); - describe('custom behavior', () => { - describe('isDraggingType', () => { - test('is set on proprietary context', () => { - jest.mock('react', () => { - const react = jest.requireActual('react'); - return { - ...react, - useLayoutEffect: react.useEffect, - }; - }); - const handler = jest.fn(); - const component = mount( - - - {(value) => ( -
- {value.hasOwnProperty('isDraggingType') ? 'true' : 'false'} -
- )} -
-
- ); - - expect(findTestSubject(component, 'child').text()).toBe('true'); - }); + describe('isDraggingType', () => { + test('is set on proprietary context', () => { + const { getByTestSubject } = render( + {}}> + + {(value) => ( +
+ {value.hasOwnProperty('isDraggingType') ? 'true' : 'false'} +
+ )} +
+
+ ); + + expect(getByTestSubject('child')).toHaveTextContent('true'); }); }); });