Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add react-testing-library #20428

Merged
merged 4 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@storybook/addon-storysource": "5.3.2",
"@storybook/addon-viewport": "5.3.2",
"@storybook/react": "5.3.2",
"@testing-library/react": "9.4.1",
"@types/jest": "24.0.25",
"@types/lodash": "4.14.149",
"@types/prettier": "1.19.0",
Expand Down
128 changes: 81 additions & 47 deletions packages/components/src/slot-fill/test/__snapshots__/slot.js.snap
Original file line number Diff line number Diff line change
@@ -1,132 +1,166 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Slot bubblesVirtually false should subsume another slot by the same name 1`] = `
Array [
<div>
<div
data-position="first"
/>,
/>
<div
data-position="second"
>
Content
</div>,
]
</div>
</div>
Comment on lines +4 to +13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the snapshots will have this wrapping div added by react-testing-library.

`;

exports[`Slot bubblesVirtually false should subsume another slot by the same name 2`] = `
Array [
<div>
<div
data-position="first"
/>,
/>
<div
data-position="second"
>
Content
</div>,
]
</div>
</div>
`;

exports[`Slot bubblesVirtually false should unmount two slots with the same name 1`] = `"<div data-position=\\"first\\"></div><div data-position=\\"second\\"></div>"`;
exports[`Slot bubblesVirtually false should unmount two slots with the same name 1`] = `
<div>
<div
data-position="first"
/>
<div
data-position="second"
/>
</div>
`;

exports[`Slot bubblesVirtually true should subsume another slot by the same name 1`] = `
Array [
<div>
<div
data-position="first"
>
<div />
</div>,
</div>
<div
data-position="second"
>
<div />
</div>,
]
<div>
Content
</div>
</div>
</div>
`;
Comment on lines 40 to 55
Copy link
Member Author

@diegohaz diegohaz Feb 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now Portal works! :)


exports[`Slot bubblesVirtually true should subsume another slot by the same name 2`] = `
Array [
<div>
<div
data-position="first"
/>,
/>
<div
data-position="second"
>
<div />
</div>,
]
<div>
Content
</div>
</div>
</div>
`;

exports[`Slot bubblesVirtually true should unmount two slots with the same name 1`] = `"<div data-position=\\"first\\"></div><div data-position=\\"second\\"></div>"`;
exports[`Slot bubblesVirtually true should unmount two slots with the same name 1`] = `
<div>
<div
data-position="first"
/>
<div
data-position="second"
/>
</div>
`;

exports[`Slot should re-render Slot when not bubbling virtually 1`] = `
Array [
<div>
<div>
1
</div>,
</div>
<button
onClick={[Function]}
type="button"
/>,
]
/>
</div>
`;

exports[`Slot should re-render Slot when not bubbling virtually 2`] = `
Array [
<div>
<div>
2
</div>,
</div>
<button
onClick={[Function]}
type="button"
/>,
]
/>
</div>
`;

exports[`Slot should render a Fill containing an array 1`] = `
<div>
<span />
<div />
text
<div>
<span />
<div />
text
</div>
</div>
`;

exports[`Slot should render a Fill containing an element 1`] = `
<div>
<span />
<div>
<span />
</div>
</div>
`;

exports[`Slot should render a string Fill 1`] = `
<div>
content
<div>
content
</div>
</div>
`;

exports[`Slot should render a string Fill with HTML wrapper when render props used 1`] = `
<div>
<blockquote>
content
</blockquote>
<div>
<blockquote>
content
</blockquote>
</div>
</div>
`;

exports[`Slot should render empty Fills 1`] = `<div />`;
exports[`Slot should render empty Fills 1`] = `
<div>
<div />
</div>
`;

exports[`Slot should render empty Fills without HTML wrapper when render props used 1`] = `<div />`;
exports[`Slot should render empty Fills without HTML wrapper when render props used 1`] = `
<div>
<div />
</div>
`;

exports[`Slot should render in expected order 1`] = `
Array [
<div>
<div>
first
second
</div>,
</div>
<button
onClick={[Function]}
type="button"
/>,
/>
<button
onClick={[Function]}
type="button"
/>,
]
/>
</div>
`;
Loading