From 51cece3f325f5e6e7d1bcdf82cd5132c6aaec7e0 Mon Sep 17 00:00:00 2001 From: Richard Todd Date: Wed, 18 Aug 2021 14:55:12 -0400 Subject: [PATCH 1/6] Updated imports --- .../DropZone/tests/DropZone.test.tsx | 142 +++++++++--------- 1 file changed, 68 insertions(+), 74 deletions(-) diff --git a/src/components/DropZone/tests/DropZone.test.tsx b/src/components/DropZone/tests/DropZone.test.tsx index 2b7dde55376..d1f7c0388d5 100755 --- a/src/components/DropZone/tests/DropZone.test.tsx +++ b/src/components/DropZone/tests/DropZone.test.tsx @@ -2,8 +2,6 @@ import React from 'react'; import {act} from 'react-dom/test-utils'; import {clock} from '@shopify/jest-dom-mocks'; import {Label, Labelled, DisplayText, Caption} from 'components'; -// eslint-disable-next-line no-restricted-imports -import {mountWithAppProvider, ReactWrapper} from 'test-utilities/legacy'; import {mountWithApp} from 'test-utilities'; import {DropZone, DropZoneFileType} from '../DropZone'; @@ -58,13 +56,13 @@ describe('', () => { }); it('calls the onDrop callback when a drop event is fired', () => { - const dropZone = mountWithAppProvider(); + const dropZone = mountWithApp(); fireEvent({element: dropZone}); expect(spy).toHaveBeenCalledWith(files, files, []); }); it('calls the onDrop callback when a drop event is fired on document twice when a duplicate file is added consecutively', () => { - const dropZone = mountWithAppProvider(); + const dropZone = mountWithApp(); fireEvent({element: dropZone}); expect(spy).toHaveBeenCalledWith(files, files, []); @@ -73,7 +71,7 @@ describe('', () => { }); it('calls the onDrop callback with files when a drop event is fired on document', () => { - mountWithAppProvider(); + mountWithApp(); const event = createEvent('drop', files); act(() => { document.dispatchEvent(event); @@ -82,7 +80,7 @@ describe('', () => { }); it('calls the onDrop callback with files, acceptedFiles, and rejectedFiles when it accepts only jpeg', () => { - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( , ); fireEvent({element: dropZone}); @@ -90,7 +88,7 @@ describe('', () => { }); it('calls the onDropAccepted callback with acceptedFiles when it accepts only jpeg', () => { - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( , ); fireEvent({element: dropZone}); @@ -98,7 +96,7 @@ describe('', () => { }); it('calls the onDropRejected callback with rejectedFiles when it accepts only jpeg', () => { - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( , ); fireEvent({element: dropZone}); @@ -106,19 +104,19 @@ describe('', () => { }); it('calls the onDragEnter callback when a dragenter event is fired', () => { - const dropZone = mountWithAppProvider(); + const dropZone = mountWithApp(); fireEvent({element: dropZone, eventType: 'dragenter'}); expect(spy).toHaveBeenCalled(); }); it('calls the onDragOver callback when a dragover event is fired', () => { - const dropZone = mountWithAppProvider(); + const dropZone = mountWithApp(); fireEvent({element: dropZone, eventType: 'dragover'}); expect(spy).toHaveBeenCalled(); }); it('calls the onDragLeave callback when a dragleave event is fired', () => { - const dropZone = mountWithAppProvider(); + const dropZone = mountWithApp(); fireEvent({element: dropZone, eventType: 'dragleave'}); expect(spy).toHaveBeenCalled(); }); @@ -127,7 +125,7 @@ describe('', () => { const customValidator = (file: File) => { return file.type === 'image/jpeg'; }; - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( , ); fireEvent({element: dropZone}); @@ -135,7 +133,7 @@ describe('', () => { }); it('does not call any callbacks when disabled', () => { - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( ', () => { }); it('calls callbacks when not allowed multiple and a replacement file is uploaded', () => { - const dropZone = mountWithAppProvider( + const dropZone = mountWithApp( ', () => { it('renders when `label` is provided', () => { const labelText = 'My DropZone label'; - const dropZone = mountWithAppProvider(); - const labelled = dropZone.find(Labelled); - expect(labelled.prop('label')).toStrictEqual(labelText); + const dropZone = mountWithApp(); + expect(dropZone).toContainReactComponent(Labelled, {label: labelText}); }); it('renders a