Sketch comment component

This commit is contained in:
Robert Schäfer 2019-03-14 00:45:03 +01:00
parent c934cc339e
commit 4845904ddf
4 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,44 @@
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import Comment from './Comment.vue'
import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Styleguide)
describe('Comment.vue', () => {
let wrapper
let Wrapper
let propsData
let mocks
beforeEach(() => {
propsData = {}
mocks = {
$t: jest.fn(),
}
})
describe('shallowMount', () => {
const Wrapper = () => {
return shallowMount(Comment, { propsData, mocks, localVue })
}
describe('given a comment', () => {
beforeEach(() => {
propsData.comment = {
content: 'Hello I am a comment content'
}
})
it('renders content', () => {
const wrapper = Wrapper()
expect(wrapper.text()).toMatch('Hello I am a comment content')
})
})
})
})

18
components/Comment.vue Normal file
View File

@ -0,0 +1,18 @@
<template>
<div>
{{ comment.content }}
</div>
</template>
<script>
export default {
props: {
comment: {
type: Object,
default() {
return {}
}
}
}
}
</script>

View File

@ -1,4 +1,4 @@
import { shallowMount, render, mount, createLocalVue } from '@vue/test-utils'
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import ReportModal from './ReportModal.vue'
import Vue from 'vue'
import Vuex from 'vuex'

View File

@ -76,7 +76,6 @@ export default {
},
methods: {
async cancel() {
console.log('cancel')
this.isOpen = false
setTimeout(() => {
this.$emit('close')