Skip to content

Commit

Permalink
PluginPrePublishPanel: rewrite unit tests to Testing Library
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Oct 28, 2022
1 parent 6f4763a commit 13d723b
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/**
* External dependencies
*/
import { render } from '@testing-library/react';

/**
* WordPress dependencies
*/
import { SlotFillProvider } from '@wordpress/components';
import { render } from '@wordpress/element';

/**
* Internal dependencies
Expand All @@ -11,21 +15,19 @@ import PluginPrePublishPanel from '../';

describe( 'PluginPrePublishPanel', () => {
test( 'renders fill properly', () => {
const div = document.createElement( 'div' );
render(
const { container } = render(
<SlotFillProvider>
<PluginPrePublishPanel
className="my-plugin-pre-publish-panel"
title="My panel title"
initialOpen={ true }
initialOpen
>
My panel content
</PluginPrePublishPanel>
<PluginPrePublishPanel.Slot />
</SlotFillProvider>,
div
</SlotFillProvider>
);

expect( div.innerHTML ).toMatchSnapshot();
expect( container.innerHTML ).toMatchSnapshot();
} );
} );

0 comments on commit 13d723b

Please sign in to comment.