Skip to content

Commit

Permalink
Add missing mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Sep 8, 2022
1 parent 8de2ccd commit 9b8da20
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
<div
class="components-panel__body post-publish-panel__postpublish-header is-opened"
>
<a>
<a
href="https://wordpress.local/sample-page/"
>
(no title)
</a>
Expand Down Expand Up @@ -95,14 +97,14 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
class="components-base-control__label emotion-4 emotion-5"
for="inspector-text-control-0"
>
undefined address
post address
</label>
<input
class="components-text-control__input"
id="inspector-text-control-0"
readonly=""
type="text"
value="undefined"
value="https://wordpress.local/sample-page/"
/>
</div>
</div>
Expand All @@ -120,9 +122,9 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
<div
class="post-publish-panel__postpublish-buttons"
>
<button
<a
class="components-button is-primary"
type="button"
href="https://wordpress.local/sample-page/"
/>
<a
class="components-button is-secondary"
Expand Down Expand Up @@ -230,7 +232,9 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
<div
class="components-panel__body post-publish-panel__postpublish-header is-opened"
>
<a>
<a
href="https://wordpress.local/sample-page/"
>
(no title)
</a>
Expand Down Expand Up @@ -259,14 +263,14 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
class="components-base-control__label emotion-4 emotion-5"
for="inspector-text-control-1"
>
undefined address
post address
</label>
<input
class="components-text-control__input"
id="inspector-text-control-1"
readonly=""
type="text"
value="undefined"
value="https://wordpress.local/sample-page/"
/>
</div>
</div>
Expand All @@ -284,9 +288,9 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
<div
class="post-publish-panel__postpublish-buttons"
>
<button
<a
class="components-button is-primary"
type="button"
href="https://wordpress.local/sample-page/"
/>
<a
class="components-button is-secondary"
Expand Down
17 changes: 17 additions & 0 deletions packages/editor/src/components/post-publish-panel/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@
*/
import { render } from '@testing-library/react';

/**
* WordPress dependencies
*/
import { select } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { store as coreStore } from '@wordpress/core-data';

/**
* Internal dependencies
*/
import { PostPublishPanel } from '../index';

describe( 'PostPublishPanel', () => {
jest.spyOn( select( coreStore ), 'getPostType' ).mockReturnValue( {
labels: {
singular_name: 'post',
},
} );

jest.spyOn( select( editorStore ), 'getCurrentPost' ).mockReturnValue( {
link: 'https://wordpress.local/sample-page/',
} );

it( 'should render the pre-publish panel if the post is not saving, published or scheduled', () => {
const { container } = render(
<PostPublishPanel
Expand Down

0 comments on commit 9b8da20

Please sign in to comment.