mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Sketch comment component
This commit is contained in:
parent
c934cc339e
commit
4845904ddf
44
components/Comment.spec.js
Normal file
44
components/Comment.spec.js
Normal 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
18
components/Comment.vue
Normal file
@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ comment.content }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
comment: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -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'
|
||||
|
||||
@ -76,7 +76,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async cancel() {
|
||||
console.log('cancel')
|
||||
this.isOpen = false
|
||||
setTimeout(() => {
|
||||
this.$emit('close')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user