mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
tests for tag & category, directory refactoring, lint fixes,more
This commit is contained in:
parent
b7228648fc
commit
54bfb17e31
7
webapp/components/Category/Readme.md
Normal file
7
webapp/components/Category/Readme.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Example
|
||||
|
||||
Category "IT, Internet & Data Privacy" with icon "mouse-cursor"
|
||||
|
||||
```
|
||||
<hc-category icon="mouse-pointer" name="IT, Internet & Data Privacy" />
|
||||
```
|
||||
35
webapp/components/Category/index.spec.js
Normal file
35
webapp/components/Category/index.spec.js
Normal file
@ -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'))
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -4,16 +4,15 @@
|
||||
style="padding-left: 40px; font-weight: bold;"
|
||||
color="soft"
|
||||
>
|
||||
<ds-icon name="ban" /> {{ this.$t('comment.content.unavailable-placeholder') }}
|
||||
<ds-icon name="ban" />
|
||||
{{ this.$t('comment.content.unavailable-placeholder') }}
|
||||
</ds-text>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
:class="{'comment': true, 'disabled-content': (comment.deleted || comment.disabled)}"
|
||||
>
|
||||
<ds-space
|
||||
margin-bottom="x-small"
|
||||
>
|
||||
<ds-space margin-bottom="x-small">
|
||||
<hc-user :user="author" />
|
||||
</ds-space>
|
||||
<no-ssr>
|
||||
@ -32,13 +31,13 @@
|
||||
style="padding-left: 40px;"
|
||||
v-html="comment.contentExcerpt"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import HcUser from '~/components/User.vue'
|
||||
import HcUser from '~/components/User'
|
||||
import ContentMenu from '~/components/ContentMenu'
|
||||
|
||||
export default {
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HcUser from '~/components/User.vue'
|
||||
import HcUser from '~/components/User'
|
||||
import ContentMenu from '~/components/ContentMenu'
|
||||
import { randomBytes } from 'crypto'
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ const locales = {
|
||||
fr,
|
||||
es,
|
||||
pt
|
||||
//pl
|
||||
// pl
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
7
webapp/components/Tag/Readme.md
Normal file
7
webapp/components/Tag/Readme.md
Normal file
@ -0,0 +1,7 @@
|
||||
### Example
|
||||
|
||||
Tag "Liebe"
|
||||
|
||||
```
|
||||
<hc-tag name="Liebe" />
|
||||
```
|
||||
29
webapp/components/Tag/index.spec.js
Normal file
29
webapp/components/Tag/index.spec.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils'
|
||||
import Styleguide from '@human-connection/styleguide'
|
||||
import Tag from './index'
|
||||
|
||||
const localVue = createLocalVue()
|
||||
localVue.use(Styleguide)
|
||||
|
||||
describe('Tag', () => {
|
||||
let name
|
||||
|
||||
let Wrapper = () => {
|
||||
return shallowMount(Tag, {
|
||||
localVue,
|
||||
propsData: {
|
||||
name
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
describe('given a String for Name', () => {
|
||||
beforeEach(() => {
|
||||
name = 'Liebe'
|
||||
})
|
||||
|
||||
it('shows Name', () => {
|
||||
expect(Wrapper().text()).toContain('Liebe')
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -1,5 +1,5 @@
|
||||
import { config, mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
|
||||
import User from './User.vue'
|
||||
import User from './index'
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import VTooltip from 'v-tooltip'
|
||||
@ -15,7 +15,7 @@ localVue.use(Styleguide)
|
||||
|
||||
localVue.filter('truncate', filter)
|
||||
|
||||
describe('User.vue', () => {
|
||||
describe('User', () => {
|
||||
let wrapper
|
||||
let Wrapper
|
||||
let propsData
|
||||
@ -79,14 +79,6 @@
|
||||
size="large"
|
||||
/>
|
||||
<ds-space margin-bottom="small" />
|
||||
<!--<div class="tags">
|
||||
<ds-icon name="compass" /> <ds-tag
|
||||
v-for="category in post.categories"
|
||||
:key="category.id"
|
||||
>
|
||||
{{ category.name }}
|
||||
</ds-tag>
|
||||
</div>-->
|
||||
<!-- Tags -->
|
||||
<template v-if="post.tags && post.tags.length">
|
||||
<ds-space margin="xx-small" />
|
||||
@ -140,10 +132,10 @@
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
import HcCategory from '~/components/Category.vue'
|
||||
import HcTag from '~/components/Tag.vue'
|
||||
import HcCategory from '~/components/Category'
|
||||
import HcTag from '~/components/Tag'
|
||||
import ContentMenu from '~/components/ContentMenu'
|
||||
import HcUser from '~/components/User.vue'
|
||||
import HcUser from '~/components/User'
|
||||
import HcShoutButton from '~/components/ShoutButton.vue'
|
||||
import HcEmpty from '~/components/Empty.vue'
|
||||
import Comment from '~/components/Comment.vue'
|
||||
|
||||
@ -291,7 +291,7 @@
|
||||
<script>
|
||||
import uniqBy from 'lodash/uniqBy'
|
||||
|
||||
import User from '~/components/User.vue'
|
||||
import User from '~/components/User'
|
||||
import HcPostCard from '~/components/PostCard.vue'
|
||||
import HcFollowButton from '~/components/FollowButton.vue'
|
||||
import HcCountTo from '~/components/CountTo.vue'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user