rename Comment to CommentCard

This commit is contained in:
Alina Beck 2020-01-22 17:43:25 +03:00
parent e7bf499d37
commit 38eec0fc5f
4 changed files with 13 additions and 13 deletions

View File

@ -1,12 +1,12 @@
import { config, shallowMount } from '@vue/test-utils' import { config, shallowMount } from '@vue/test-utils'
import Comment from './Comment.vue' import CommentCard from './CommentCard.vue'
import Vuex from 'vuex' import Vuex from 'vuex'
const localVue = global.localVue const localVue = global.localVue
config.stubs['client-only'] = '<span><slot /></span>' config.stubs['client-only'] = '<span><slot /></span>'
describe('Comment.vue', () => { describe('CommentCard.vue', () => {
let propsData let propsData
let mocks let mocks
let getters let getters
@ -61,7 +61,7 @@ describe('Comment.vue', () => {
const store = new Vuex.Store({ const store = new Vuex.Store({
getters, getters,
}) })
return shallowMount(Comment, { return shallowMount(CommentCard, {
store, store,
propsData, propsData,
mocks, mocks,

View File

@ -1,6 +1,6 @@
import { storiesOf } from '@storybook/vue' import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y' import { withA11y } from '@storybook/addon-a11y'
import Comment from './Comment' import CommentCard from './CommentCard'
import helpers from '~/storybook/helpers' import helpers from '~/storybook/helpers'
helpers.init() helpers.init()
@ -41,14 +41,14 @@ const comment = {
__typename: 'Comment', __typename: 'Comment',
} }
storiesOf('Comment', module) storiesOf('CommentCard', module)
.addDecorator(withA11y) .addDecorator(withA11y)
.addDecorator(helpers.layout) .addDecorator(helpers.layout)
.add('Basic comment', () => ({ .add('Basic comment', () => ({
components: { Comment }, components: { CommentCard },
store: helpers.store, store: helpers.store,
data: () => ({ data: () => ({
comment, comment,
}), }),
template: `<comment :key="comment.id" :comment="comment" />`, template: `<comment-card :key="comment.id" :comment="comment" />`,
})) }))

View File

@ -1,5 +1,5 @@
<template> <template>
<base-card v-if="isUnavailable" class="comment"> <base-card v-if="isUnavailable" class="comment-card">
<p> <p>
<base-icon name="ban" /> <base-icon name="ban" />
{{ this.$t('comment.content.unavailable-placeholder') }} {{ this.$t('comment.content.unavailable-placeholder') }}
@ -96,7 +96,7 @@ export default {
return this.comment.createdAt !== this.comment.updatedAt return this.comment.createdAt !== this.comment.updatedAt
}, },
commentClass() { commentClass() {
let commentClass = 'comment' let commentClass = 'comment-card'
if (this.comment.deleted || this.comment.disabled) commentClass += ' disabled-content' if (this.comment.deleted || this.comment.disabled) commentClass += ' disabled-content'
if (this.isTarget) commentClass += ' --target' if (this.isTarget) commentClass += ' --target'
@ -164,7 +164,7 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.comment { .comment-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-bottom: $space-small; margin-bottom: $space-small;

View File

@ -5,7 +5,7 @@
{{ $t('common.comment', null, 0) }} {{ $t('common.comment', null, 0) }}
</h3> </h3>
<div v-if="post.comments && post.comments.length" id="comments" class="comments"> <div v-if="post.comments && post.comments.length" id="comments" class="comments">
<comment <comment-card
v-for="comment in post.comments" v-for="comment in post.comments"
:key="comment.id" :key="comment.id"
:comment="comment" :comment="comment"
@ -19,14 +19,14 @@
</template> </template>
<script> <script>
import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon' import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon'
import Comment from '~/components/Comment/Comment' import CommentCard from '~/components/CommentCard/CommentCard'
import scrollToAnchor from '~/mixins/scrollToAnchor' import scrollToAnchor from '~/mixins/scrollToAnchor'
export default { export default {
mixins: [scrollToAnchor], mixins: [scrollToAnchor],
components: { components: {
CounterIcon, CounterIcon,
Comment, CommentCard,
}, },
props: { props: {
post: { post: {