-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit Post: Add unit tests to the publish panels fills
- Loading branch information
Showing
7 changed files
with
203 additions
and
5 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
54 changes: 54 additions & 0 deletions
54
edit-post/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PluginPostPublishPanel renders fill properly 1`] = ` | ||
<div> | ||
<PanelBody | ||
className="my-plugin-post-publish-panel" | ||
initialOpen={true} | ||
key="1---0/.0" | ||
title="My panel title" | ||
> | ||
<div | ||
className="components-panel__body my-plugin-post-publish-panel is-opened" | ||
> | ||
<h2 | ||
className="components-panel__body-title" | ||
> | ||
<Button | ||
aria-expanded={true} | ||
className="components-panel__body-toggle" | ||
onClick={[Function]} | ||
> | ||
<button | ||
aria-expanded={true} | ||
className="components-button components-panel__body-toggle" | ||
onClick={[Function]} | ||
type="button" | ||
> | ||
<Dashicon | ||
icon="arrow-up" | ||
> | ||
<svg | ||
aria-hidden={true} | ||
className="dashicon dashicons-arrow-up" | ||
focusable="false" | ||
height={20} | ||
role="img" | ||
viewBox="0 0 20 20" | ||
width={20} | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M7 13l4.03-6L15 13H7z" | ||
/> | ||
</svg> | ||
</Dashicon> | ||
My panel title | ||
</button> | ||
</Button> | ||
</h2> | ||
My panel content | ||
</div> | ||
</PanelBody> | ||
</div> | ||
`; |
33 changes: 33 additions & 0 deletions
33
edit-post/components/sidebar/plugin-post-publish-panel/test/index.js
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { mount } from 'enzyme'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { SlotFillProvider } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PluginPostPublishPanel from '../'; | ||
|
||
describe( 'PluginPostPublishPanel', () => { | ||
test( 'renders fill properly', () => { | ||
const wrapper = mount( | ||
<SlotFillProvider> | ||
<PluginPostPublishPanel | ||
className="my-plugin-post-publish-panel" | ||
title="My panel title" | ||
initialOpen={ true } | ||
> | ||
My panel content | ||
</PluginPostPublishPanel> | ||
<PluginPostPublishPanel.Slot /> | ||
</SlotFillProvider> | ||
); | ||
|
||
expect( wrapper.find( 'Slot' ).children() ).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
54 changes: 54 additions & 0 deletions
54
edit-post/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PluginPrePublishPanel renders fill properly 1`] = ` | ||
<div> | ||
<PanelBody | ||
className="my-plugin-pre-publish-panel" | ||
initialOpen={true} | ||
key="1---0/.0" | ||
title="My panel title" | ||
> | ||
<div | ||
className="components-panel__body my-plugin-pre-publish-panel is-opened" | ||
> | ||
<h2 | ||
className="components-panel__body-title" | ||
> | ||
<Button | ||
aria-expanded={true} | ||
className="components-panel__body-toggle" | ||
onClick={[Function]} | ||
> | ||
<button | ||
aria-expanded={true} | ||
className="components-button components-panel__body-toggle" | ||
onClick={[Function]} | ||
type="button" | ||
> | ||
<Dashicon | ||
icon="arrow-up" | ||
> | ||
<svg | ||
aria-hidden={true} | ||
className="dashicon dashicons-arrow-up" | ||
focusable="false" | ||
height={20} | ||
role="img" | ||
viewBox="0 0 20 20" | ||
width={20} | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M7 13l4.03-6L15 13H7z" | ||
/> | ||
</svg> | ||
</Dashicon> | ||
My panel title | ||
</button> | ||
</Button> | ||
</h2> | ||
My panel content | ||
</div> | ||
</PanelBody> | ||
</div> | ||
`; |
33 changes: 33 additions & 0 deletions
33
edit-post/components/sidebar/plugin-pre-publish-panel/test/index.js
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { mount } from 'enzyme'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { SlotFillProvider } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PluginPrePublishPanel from '../'; | ||
|
||
describe( 'PluginPrePublishPanel', () => { | ||
test( 'renders fill properly', () => { | ||
const wrapper = mount( | ||
<SlotFillProvider> | ||
<PluginPrePublishPanel | ||
className="my-plugin-pre-publish-panel" | ||
title="My panel title" | ||
initialOpen={ true } | ||
> | ||
My panel content | ||
</PluginPrePublishPanel> | ||
<PluginPrePublishPanel.Slot /> | ||
</SlotFillProvider> | ||
); | ||
|
||
expect( wrapper.find( 'Slot' ).children() ).toMatchSnapshot(); | ||
} ); | ||
} ); |