mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #690 from Human-Connection/582-edit-field-bug-comment-form
Fix edit field render bug(CommentForm)
This commit is contained in:
commit
27b8848892
@ -5,14 +5,12 @@
|
|||||||
>
|
>
|
||||||
<template slot-scope="{ errors }">
|
<template slot-scope="{ errors }">
|
||||||
<ds-card>
|
<ds-card>
|
||||||
<no-ssr>
|
<hc-editor
|
||||||
<hc-editor
|
ref="editor"
|
||||||
ref="editor"
|
:users="users"
|
||||||
:users="users"
|
:value="form.content"
|
||||||
:value="form.content"
|
@input="updateEditorContent"
|
||||||
@input="updateEditorContent"
|
/>
|
||||||
/>
|
|
||||||
</no-ssr>
|
|
||||||
<ds-space />
|
<ds-space />
|
||||||
<ds-flex :gutter="{ base: 'small', md: 'small', sm: 'x-large', xs: 'x-large' }">
|
<ds-flex :gutter="{ base: 'small', md: 'small', sm: 'x-large', xs: 'x-large' }">
|
||||||
<ds-flex-item :width="{ base: '0%', md: '50%', sm: '0%', xs: '0%' }" />
|
<ds-flex-item :width="{ base: '0%', md: '50%', sm: '0%', xs: '0%' }" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, createLocalVue, createWrapper } from '@vue/test-utils'
|
import { mount, createLocalVue, createWrapper } from '@vue/test-utils'
|
||||||
import CommentForm from './index.vue'
|
import CommentForm from './index.vue'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
|
|
||||||
@ -6,8 +6,6 @@ const localVue = createLocalVue()
|
|||||||
|
|
||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
|
|
||||||
config.stubs['no-ssr'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('CommentForm.vue', () => {
|
describe('CommentForm.vue', () => {
|
||||||
let mocks
|
let mocks
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|||||||
@ -33,6 +33,13 @@ describe('CommentList.vue', () => {
|
|||||||
})
|
})
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
|
$apollo: {
|
||||||
|
queries: {
|
||||||
|
Post: {
|
||||||
|
refetch: jest.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
data = () => {
|
data = () => {
|
||||||
return {
|
return {
|
||||||
@ -63,5 +70,10 @@ describe('CommentList.vue', () => {
|
|||||||
it('displays comments when there are comments to display', () => {
|
it('displays comments when there are comments to display', () => {
|
||||||
expect(wrapper.find('div#comments').text()).toEqual('this is a comment')
|
expect(wrapper.find('div#comments').text()).toEqual('this is a comment')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("refetches a post's comments from the backend", () => {
|
||||||
|
wrapper.vm.refetchPostComments()
|
||||||
|
expect(mocks.$apollo.queries.Post.refetch).toHaveBeenCalledTimes(1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -54,13 +54,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$root.$on('refetchPostComments', comment => {
|
this.$root.$on('refetchPostComments', () => {
|
||||||
this.refetchPostComments(comment)
|
this.refetchPostComments()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
refetchPostComments(comment) {
|
refetchPostComments() {
|
||||||
this.$apollo.queries.Post.refetch()
|
if (this.$apollo.queries.Post) {
|
||||||
|
this.$apollo.queries.Post.refetch()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user