-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sanity): respect Studio configuration when rendering "restore" do…
…cument action (#6637) * fix(sanity): respect Studio configuration when rendering "restore" document action * feat(test-studio): add custom `restore` document action * feat(test-studio): add `removeRestoreActionTest` debug type * test(e2e): add test for custom `restore` document action * test(e2e): add test for removed `restore` document action * test(e2e): ensure custom restore action does not appear in `DocumentStatusBarActions` menu
- Loading branch information
Showing
8 changed files
with
187 additions
and
8 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
dev/test-studio/documentActions/actions/TestCustomRestoreAction.tsx
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,16 @@ | ||
import {RocketIcon} from '@sanity/icons' | ||
import {type DocumentActionComponent} from 'sanity' | ||
|
||
export const TestCustomRestoreAction: ( | ||
action: DocumentActionComponent, | ||
) => DocumentActionComponent = (restoreAction) => { | ||
const action: DocumentActionComponent = (props) => ({ | ||
...restoreAction(props), | ||
label: 'Custom restore', | ||
tone: 'positive', | ||
icon: RocketIcon, | ||
}) | ||
|
||
action.action = 'restore' | ||
return action | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default { | ||
type: 'document', | ||
name: 'removeRestoreActionTest', | ||
title: 'Remove Restore Action', | ||
fields: [ | ||
{ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}, | ||
], | ||
} |
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
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
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