-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade react-beautiful-dnd to v13 (#3064)
* Sequential Upgrade for react-beautiful-dnd and @types/react-beautiful-dnd to 10.1.1 * Sequential Upgrade for react-beautiful-dnd and @types/react-beautiful-dnd to 11.0.0; Changed the tests for: draggable.tsx, droppable.tsx, drag_drop_context.tsx * Sequential Upgrade for react-beautiful-dnd and @types/react-beautiful-dnd to 11.0.5 * Sequential Upgrade to 12.1.0 for react-beautiful-dnd and @types/react-beautiful-dnd * Changing Draggable Test to not include story snapshots * fixed EuiDraggable's unit tests * revert test function from being async * added snapshot file * Sequential Upgrade to react-beautiful-dnd@13.0.0 and @types/react-beautiful-dnd@12.1.2 * Made changes to the CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * rbd as true dep Co-authored-by: Chandler Prall <chandler.prall@gmail.com> Co-authored-by: Greg Thompson <thompson.glowe@gmail.com> Co-authored-by: Greg Thompson <thompsongl@users.noreply.github.com>
- Loading branch information
1 parent
11826dc
commit f8bb840
Showing
9 changed files
with
207 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 22 additions & 46 deletions
68
src/components/drag_and_drop/__snapshots__/draggable.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiDraggable can be given ReactElement children 1`] = ` | ||
<div | ||
class="euiDroppable euiDroppable--noGrow" | ||
data-react-beautiful-dnd-droppable="1" | ||
data-test-subj="droppable" | ||
> | ||
<div | ||
aria-roledescription="Draggable item. Press space bar to lift" | ||
class="euiDraggable" | ||
data-react-beautiful-dnd-drag-handle="1" | ||
data-react-beautiful-dnd-draggable="1" | ||
data-test-subj="draggable" | ||
draggable="false" | ||
tabindex="0" | ||
> | ||
<div | ||
class="euiDraggable__item" | ||
> | ||
Hello | ||
</div> | ||
"<div data-rbd-droppable-id=\\"testDroppable\\" data-rbd-droppable-context-id=\\"0\\" | ||
data-test-subj=\\"droppable\\" class=\\"euiDroppable euiDroppable--noGrow\\"> | ||
<div data-rbd-draggable-context-id=\\"0\\" data-rbd-draggable-id=\\"testDraggable\\" | ||
tabindex=\\"0\\" role=\\"button\\" aria-describedby=\\"rbd-hidden-text-0-hidden-text-0\\" | ||
data-rbd-drag-handle-draggable-id=\\"testDraggable\\" data-rbd-drag-handle-context-id=\\"0\\" | ||
draggable=\\"false\\" data-test-subj=\\"draggable\\" class=\\"euiDraggable\\"> | ||
<div class=\\"euiDraggable__item\\">Hello</div> | ||
</div> | ||
<div | ||
class="euiDroppable__placeholder" | ||
/> | ||
</div> | ||
<div class=\\"euiDroppable__placeholder\\"></div> | ||
</div>" | ||
`; | ||
exports[`EuiDraggable can be given ReactElement children 2`] = `undefined`; | ||
exports[`EuiDraggable is rendered 1`] = ` | ||
<div | ||
class="euiDroppable euiDroppable--noGrow" | ||
data-react-beautiful-dnd-droppable="0" | ||
data-test-subj="droppable" | ||
> | ||
<div | ||
aria-roledescription="Draggable item. Press space bar to lift" | ||
class="euiDraggable" | ||
data-react-beautiful-dnd-drag-handle="0" | ||
data-react-beautiful-dnd-draggable="0" | ||
data-test-subj="draggable" | ||
draggable="false" | ||
tabindex="0" | ||
> | ||
<div | ||
class="euiDraggable__item" | ||
> | ||
Hello | ||
</div> | ||
"<div data-rbd-droppable-id=\\"testDroppable\\" data-rbd-droppable-context-id=\\"0\\" | ||
data-test-subj=\\"droppable\\" class=\\"euiDroppable euiDroppable--noGrow\\"> | ||
<div data-rbd-draggable-context-id=\\"0\\" data-rbd-draggable-id=\\"testDraggable\\" | ||
tabindex=\\"0\\" role=\\"button\\" aria-describedby=\\"rbd-hidden-text-0-hidden-text-0\\" | ||
data-rbd-drag-handle-draggable-id=\\"testDraggable\\" data-rbd-drag-handle-context-id=\\"0\\" | ||
draggable=\\"false\\" data-test-subj=\\"draggable\\" class=\\"euiDraggable\\"> | ||
<div class=\\"euiDraggable__item\\">Hello</div> | ||
</div> | ||
<div | ||
class="euiDroppable__placeholder" | ||
/> | ||
</div> | ||
<div class=\\"euiDroppable__placeholder\\"></div> | ||
</div>" | ||
`; | ||
exports[`EuiDraggable is rendered 2`] = `undefined`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,64 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
|
||
// import { findTestSubject } from '../../test'; | ||
import ReactDOM from 'react-dom'; | ||
import { resetServerContext } from 'react-beautiful-dnd'; | ||
import html from 'html'; | ||
import { requiredProps } from '../../test/required_props'; | ||
|
||
import { EuiDragDropContext, EuiDraggable, EuiDroppable } from './'; | ||
|
||
function takeSnapshot(element: HTMLElement) { | ||
expect( | ||
html.prettyPrint(element.innerHTML, { | ||
indent_size: 2, | ||
unformatted: [], // Expand all tags, including spans | ||
}) | ||
).toMatchSnapshot(); | ||
} | ||
|
||
describe('EuiDraggable', () => { | ||
let appDiv: HTMLElement; | ||
|
||
beforeEach(() => { | ||
resetServerContext(); // resets react-beautiful-dnd's internal instance counter which affects snapshots | ||
appDiv = document.createElement('div'); | ||
document.body.appendChild(appDiv); | ||
}); | ||
|
||
afterEach(() => { | ||
ReactDOM.unmountComponentAtNode(appDiv); | ||
document.body.removeChild(appDiv); | ||
}); | ||
|
||
test('is rendered', () => { | ||
const handler = jest.fn(); | ||
const component = render( | ||
|
||
ReactDOM.render( | ||
<EuiDragDropContext onDragEnd={handler} {...requiredProps}> | ||
<EuiDroppable droppableId="testDroppable"> | ||
<EuiDraggable draggableId="testDraggable" index={0}> | ||
{() => <div>Hello</div>} | ||
</EuiDraggable> | ||
</EuiDroppable> | ||
</EuiDragDropContext> | ||
</EuiDragDropContext>, | ||
appDiv | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
expect(takeSnapshot(appDiv)).toMatchSnapshot(); | ||
}); | ||
|
||
test('can be given ReactElement children', () => { | ||
const handler = jest.fn(); | ||
const component = render( | ||
|
||
ReactDOM.render( | ||
<EuiDragDropContext onDragEnd={handler} {...requiredProps}> | ||
<EuiDroppable droppableId="testDroppable"> | ||
<EuiDraggable draggableId="testDraggable" index={0}> | ||
<div>Hello</div> | ||
</EuiDraggable> | ||
</EuiDroppable> | ||
</EuiDragDropContext> | ||
</EuiDragDropContext>, | ||
appDiv | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
expect(takeSnapshot(appDiv)).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.