From 4845904ddf3fcc2286aa129531eb7a0ff219e10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Thu, 14 Mar 2019 00:45:03 +0100 Subject: [PATCH] Sketch comment component --- components/Comment.spec.js | 44 ++++++++++++++++++++++++++++ components/Comment.vue | 18 ++++++++++++ components/Modal/ReportModal.spec.js | 2 +- components/Modal/ReportModal.vue | 1 - 4 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 components/Comment.spec.js create mode 100644 components/Comment.vue diff --git a/components/Comment.spec.js b/components/Comment.spec.js new file mode 100644 index 000000000..e9efe262f --- /dev/null +++ b/components/Comment.spec.js @@ -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') + }) + }) + }) +}) diff --git a/components/Comment.vue b/components/Comment.vue new file mode 100644 index 000000000..097ba957d --- /dev/null +++ b/components/Comment.vue @@ -0,0 +1,18 @@ + + + diff --git a/components/Modal/ReportModal.spec.js b/components/Modal/ReportModal.spec.js index 670524164..50d3fbb8e 100644 --- a/components/Modal/ReportModal.spec.js +++ b/components/Modal/ReportModal.spec.js @@ -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' diff --git a/components/Modal/ReportModal.vue b/components/Modal/ReportModal.vue index 4a5582236..c41d9e63d 100644 --- a/components/Modal/ReportModal.vue +++ b/components/Modal/ReportModal.vue @@ -76,7 +76,6 @@ export default { }, methods: { async cancel() { - console.log('cancel') this.isOpen = false setTimeout(() => { this.$emit('close')