From 54bfb17e317667a19a1461f9593e0dc04f6a6efb Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 12 Apr 2019 11:00:54 +0200 Subject: [PATCH] tests for tag & category, directory refactoring, lint fixes,more --- webapp/components/Category/Readme.md | 7 ++++ webapp/components/Category/index.spec.js | 35 +++++++++++++++++++ .../{Category.vue => Category/index.vue} | 0 webapp/components/Comment.vue | 11 +++--- webapp/components/PostCard.vue | 2 +- webapp/components/RelativeDateTime/index.vue | 2 +- webapp/components/Tag/Readme.md | 7 ++++ webapp/components/Tag/index.spec.js | 29 +++++++++++++++ webapp/components/{Tag.vue => Tag/index.vue} | 0 .../{User.spec.js => User/index.spec.js} | 4 +-- .../components/{User.vue => User/index.vue} | 0 webapp/pages/post/_id/_slug/index.vue | 14 ++------ webapp/pages/profile/_id/_slug.vue | 2 +- 13 files changed, 91 insertions(+), 22 deletions(-) create mode 100644 webapp/components/Category/Readme.md create mode 100644 webapp/components/Category/index.spec.js rename webapp/components/{Category.vue => Category/index.vue} (100%) create mode 100644 webapp/components/Tag/Readme.md create mode 100644 webapp/components/Tag/index.spec.js rename webapp/components/{Tag.vue => Tag/index.vue} (100%) rename webapp/components/{User.spec.js => User/index.spec.js} (97%) rename webapp/components/{User.vue => User/index.vue} (100%) diff --git a/webapp/components/Category/Readme.md b/webapp/components/Category/Readme.md new file mode 100644 index 000000000..50e07f966 --- /dev/null +++ b/webapp/components/Category/Readme.md @@ -0,0 +1,7 @@ +### Example + +Category "IT, Internet & Data Privacy" with icon "mouse-cursor" + +``` + +``` \ No newline at end of file diff --git a/webapp/components/Category/index.spec.js b/webapp/components/Category/index.spec.js new file mode 100644 index 000000000..149f96189 --- /dev/null +++ b/webapp/components/Category/index.spec.js @@ -0,0 +1,35 @@ +import { shallowMount, createLocalVue } from '@vue/test-utils' +import Styleguide from '@human-connection/styleguide' +import Category from './index' + +const localVue = createLocalVue() +localVue.use(Styleguide) + +describe('Category', () => { + let icon + let name + + let Wrapper = () => { + return shallowMount(Category, { + localVue, + propsData: { + icon, + name + } + }) + } + + describe('given Strings for Icon and Name', () => { + beforeEach(() => { + icon = 'mouse-cursor' + name = 'Peter' + }) + + it('shows Name', () => { + expect(Wrapper().text()).toContain('Peter') + }) + it('shows Icon Svg', () => { + expect(Wrapper().contains('svg')) + }) + }) +}) diff --git a/webapp/components/Category.vue b/webapp/components/Category/index.vue similarity index 100% rename from webapp/components/Category.vue rename to webapp/components/Category/index.vue diff --git a/webapp/components/Comment.vue b/webapp/components/Comment.vue index 71043e90d..13edc9c0d 100644 --- a/webapp/components/Comment.vue +++ b/webapp/components/Comment.vue @@ -4,16 +4,15 @@ style="padding-left: 40px; font-weight: bold;" color="soft" > - {{ this.$t('comment.content.unavailable-placeholder') }} + + {{ this.$t('comment.content.unavailable-placeholder') }}
- + @@ -32,13 +31,13 @@ style="padding-left: 40px;" v-html="comment.contentExcerpt" /> - +