-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Refactor PostSavedState tests to @testing-library/react (#43769)
- Loading branch information
Showing
2 changed files
with
64 additions
and
38 deletions.
There are no files selected for viewing
57 changes: 33 additions & 24 deletions
57
packages/editor/src/components/post-saved-state/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 |
---|---|---|
@@ -1,34 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PostSavedState returns a disabled button if the post is not saveable 1`] = ` | ||
<ForwardRef(Button) | ||
aria-disabled={true} | ||
icon={ | ||
<SVG | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<Path | ||
d="M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z" | ||
/> | ||
</SVG> | ||
} | ||
label="Save draft" | ||
shortcut="Ctrl+S" | ||
/> | ||
<button | ||
aria-disabled="true" | ||
aria-label="Save draft" | ||
class="components-button has-text has-icon" | ||
type="button" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
focusable="false" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
width="24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z" | ||
/> | ||
</svg> | ||
</button> | ||
`; | ||
|
||
exports[`PostSavedState returns a switch to draft link if the post is published 1`] = `<WithSelect(WithDispatch(PostSwitchToDraftButton)) />`; | ||
exports[`PostSavedState returns a switch to draft link if the post is published 1`] = ` | ||
<button | ||
class="components-button editor-post-switch-to-draft is-tertiary" | ||
type="button" | ||
> | ||
Switch to draft | ||
</button> | ||
`; | ||
|
||
exports[`PostSavedState should return Save button if edits to be saved 1`] = ` | ||
<ForwardRef(Button) | ||
aria-disabled={false} | ||
className="editor-post-save-draft" | ||
label="Save draft" | ||
onClick={[Function]} | ||
shortcut="Ctrl+S" | ||
variant="tertiary" | ||
<button | ||
aria-disabled="false" | ||
aria-label="Save draft" | ||
class="components-button editor-post-save-draft is-tertiary" | ||
type="button" | ||
> | ||
Save draft | ||
</ForwardRef(Button)> | ||
</button> | ||
`; |
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