mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Remove obsolete code
I believe this is obsolete code. Could someone double-check? @mattwr18 I tried to see any difference to `master` and I couldn't. Did I miss sth.? For context: During my work on https://github.com/Human-Connection/Human-Connection/pull/1517 the webapp was complaining about missing mutations when I changed the dropdown.
This commit is contained in:
parent
3d419c1f21
commit
a8222c5290
@ -58,7 +58,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapMutations } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import HcUser from '~/components/User/User'
|
import HcUser from '~/components/User/User'
|
||||||
import ContentMenu from '~/components/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu'
|
||||||
import ContentViewer from '~/components/Editor/ContentViewer'
|
import ContentViewer from '~/components/Editor/ContentViewer'
|
||||||
@ -126,15 +126,11 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations({
|
|
||||||
setEditPending: 'editor/SET_EDIT_PENDING',
|
|
||||||
}),
|
|
||||||
isAuthor(id) {
|
isAuthor(id) {
|
||||||
return this.user.id === id
|
return this.user.id === id
|
||||||
},
|
},
|
||||||
editCommentMenu(showMenu) {
|
editCommentMenu(showMenu) {
|
||||||
this.openEditCommentMenu = showMenu
|
this.openEditCommentMenu = showMenu
|
||||||
this.setEditPending(showMenu)
|
|
||||||
},
|
},
|
||||||
async deleteCommentCallback() {
|
async deleteCommentCallback() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
import { mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import CommentForm from './CommentForm'
|
import CommentForm from './CommentForm'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import Vuex from 'vuex'
|
|
||||||
import MutationObserver from 'mutation-observer'
|
import MutationObserver from 'mutation-observer'
|
||||||
|
|
||||||
global.MutationObserver = MutationObserver
|
global.MutationObserver = MutationObserver
|
||||||
|
|
||||||
const localVue = createLocalVue()
|
const localVue = createLocalVue()
|
||||||
localVue.use(Vuex)
|
|
||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
|
|
||||||
describe('CommentForm.vue', () => {
|
describe('CommentForm.vue', () => {
|
||||||
@ -50,21 +48,11 @@ describe('CommentForm.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const getters = {
|
|
||||||
'editor/placeholder': () => {
|
|
||||||
return 'some cool placeholder'
|
|
||||||
},
|
|
||||||
'editor/editPending': () => false,
|
|
||||||
}
|
|
||||||
const store = new Vuex.Store({
|
|
||||||
getters,
|
|
||||||
})
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(CommentForm, {
|
return mount(CommentForm, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
propsData,
|
propsData,
|
||||||
store,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ds-form v-show="!editPending" v-model="form" @submit="handleSubmit">
|
<ds-form v-model="form" @submit="handleSubmit">
|
||||||
<template slot-scope="{ errors }">
|
<template slot-scope="{ errors }">
|
||||||
<ds-card>
|
<ds-card>
|
||||||
<hc-editor
|
<hc-editor
|
||||||
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import HcEditor from '~/components/Editor/Editor'
|
import HcEditor from '~/components/Editor/Editor'
|
||||||
import PostQuery from '~/graphql/PostQuery'
|
import PostQuery from '~/graphql/PostQuery'
|
||||||
import CommentMutations from '~/graphql/CommentMutations'
|
import CommentMutations from '~/graphql/CommentMutations'
|
||||||
@ -52,11 +51,6 @@ export default {
|
|||||||
users: [],
|
users: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
editPending: 'editor/editPending',
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
updateEditorContent(value) {
|
updateEditorContent(value) {
|
||||||
const content = value.replace(/<(?:.|\n)*?>/gm, '').trim()
|
const content = value.replace(/<(?:.|\n)*?>/gm, '').trim()
|
||||||
|
|||||||
@ -26,7 +26,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import HcEditor from '~/components/Editor/Editor'
|
import HcEditor from '~/components/Editor/Editor'
|
||||||
import { mapMutations } from 'vuex'
|
|
||||||
import CommentMutations from '~/graphql/CommentMutations.js'
|
import CommentMutations from '~/graphql/CommentMutations.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -52,9 +51,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations({
|
|
||||||
setEditPending: 'editor/SET_EDIT_PENDING',
|
|
||||||
}),
|
|
||||||
updateEditorContent(value) {
|
updateEditorContent(value) {
|
||||||
const sanitizedContent = value.replace(/<(?:.|\n)*?>/gm, '').trim()
|
const sanitizedContent = value.replace(/<(?:.|\n)*?>/gm, '').trim()
|
||||||
this.disabled = value === this.comment.content || sanitizedContent.length < 1
|
this.disabled = value === this.comment.content || sanitizedContent.length < 1
|
||||||
@ -80,7 +76,6 @@ export default {
|
|||||||
this.$toast.success(this.$t('post.comment.updated'))
|
this.$toast.success(this.$t('post.comment.updated'))
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
this.$emit('showEditCommentMenu', false)
|
this.$emit('showEditCommentMenu', false)
|
||||||
this.setEditPending(false)
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.$toast.error(err.message)
|
this.$toast.error(err.message)
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import Editor from './Editor'
|
import Editor from './Editor'
|
||||||
import Vuex from 'vuex'
|
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import MutationObserver from 'mutation-observer'
|
import MutationObserver from 'mutation-observer'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
@ -8,19 +7,14 @@ import Vue from 'vue'
|
|||||||
global.MutationObserver = MutationObserver
|
global.MutationObserver = MutationObserver
|
||||||
|
|
||||||
const localVue = createLocalVue()
|
const localVue = createLocalVue()
|
||||||
localVue.use(Vuex)
|
|
||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
|
|
||||||
describe('Editor.vue', () => {
|
describe('Editor.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
let propsData
|
let propsData
|
||||||
let mocks
|
let mocks
|
||||||
let getters
|
|
||||||
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
const store = new Vuex.Store({
|
|
||||||
getters,
|
|
||||||
})
|
|
||||||
return (wrapper = mount(Editor, {
|
return (wrapper = mount(Editor, {
|
||||||
mocks,
|
mocks,
|
||||||
propsData,
|
propsData,
|
||||||
@ -29,19 +23,13 @@ describe('Editor.vue', () => {
|
|||||||
stubs: {
|
stubs: {
|
||||||
transition: false,
|
transition: false,
|
||||||
},
|
},
|
||||||
store,
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: () => {},
|
$t: () => 'some cool placeholder',
|
||||||
}
|
|
||||||
getters = {
|
|
||||||
'editor/placeholder': () => {
|
|
||||||
return 'some cool placeholder'
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
@ -64,12 +52,10 @@ describe('Editor.vue', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('uses the placeholder', () => {
|
it('translates the placeholder', () => {
|
||||||
it('from the store', () => {
|
expect(wrapper.vm.editor.extensions.options.placeholder.emptyNodeText).toEqual(
|
||||||
expect(wrapper.vm.editor.extensions.options.placeholder.emptyNodeText).toEqual(
|
'some cool placeholder',
|
||||||
'some cool placeholder',
|
)
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('optional extensions', () => {
|
describe('optional extensions', () => {
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import { Editor, EditorContent } from 'tiptap'
|
import { Editor, EditorContent } from 'tiptap'
|
||||||
import { History } from 'tiptap-extensions'
|
import { History } from 'tiptap-extensions'
|
||||||
import linkify from 'linkify-it'
|
import linkify from 'linkify-it'
|
||||||
@ -70,7 +69,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({ placeholder: 'editor/placeholder' }),
|
placeholder() {
|
||||||
|
return this.$t('editor.placeholder')
|
||||||
|
},
|
||||||
optionalExtensions() {
|
optionalExtensions() {
|
||||||
const extensions = []
|
const extensions = []
|
||||||
// Don't change the following line. The functionallity is in danger!
|
// Don't change the following line. The functionallity is in danger!
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import { mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import Vuex from 'vuex'
|
|
||||||
import VTooltip from 'v-tooltip'
|
import VTooltip from 'v-tooltip'
|
||||||
import LocaleSwitch from './LocaleSwitch.vue'
|
import LocaleSwitch from './LocaleSwitch.vue'
|
||||||
import { mutations } from '~/store/editor'
|
|
||||||
|
|
||||||
const localVue = createLocalVue()
|
const localVue = createLocalVue()
|
||||||
|
|
||||||
localVue.use(Vuex)
|
|
||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
localVue.use(VTooltip)
|
localVue.use(VTooltip)
|
||||||
|
|
||||||
@ -46,13 +43,8 @@ describe('LocaleSwitch.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const store = new Vuex.Store({
|
|
||||||
mutations: {
|
|
||||||
'editor/SET_PLACEHOLDER_TEXT': mutations.SET_PLACEHOLDER_TEXT,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(LocaleSwitch, { mocks, localVue, store, computed })
|
return mount(LocaleSwitch, { mocks, localVue, computed })
|
||||||
}
|
}
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
|
|||||||
@ -36,7 +36,6 @@
|
|||||||
import Dropdown from '~/components/Dropdown'
|
import Dropdown from '~/components/Dropdown'
|
||||||
import find from 'lodash/find'
|
import find from 'lodash/find'
|
||||||
import orderBy from 'lodash/orderBy'
|
import orderBy from 'lodash/orderBy'
|
||||||
import { mapMutations } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -66,11 +65,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations({ setPlaceholderText: 'editor/SET_PLACEHOLDER_TEXT' }),
|
|
||||||
changeLanguage(locale, toggleMenu) {
|
changeLanguage(locale, toggleMenu) {
|
||||||
this.$i18n.set(locale)
|
this.$i18n.set(locale)
|
||||||
toggleMenu()
|
toggleMenu()
|
||||||
this.setPlaceholderText(this.$t('editor.placeholder'))
|
|
||||||
},
|
},
|
||||||
matcher(locale) {
|
matcher(locale) {
|
||||||
return locale === this.$i18n.locale()
|
return locale === this.$i18n.locale()
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
export const state = () => {
|
|
||||||
return {
|
|
||||||
placeholder: null,
|
|
||||||
editPending: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getters = {
|
|
||||||
placeholder(state) {
|
|
||||||
return state.placeholder
|
|
||||||
},
|
|
||||||
editPending(state) {
|
|
||||||
return state.editPending
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mutations = {
|
|
||||||
SET_PLACEHOLDER_TEXT(state, text) {
|
|
||||||
state.placeholder = text
|
|
||||||
},
|
|
||||||
SET_EDIT_PENDING(state, boolean) {
|
|
||||||
state.editPending = boolean
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { getters, mutations } from './editor.js'
|
|
||||||
|
|
||||||
let state
|
|
||||||
|
|
||||||
describe('getters', () => {
|
|
||||||
describe('placeholder', () => {
|
|
||||||
it('return the value in state', () => {
|
|
||||||
state = { placeholder: null }
|
|
||||||
expect(getters.placeholder(state)).toBe(null)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('mutations', () => {
|
|
||||||
it('SET_PLACEHOLDER_TEXT', () => {
|
|
||||||
state = { placeholder: null }
|
|
||||||
mutations.SET_PLACEHOLDER_TEXT(state, 'new placeholder')
|
|
||||||
expect(getters.placeholder(state)).toBe('new placeholder')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
Loading…
x
Reference in New Issue
Block a user