mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
fix: storybook story of Comment.vue
This is the best solution that I can think of right now. Sure, it's not so great to pass a property down from the page component. But at least it fixes the storybook story, which is something.
This commit is contained in:
parent
2090e3939b
commit
6a50ef6134
@ -32,9 +32,6 @@ describe('Comment.vue', () => {
|
||||
truncate: a => a,
|
||||
removeHtml: a => a,
|
||||
},
|
||||
$route: {
|
||||
hash: '',
|
||||
},
|
||||
$scrollTo: jest.fn(),
|
||||
$apollo: {
|
||||
mutate: jest.fn().mockResolvedValue({
|
||||
|
||||
@ -71,7 +71,7 @@ export default {
|
||||
mixins: [scrollToAnchor],
|
||||
data() {
|
||||
const anchor = `commentId-${this.comment.id}`
|
||||
const isTarget = this.$route.hash === `#${anchor}`
|
||||
const isTarget = this.routeHash === `#${anchor}`
|
||||
|
||||
return {
|
||||
anchor,
|
||||
@ -87,13 +87,9 @@ export default {
|
||||
HcCommentForm,
|
||||
},
|
||||
props: {
|
||||
post: { type: Object, default: () => {} },
|
||||
comment: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
routeHash: { type: String, default: () => '' },
|
||||
post: { type: Object, default: () => ({}) },
|
||||
comment: { type: Object, default: () => ({}) },
|
||||
dateTime: { type: [Date, String], default: null },
|
||||
},
|
||||
computed: {
|
||||
|
||||
@ -42,9 +42,6 @@ describe('CommentList.vue', () => {
|
||||
truncate: a => a,
|
||||
removeHtml: a => a,
|
||||
},
|
||||
$route: {
|
||||
hash: '',
|
||||
},
|
||||
$scrollTo: jest.fn(),
|
||||
$apollo: {
|
||||
queries: {
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
:key="comment.id"
|
||||
:comment="comment"
|
||||
:post="post"
|
||||
:routeHash="routeHash"
|
||||
@deleteComment="updateCommentList"
|
||||
@updateComment="updateCommentList"
|
||||
/>
|
||||
@ -38,6 +39,7 @@ export default {
|
||||
Comment,
|
||||
},
|
||||
props: {
|
||||
routeHash: { type: String, default: () => '' },
|
||||
post: { type: Object, default: () => {} },
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
</ds-space>
|
||||
<!-- Comments -->
|
||||
<ds-section slot="footer">
|
||||
<hc-comment-list :post="post" />
|
||||
<hc-comment-list :post="post" :routeHash="$route.hash" />
|
||||
<ds-space margin-bottom="large" />
|
||||
<hc-comment-form :post="post" @createComment="createComment" />
|
||||
</ds-section>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user