diff --git a/packages/sanity/playwright-ct/tests/comments/CommentInput.spec.tsx b/packages/sanity/playwright-ct/tests/comments/CommentInput.spec.tsx
index 199a1e4d8998..1b34489d9014 100644
--- a/packages/sanity/playwright-ct/tests/comments/CommentInput.spec.tsx
+++ b/packages/sanity/playwright-ct/tests/comments/CommentInput.spec.tsx
@@ -23,9 +23,27 @@ test.describe('Comments', () => {
test('Should bring up mentions menu when typing @', async ({mount, page}) => {
await mount()
const $editable = page.getByTestId('comment-input-editable')
- await expect($editable).toBeEditable()
- await page.keyboard.type(`@`)
+ await $editable.waitFor({state: 'visible'})
+ await page.keyboard.type('@')
await expect(page.getByTestId('comments-mentions-menu')).toBeVisible()
})
+
+ test('Should be able to submit', async ({mount, page}) => {
+ const {insertPortableText} = testHelpers({page})
+ let submitted = false
+ const onSubmit = () => {
+ submitted = true
+ }
+ await mount()
+ const $editable = page.getByTestId('comment-input-editable')
+ await expect($editable).toBeEditable()
+ // Test that blank comments can't be submitted
+ await page.keyboard.press('Enter')
+ expect(submitted).toBe(false)
+ await insertPortableText('This is a comment!', $editable)
+ await expect($editable).toHaveText('This is a comment!')
+ await page.keyboard.press('Enter')
+ expect(submitted).toBe(true)
+ })
})
})
diff --git a/packages/sanity/playwright-ct/tests/comments/CommentInputStory.tsx b/packages/sanity/playwright-ct/tests/comments/CommentInputStory.tsx
index 28f356b81d14..a7ff572789c6 100644
--- a/packages/sanity/playwright-ct/tests/comments/CommentInputStory.tsx
+++ b/packages/sanity/playwright-ct/tests/comments/CommentInputStory.tsx
@@ -16,9 +16,18 @@ const currentUser: CurrentUser = {
const SCHEMA_TYPES: [] = []
-export function CommentsInputStory() {
- const [value, setValue] = useState(null)
-
+export function CommentsInputStory({
+ onDiscardCancel = noop,
+ onDiscardConfirm = noop,
+ onSubmit = noop,
+ value = null,
+}: {
+ onDiscardCancel?: () => void
+ onDiscardConfirm?: () => void
+ onSubmit?: () => void
+ value?: PortableTextBlock[] | null
+}) {
+ const [valueState, setValueState] = useState(value)
return (
)