mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Clear editor, write cypress test
- the editor only clears once, also there are some other bugs associated with clearing it this way - according to https://github.com/scrumpy/tiptap/issues/21 there should be a clearContent(), but haven't been able to get it to work - cypress test for some reason is with a weird bug where I need to submit the form, then click on the submit button, otherwise it doesn't call the handleSubmit method
This commit is contained in:
parent
a360a688b9
commit
c6b11319fe
18
cypress/integration/common/post.js
Normal file
18
cypress/integration/common/post.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
|
||||
|
||||
When('I should be able to post a comment', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('This is a comment')
|
||||
.get('.ds-form')
|
||||
.submit()
|
||||
.get('button')
|
||||
.contains('Submit Comment')
|
||||
.click()
|
||||
.get('.iziToast-message')
|
||||
.contains('Comment Submitted')
|
||||
})
|
||||
|
||||
Then('I should see my comment', () => {
|
||||
cy.get('div.comment p')
|
||||
.should('contain', 'This is a comment')
|
||||
})
|
||||
@ -1,7 +1,7 @@
|
||||
Feature: Post Comment
|
||||
As a user
|
||||
I want to comment on contributions of others
|
||||
To be able to express my thoughts and emotions about these, discuss and add give further information.
|
||||
To be able to express my thoughts and emotions about these, discuss, and add give further information.
|
||||
|
||||
Background:
|
||||
Given we have the following posts in our database:
|
||||
@ -11,5 +11,6 @@ Feature: Post Comment
|
||||
And I am logged in
|
||||
|
||||
Scenario:
|
||||
Given I get to the post page of "101-essays"
|
||||
Then I should be able to post a comment to the post "101-essays"
|
||||
Given I visit "post/bWBjpkTKZp/101-essays"
|
||||
Then I should be able to post a comment
|
||||
And I should see my comment
|
||||
@ -97,7 +97,7 @@
|
||||
<!-- Comments -->
|
||||
<ds-section slot="footer">
|
||||
<ds-flex>
|
||||
<ds-flex-item width="30%">
|
||||
<ds-flex-item width="20%">
|
||||
<h3 style="margin-top: 0;">
|
||||
<span>
|
||||
<ds-icon name="comments" />
|
||||
@ -111,7 +111,7 @@
|
||||
</span>
|
||||
</h3>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item width="70%">
|
||||
<ds-flex-item width="80%">
|
||||
<ds-form
|
||||
ref="commentForm"
|
||||
v-model="form"
|
||||
@ -122,7 +122,6 @@
|
||||
<ds-card>
|
||||
<no-ssr>
|
||||
<hc-editor
|
||||
:post="post"
|
||||
:value="form.content"
|
||||
@input="updateEditorContent"
|
||||
/>
|
||||
@ -134,7 +133,7 @@
|
||||
<ds-button
|
||||
:disabled="loading || disabled"
|
||||
ghost
|
||||
@click="clearEditor"
|
||||
@click.prevent="clearEditor"
|
||||
>
|
||||
{{ $t('actions.cancel') }}
|
||||
</ds-button>
|
||||
@ -244,8 +243,9 @@ export default {
|
||||
this.$refs.commentForm.update('content', value)
|
||||
},
|
||||
clearEditor() {
|
||||
this.$emit('clear')
|
||||
this.$refs.commentForm.update('content', '')
|
||||
this.loading = false
|
||||
this.disabled = false
|
||||
this.form.content = ' '
|
||||
},
|
||||
addComment(comment) {
|
||||
this.$apollo.queries.Post.refetch()
|
||||
@ -266,7 +266,7 @@ export default {
|
||||
`,
|
||||
variables: {
|
||||
postId: this.post.id,
|
||||
content: content
|
||||
content
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user