mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
chore: Fix lint w/ new linting rules
This commit is contained in:
parent
e1733201e8
commit
cb0a3f5cdd
@ -1,4 +1,4 @@
|
|||||||
export default function (to, from, savedPosition) {
|
export default function(to, from, savedPosition) {
|
||||||
if (savedPosition) return savedPosition
|
if (savedPosition) return savedPosition
|
||||||
|
|
||||||
// Edge case: If you click on a notification from a comment and then on the
|
// Edge case: If you click on a notification from a comment and then on the
|
||||||
|
|||||||
@ -2,7 +2,7 @@ const svgFileList = require.context('./svgs', true, /\.svg/)
|
|||||||
const icons = {}
|
const icons = {}
|
||||||
const iconNames = []
|
const iconNames = []
|
||||||
|
|
||||||
svgFileList.keys().forEach((fileName) => {
|
svgFileList.keys().forEach(fileName => {
|
||||||
const svgCode = svgFileList(fileName)
|
const svgCode = svgFileList(fileName)
|
||||||
const iconName = fileName.replace('./', '').replace('.svg', '')
|
const iconName = fileName.replace('./', '').replace('.svg', '')
|
||||||
icons[iconName] = svgCode
|
icons[iconName] = svgCode
|
||||||
|
|||||||
@ -21,7 +21,7 @@ describe('AvatarMenu.vue', () => {
|
|||||||
return { href: '/profile/u343/matt' }
|
return { href: '/profile/u343/matt' }
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
$t: jest.fn((a) => a),
|
$t: jest.fn(a => a),
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
@ -86,21 +86,21 @@ describe('AvatarMenu.vue', () => {
|
|||||||
it('displays a link to user profile', () => {
|
it('displays a link to user profile', () => {
|
||||||
const profileLink = wrapper
|
const profileLink = wrapper
|
||||||
.findAll('.ds-menu-item span')
|
.findAll('.ds-menu-item span')
|
||||||
.at(wrapper.vm.routes.findIndex((route) => route.path === '/profile/u343/matt'))
|
.at(wrapper.vm.routes.findIndex(route => route.path === '/profile/u343/matt'))
|
||||||
expect(profileLink.exists()).toBe(true)
|
expect(profileLink.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays a link to the notifications page', () => {
|
it('displays a link to the notifications page', () => {
|
||||||
const notificationsLink = wrapper
|
const notificationsLink = wrapper
|
||||||
.findAll('.ds-menu-item span')
|
.findAll('.ds-menu-item span')
|
||||||
.at(wrapper.vm.routes.findIndex((route) => route.path === '/notifications'))
|
.at(wrapper.vm.routes.findIndex(route => route.path === '/notifications'))
|
||||||
expect(notificationsLink.exists()).toBe(true)
|
expect(notificationsLink.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays a link to the settings page', () => {
|
it('displays a link to the settings page', () => {
|
||||||
const settingsLink = wrapper
|
const settingsLink = wrapper
|
||||||
.findAll('.ds-menu-item span')
|
.findAll('.ds-menu-item span')
|
||||||
.at(wrapper.vm.routes.findIndex((route) => route.path === '/settings'))
|
.at(wrapper.vm.routes.findIndex(route => route.path === '/settings'))
|
||||||
expect(settingsLink.exists()).toBe(true)
|
expect(settingsLink.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -121,7 +121,7 @@ describe('AvatarMenu.vue', () => {
|
|||||||
it('displays a link to moderation page', () => {
|
it('displays a link to moderation page', () => {
|
||||||
const moderationLink = wrapper
|
const moderationLink = wrapper
|
||||||
.findAll('.ds-menu-item span')
|
.findAll('.ds-menu-item span')
|
||||||
.at(wrapper.vm.routes.findIndex((route) => route.path === '/moderation'))
|
.at(wrapper.vm.routes.findIndex(route => route.path === '/moderation'))
|
||||||
expect(moderationLink.exists()).toBe(true)
|
expect(moderationLink.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ describe('AvatarMenu.vue', () => {
|
|||||||
it('displays a link to admin page', () => {
|
it('displays a link to admin page', () => {
|
||||||
const adminLink = wrapper
|
const adminLink = wrapper
|
||||||
.findAll('.ds-menu-item span')
|
.findAll('.ds-menu-item span')
|
||||||
.at(wrapper.vm.routes.findIndex((route) => route.path === '/admin'))
|
.at(wrapper.vm.routes.findIndex(route => route.path === '/admin'))
|
||||||
expect(adminLink.exists()).toBe(true)
|
expect(adminLink.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -29,8 +29,8 @@ describe('CommentCard.vue', () => {
|
|||||||
locale: () => 'en',
|
locale: () => 'en',
|
||||||
},
|
},
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
removeHtml: (a) => a,
|
removeHtml: a => a,
|
||||||
},
|
},
|
||||||
$route: { hash: '' },
|
$route: { hash: '' },
|
||||||
$scrollTo: jest.fn(),
|
$scrollTo: jest.fn(),
|
||||||
|
|||||||
@ -25,7 +25,7 @@ describe('CommentForm.vue', () => {
|
|||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
},
|
},
|
||||||
$filters: {
|
$filters: {
|
||||||
removeHtml: (a) => a,
|
removeHtml: a => a,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -104,7 +104,7 @@ export default {
|
|||||||
this.disabled = true
|
this.disabled = true
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate(mutateParams)
|
.mutate(mutateParams)
|
||||||
.then((res) => {
|
.then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (!this.update) {
|
if (!this.update) {
|
||||||
const {
|
const {
|
||||||
@ -125,7 +125,7 @@ export default {
|
|||||||
this.closeEditWindow()
|
this.closeEditWindow()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
this.$toast.error(err.message)
|
this.$toast.error(err.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import Vue from 'vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', string => string)
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
config.stubs['v-popover'] = '<span><slot /></span>'
|
||||||
@ -42,8 +42,8 @@ describe('CommentList.vue', () => {
|
|||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
removeHtml: (a) => a,
|
removeHtml: a => a,
|
||||||
},
|
},
|
||||||
$scrollTo: jest.fn(),
|
$scrollTo: jest.fn(),
|
||||||
$route: { hash: '' },
|
$route: { hash: '' },
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import faker from 'faker'
|
|||||||
|
|
||||||
helpers.init()
|
helpers.init()
|
||||||
|
|
||||||
const commentMock = (fields) => {
|
const commentMock = fields => {
|
||||||
return {
|
return {
|
||||||
id: faker.random.uuid(),
|
id: faker.random.uuid(),
|
||||||
title: faker.lorem.sentence(),
|
title: faker.lorem.sentence(),
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export default {
|
|||||||
return anchor === '#comments'
|
return anchor === '#comments'
|
||||||
},
|
},
|
||||||
updateCommentList(updatedComment) {
|
updateCommentList(updatedComment) {
|
||||||
this.postComments = this.postComments.map((comment) => {
|
this.postComments = this.postComments.map(comment => {
|
||||||
return comment.id === updatedComment.id ? updatedComment : comment
|
return comment.id === updatedComment.id ? updatedComment : comment
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,7 +17,7 @@ let getters, mutations, mocks, menuToggle, openModalSpy
|
|||||||
describe('ContentMenu.vue', () => {
|
describe('ContentMenu.vue', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((str) => str),
|
$t: jest.fn(str => str),
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: () => 'en',
|
locale: () => 'en',
|
||||||
},
|
},
|
||||||
@ -68,7 +68,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'post.menu.edit')
|
.filter(item => item.text() === 'post.menu.edit')
|
||||||
.at(0)
|
.at(0)
|
||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
@ -78,7 +78,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
it('can delete the contribution', () => {
|
it('can delete the contribution', () => {
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'post.menu.delete')
|
.filter(item => item.text() === 'post.menu.delete')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
|
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
|
||||||
@ -98,7 +98,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'post.menu.pin')
|
.filter(item => item.text() === 'post.menu.pin')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(wrapper.emitted('pinPost')).toEqual([
|
expect(wrapper.emitted('pinPost')).toEqual([
|
||||||
@ -122,7 +122,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'post.menu.unpin')
|
.filter(item => item.text() === 'post.menu.unpin')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(wrapper.emitted('unpinPost')).toEqual([
|
expect(wrapper.emitted('unpinPost')).toEqual([
|
||||||
@ -151,7 +151,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
it('edit the comment', () => {
|
it('edit the comment', () => {
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'comment.menu.edit')
|
.filter(item => item.text() === 'comment.menu.edit')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(wrapper.emitted('editComment')).toBeTruthy()
|
expect(wrapper.emitted('editComment')).toBeTruthy()
|
||||||
@ -159,7 +159,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
it('delete the comment', () => {
|
it('delete the comment', () => {
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'comment.menu.delete')
|
.filter(item => item.text() === 'comment.menu.delete')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
|
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
|
||||||
@ -180,7 +180,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'report.contribution.title')
|
.filter(item => item.text() === 'report.contribution.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
@ -197,7 +197,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'report.comment.title')
|
.filter(item => item.text() === 'report.comment.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
@ -214,7 +214,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'report.user.title')
|
.filter(item => item.text() === 'report.user.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
@ -231,7 +231,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'report.organization.title')
|
.filter(item => item.text() === 'report.organization.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
@ -253,7 +253,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'disable.contribution.title')
|
.filter(item => item.text() === 'disable.contribution.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
@ -271,7 +271,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'disable.comment.title')
|
.filter(item => item.text() === 'disable.comment.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
@ -289,7 +289,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'disable.user.title')
|
.filter(item => item.text() === 'disable.user.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
@ -307,7 +307,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'disable.organization.title')
|
.filter(item => item.text() === 'disable.organization.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
@ -325,7 +325,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'release.contribution.title')
|
.filter(item => item.text() === 'release.contribution.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
@ -343,7 +343,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'release.comment.title')
|
.filter(item => item.text() === 'release.comment.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
@ -361,7 +361,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'release.user.title')
|
.filter(item => item.text() === 'release.user.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
@ -379,7 +379,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'release.organization.title')
|
.filter(item => item.text() === 'release.organization.title')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
@ -400,7 +400,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'settings.name')
|
.filter(item => item.text() === 'settings.name')
|
||||||
.at(0)
|
.at(0)
|
||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
@ -418,7 +418,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'settings.muted-users.mute')
|
.filter(item => item.text() === 'settings.muted-users.mute')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(wrapper.emitted('mute')).toEqual([
|
expect(wrapper.emitted('mute')).toEqual([
|
||||||
@ -442,7 +442,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
wrapper
|
wrapper
|
||||||
.findAll('.ds-menu-item')
|
.findAll('.ds-menu-item')
|
||||||
.filter((item) => item.text() === 'settings.muted-users.unmute')
|
.filter(item => item.text() === 'settings.muted-users.unmute')
|
||||||
.at(0)
|
.at(0)
|
||||||
.trigger('click')
|
.trigger('click')
|
||||||
expect(wrapper.emitted('unmute')).toEqual([
|
expect(wrapper.emitted('unmute')).toEqual([
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export default {
|
|||||||
resourceType: {
|
resourceType: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
validator: (value) => {
|
validator: value => {
|
||||||
return value.match(/(contribution|comment|organization|user)/)
|
return value.match(/(contribution|comment|organization|user)/)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -140,9 +140,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
postTitleInput = wrapper.find('.ds-input')
|
postTitleInput = wrapper.find('.ds-input')
|
||||||
postTitleInput.setValue(postTitle)
|
postTitleInput.setValue(postTitle)
|
||||||
await wrapper.vm.updateEditorContent(postContent)
|
await wrapper.vm.updateEditorContent(postContent)
|
||||||
englishLanguage = wrapper
|
englishLanguage = wrapper.findAll('li').filter(language => language.text() === 'English')
|
||||||
.findAll('li')
|
|
||||||
.filter((language) => language.text() === 'English')
|
|
||||||
englishLanguage.trigger('click')
|
englishLanguage.trigger('click')
|
||||||
dataPrivacyButton = await wrapper
|
dataPrivacyButton = await wrapper
|
||||||
.find(CategoriesSelect)
|
.find(CategoriesSelect)
|
||||||
@ -208,9 +206,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
postTitleInput.setValue(postTitle)
|
postTitleInput.setValue(postTitle)
|
||||||
await wrapper.vm.updateEditorContent(postContent)
|
await wrapper.vm.updateEditorContent(postContent)
|
||||||
wrapper.find(CategoriesSelect).setData({ categories })
|
wrapper.find(CategoriesSelect).setData({ categories })
|
||||||
englishLanguage = wrapper
|
englishLanguage = wrapper.findAll('li').filter(language => language.text() === 'English')
|
||||||
.findAll('li')
|
|
||||||
.filter((language) => language.text() === 'English')
|
|
||||||
englishLanguage.trigger('click')
|
englishLanguage.trigger('click')
|
||||||
await Vue.nextTick()
|
await Vue.nextTick()
|
||||||
dataPrivacyButton = await wrapper
|
dataPrivacyButton = await wrapper
|
||||||
@ -227,9 +223,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
|
|
||||||
it('supports changing the language', async () => {
|
it('supports changing the language', async () => {
|
||||||
expectedParams.variables.language = 'de'
|
expectedParams.variables.language = 'de'
|
||||||
deutschLanguage = wrapper
|
deutschLanguage = wrapper.findAll('li').filter(language => language.text() === 'Deutsch')
|
||||||
.findAll('li')
|
|
||||||
.filter((language) => language.text() === 'Deutsch')
|
|
||||||
deutschLanguage.trigger('click')
|
deutschLanguage.trigger('click')
|
||||||
wrapper.find('form').trigger('submit')
|
wrapper.find('form').trigger('submit')
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
||||||
@ -243,7 +237,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
}
|
}
|
||||||
const spy = jest
|
const spy = jest
|
||||||
.spyOn(FileReader.prototype, 'readAsDataURL')
|
.spyOn(FileReader.prototype, 'readAsDataURL')
|
||||||
.mockImplementation(function () {
|
.mockImplementation(function() {
|
||||||
this.onload({ target: { result: 'someUrlToImage' } })
|
this.onload({ target: { result: 'someUrlToImage' } })
|
||||||
})
|
})
|
||||||
wrapper.find(ImageUploader).vm.$emit('addHeroImage', imageUpload)
|
wrapper.find(ImageUploader).vm.$emit('addHeroImage', imageUpload)
|
||||||
@ -294,9 +288,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
await wrapper.vm.updateEditorContent(postContent)
|
await wrapper.vm.updateEditorContent(postContent)
|
||||||
categoryIds = ['cat12']
|
categoryIds = ['cat12']
|
||||||
wrapper.find(CategoriesSelect).setData({ categories })
|
wrapper.find(CategoriesSelect).setData({ categories })
|
||||||
englishLanguage = wrapper
|
englishLanguage = wrapper.findAll('li').filter(language => language.text() === 'English')
|
||||||
.findAll('li')
|
|
||||||
.filter((language) => language.text() === 'English')
|
|
||||||
englishLanguage.trigger('click')
|
englishLanguage.trigger('click')
|
||||||
await Vue.nextTick()
|
await Vue.nextTick()
|
||||||
dataPrivacyButton = await wrapper
|
dataPrivacyButton = await wrapper
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const { title, content, image, language, categories } = this.contribution
|
const { title, content, image, language, categories } = this.contribution
|
||||||
|
|
||||||
const languageOptions = orderBy(locales, 'name').map((locale) => {
|
const languageOptions = orderBy(locales, 'name').map(locale => {
|
||||||
return { label: locale.name, value: locale.code }
|
return { label: locale.name, value: locale.code }
|
||||||
})
|
})
|
||||||
const { sensitive: imageBlurred = false, aspectRatio: imageAspectRatio = null } = image || {}
|
const { sensitive: imageBlurred = false, aspectRatio: imageAspectRatio = null } = image || {}
|
||||||
@ -120,8 +120,8 @@ export default {
|
|||||||
image: image || null,
|
image: image || null,
|
||||||
imageAspectRatio,
|
imageAspectRatio,
|
||||||
imageBlurred,
|
imageBlurred,
|
||||||
language: languageOptions.find((option) => option.value === language) || null,
|
language: languageOptions.find(option => option.value === language) || null,
|
||||||
categoryIds: categories ? categories.map((category) => category.id) : [],
|
categoryIds: categories ? categories.map(category => category.id) : [],
|
||||||
},
|
},
|
||||||
formSchema: {
|
formSchema: {
|
||||||
title: { required: true, min: 3, max: 100 },
|
title: { required: true, min: 3, max: 100 },
|
||||||
@ -190,7 +190,7 @@ export default {
|
|||||||
params: { id: result.id, slug: result.slug },
|
params: { id: result.id, slug: result.slug },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
this.$toast.error(err.message)
|
this.$toast.error(err.message)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export default {
|
|||||||
this.logout()
|
this.logout()
|
||||||
this.$router.history.push('/')
|
this.$router.history.push('/')
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch(error => {
|
||||||
this.$toast.error(error.message)
|
this.$toast.error(error.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe('DonationInfo.vue', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: () => 'de',
|
locale: () => 'de',
|
||||||
},
|
},
|
||||||
@ -22,11 +22,19 @@ describe('DonationInfo.vue', () => {
|
|||||||
const Wrapper = () => mount(DonationInfo, { mocks, localVue })
|
const Wrapper = () => mount(DonationInfo, { mocks, localVue })
|
||||||
|
|
||||||
it('includes a link to the Human Connection donations website', () => {
|
it('includes a link to the Human Connection donations website', () => {
|
||||||
expect(Wrapper().find('a').attributes('href')).toBe('https://human-connection.org/spenden/')
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('a')
|
||||||
|
.attributes('href'),
|
||||||
|
).toBe('https://human-connection.org/spenden/')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays a call to action button', () => {
|
it('displays a call to action button', () => {
|
||||||
expect(Wrapper().find('.base-button').text()).toBe('donations.donate-now')
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.base-button')
|
||||||
|
.text(),
|
||||||
|
).toBe('donations.donate-now')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('creates a title from the current month and a translation string', () => {
|
it.skip('creates a title from the current month and a translation string', () => {
|
||||||
|
|||||||
@ -48,9 +48,8 @@ export default {
|
|||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const paddingRightStyle = `${
|
const paddingRightStyle = `${window.innerWidth -
|
||||||
window.innerWidth - document.documentElement.clientWidth
|
document.documentElement.clientWidth}px`
|
||||||
}px`
|
|
||||||
const navigationElement = document.querySelector('.main-navigation')
|
const navigationElement = document.querySelector('.main-navigation')
|
||||||
document.body.style.paddingRight = paddingRightStyle
|
document.body.style.paddingRight = paddingRightStyle
|
||||||
document.body.classList.add('dropdown-open')
|
document.body.classList.add('dropdown-open')
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('DropdownFilter.vue', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((a) => a),
|
$t: jest.fn(a => a),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ describe('DropdownFilter.vue', () => {
|
|||||||
wrapper.find('.dropdown-filter').trigger('click')
|
wrapper.find('.dropdown-filter').trigger('click')
|
||||||
allLink = wrapper
|
allLink = wrapper
|
||||||
.findAll('.dropdown-menu-item')
|
.findAll('.dropdown-menu-item')
|
||||||
.at(propsData.filterOptions.findIndex((option) => option.label === 'All'))
|
.at(propsData.filterOptions.findIndex(option => option.label === 'All'))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays a link for All', () => {
|
it('displays a link for All', () => {
|
||||||
@ -53,21 +53,21 @@ describe('DropdownFilter.vue', () => {
|
|||||||
it('displays a link for Read', () => {
|
it('displays a link for Read', () => {
|
||||||
const readLink = wrapper
|
const readLink = wrapper
|
||||||
.findAll('.dropdown-menu-item')
|
.findAll('.dropdown-menu-item')
|
||||||
.at(propsData.filterOptions.findIndex((option) => option.label === 'Read'))
|
.at(propsData.filterOptions.findIndex(option => option.label === 'Read'))
|
||||||
expect(readLink.text()).toEqual('Read')
|
expect(readLink.text()).toEqual('Read')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('displays a link for Unread', () => {
|
it('displays a link for Unread', () => {
|
||||||
const unreadLink = wrapper
|
const unreadLink = wrapper
|
||||||
.findAll('.dropdown-menu-item')
|
.findAll('.dropdown-menu-item')
|
||||||
.at(propsData.filterOptions.findIndex((option) => option.label === 'Unread'))
|
.at(propsData.filterOptions.findIndex(option => option.label === 'Unread'))
|
||||||
expect(unreadLink.text()).toEqual('Unread')
|
expect(unreadLink.text()).toEqual('Unread')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('clicking on menu item emits filter', () => {
|
it('clicking on menu item emits filter', () => {
|
||||||
allLink.trigger('click')
|
allLink.trigger('click')
|
||||||
expect(wrapper.emitted().filter[0]).toEqual(
|
expect(wrapper.emitted().filter[0]).toEqual(
|
||||||
propsData.filterOptions.filter((option) => option.label === 'All'),
|
propsData.filterOptions.filter(option => option.label === 'All'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const users = [
|
|||||||
|
|
||||||
storiesOf('Editor', module)
|
storiesOf('Editor', module)
|
||||||
.addDecorator(withA11y)
|
.addDecorator(withA11y)
|
||||||
.addDecorator((storyFn) => {
|
.addDecorator(storyFn => {
|
||||||
const ctx = storyFn()
|
const ctx = storyFn()
|
||||||
return {
|
return {
|
||||||
components: { ctx },
|
components: { ctx },
|
||||||
|
|||||||
@ -80,7 +80,7 @@ export default {
|
|||||||
items: () => {
|
items: () => {
|
||||||
return this.users
|
return this.users
|
||||||
},
|
},
|
||||||
onEnter: (props) => this.openSuggestionList(props, MENTION),
|
onEnter: props => this.openSuggestionList(props, MENTION),
|
||||||
onChange: this.updateSuggestionList,
|
onChange: this.updateSuggestionList,
|
||||||
onExit: this.closeSuggestionList,
|
onExit: this.closeSuggestionList,
|
||||||
onKeyDown: this.navigateSuggestionList,
|
onKeyDown: this.navigateSuggestionList,
|
||||||
@ -95,7 +95,7 @@ export default {
|
|||||||
items: () => {
|
items: () => {
|
||||||
return this.hashtags
|
return this.hashtags
|
||||||
},
|
},
|
||||||
onEnter: (props) => this.openSuggestionList(props, HASHTAG),
|
onEnter: props => this.openSuggestionList(props, HASHTAG),
|
||||||
onChange: this.updateSuggestionList,
|
onChange: this.updateSuggestionList,
|
||||||
onExit: this.closeSuggestionList,
|
onExit: this.closeSuggestionList,
|
||||||
onKeyDown: this.navigateSuggestionList,
|
onKeyDown: this.navigateSuggestionList,
|
||||||
@ -109,7 +109,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
placeholder: {
|
placeholder: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler: function (val) {
|
handler: function(val) {
|
||||||
if (!val || !this.editor) {
|
if (!val || !this.editor) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ export default {
|
|||||||
new EventHandler(),
|
new EventHandler(),
|
||||||
new History(),
|
new History(),
|
||||||
],
|
],
|
||||||
onUpdate: (e) => {
|
onUpdate: e => {
|
||||||
clearTimeout(throttleInputEvent)
|
clearTimeout(throttleInputEvent)
|
||||||
throttleInputEvent = setTimeout(() => this.onUpdate(e), 300)
|
throttleInputEvent = setTimeout(() => this.onUpdate(e), 300)
|
||||||
},
|
},
|
||||||
@ -197,7 +197,7 @@ export default {
|
|||||||
return items.slice(0, 15)
|
return items.slice(0, 15)
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredList = items.filter((item) => {
|
const filteredList = items.filter(item => {
|
||||||
const itemString = item.slug || item.id
|
const itemString = item.slug || item.id
|
||||||
return itemString.toLowerCase().includes(query.toLowerCase())
|
return itemString.toLowerCase().includes(query.toLowerCase())
|
||||||
})
|
})
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<menu-bar-button
|
<menu-bar-button
|
||||||
ref="linkButton"
|
ref="linkButton"
|
||||||
:isActive="isActive.link()"
|
:isActive="isActive.link()"
|
||||||
:onClick="(event) => toggleLinkInput(getMarkAttrs('link'), event.currentTarget)"
|
:onClick="event => toggleLinkInput(getMarkAttrs('link'), event.currentTarget)"
|
||||||
icon="link"
|
icon="link"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<template v-if="isHashtag">
|
<template v-if="isHashtag">
|
||||||
<li v-if="!query" class="suggestion-list__item hint">{{ $t('editor.hashtag.addLetter') }}</li>
|
<li v-if="!query" class="suggestion-list__item hint">{{ $t('editor.hashtag.addLetter') }}</li>
|
||||||
<template v-else-if="!filteredItems.find((el) => el.id === query)">
|
<template v-else-if="!filteredItems.find(el => el.id === query)">
|
||||||
<li class="suggestion-list__item hint">{{ $t('editor.hashtag.addHashtag') }}</li>
|
<li class="suggestion-list__item hint">{{ $t('editor.hashtag.addHashtag') }}</li>
|
||||||
<li class="suggestion-list__item" @click="selectItem({ id: query })">
|
<li class="suggestion-list__item" @click="selectItem({ id: query })">
|
||||||
#{{ query | truncate(50) }}
|
#{{ query | truncate(50) }}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { Plugin } from 'prosemirror-state'
|
import { Plugin } from 'prosemirror-state'
|
||||||
import { Slice, Fragment } from 'prosemirror-model'
|
import { Slice, Fragment } from 'prosemirror-model'
|
||||||
|
|
||||||
export default function (regexp, type, getAttrs) {
|
export default function(regexp, type, getAttrs) {
|
||||||
const handler = (fragment) => {
|
const handler = fragment => {
|
||||||
const nodes = []
|
const nodes = []
|
||||||
|
|
||||||
fragment.forEach((child) => {
|
fragment.forEach(child => {
|
||||||
if (child.isText) {
|
if (child.isText) {
|
||||||
const { text } = child
|
const { text } = child
|
||||||
let pos = 0
|
let pos = 0
|
||||||
@ -43,7 +43,7 @@ export default function (regexp, type, getAttrs) {
|
|||||||
|
|
||||||
return new Plugin({
|
return new Plugin({
|
||||||
props: {
|
props: {
|
||||||
transformPasted: (slice) => new Slice(handler(slice.content), slice.openStart, slice.openEnd),
|
transformPasted: slice => new Slice(handler(slice.content), slice.openStart, slice.openEnd),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default class Embed extends Node {
|
|||||||
// source: https://stackoverflow.com/a/3809435
|
// source: https://stackoverflow.com/a/3809435
|
||||||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g,
|
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g,
|
||||||
type,
|
type,
|
||||||
(url) => ({ dataEmbedUrl: url }),
|
url => ({ dataEmbedUrl: url }),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -43,12 +43,12 @@ export default class Embed extends Node {
|
|||||||
parseDOM: [
|
parseDOM: [
|
||||||
{
|
{
|
||||||
tag: 'a[href].embed',
|
tag: 'a[href].embed',
|
||||||
getAttrs: (dom) => ({
|
getAttrs: dom => ({
|
||||||
dataEmbedUrl: dom.getAttribute('href'),
|
dataEmbedUrl: dom.getAttribute('href'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
toDOM: (node) => [
|
toDOM: node => [
|
||||||
'a',
|
'a',
|
||||||
{
|
{
|
||||||
href: node.attrs.dataEmbedUrl,
|
href: node.attrs.dataEmbedUrl,
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export default class Hashtag extends TipTapMention {
|
|||||||
get schema() {
|
get schema() {
|
||||||
return {
|
return {
|
||||||
...super.schema,
|
...super.schema,
|
||||||
toDOM: (node) => {
|
toDOM: node => {
|
||||||
// use a dummy domain because URL cannot handle relative urls
|
// use a dummy domain because URL cannot handle relative urls
|
||||||
const url = new URL('/', 'https://human-connection.org')
|
const url = new URL('/', 'https://human-connection.org')
|
||||||
url.searchParams.append('hashtag', node.attrs.id)
|
url.searchParams.append('hashtag', node.attrs.id)
|
||||||
@ -39,7 +39,7 @@ export default class Hashtag extends TipTapMention {
|
|||||||
parseDOM: [
|
parseDOM: [
|
||||||
{
|
{
|
||||||
tag: 'a[data-hashtag-id]',
|
tag: 'a[data-hashtag-id]',
|
||||||
getAttrs: (dom) => {
|
getAttrs: dom => {
|
||||||
const id = dom.getAttribute('data-hashtag-id')
|
const id = dom.getAttribute('data-hashtag-id')
|
||||||
const label = dom.innerText.split(this.options.matcher.char).join('')
|
const label = dom.innerText.split(this.options.matcher.char).join('')
|
||||||
return { id, label }
|
return { id, label }
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default class Embed extends Node {
|
|||||||
// source: https://stackoverflow.com/a/3809435
|
// source: https://stackoverflow.com/a/3809435
|
||||||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g,
|
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g,
|
||||||
type,
|
type,
|
||||||
(url) => ({ dataEmbedUrl: url }),
|
url => ({ dataEmbedUrl: url }),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -43,12 +43,12 @@ export default class Embed extends Node {
|
|||||||
parseDOM: [
|
parseDOM: [
|
||||||
{
|
{
|
||||||
tag: 'a[href].embed',
|
tag: 'a[href].embed',
|
||||||
getAttrs: (dom) => ({
|
getAttrs: dom => ({
|
||||||
dataEmbedUrl: dom.getAttribute('href'),
|
dataEmbedUrl: dom.getAttribute('href'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
toDOM: (node) => [
|
toDOM: node => [
|
||||||
'a',
|
'a',
|
||||||
{
|
{
|
||||||
href: node.attrs.dataEmbedUrl,
|
href: node.attrs.dataEmbedUrl,
|
||||||
|
|||||||
@ -17,12 +17,12 @@ export default class Link extends TipTapLink {
|
|||||||
{
|
{
|
||||||
// if this is an embed link or a hashtag, ignore
|
// if this is an embed link or a hashtag, ignore
|
||||||
tag: 'a[href]:not(.embed):not([data-hashtag-id])',
|
tag: 'a[href]:not(.embed):not([data-hashtag-id])',
|
||||||
getAttrs: (dom) => ({
|
getAttrs: dom => ({
|
||||||
href: dom.getAttribute('href'),
|
href: dom.getAttribute('href'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
toDOM: (node) => [
|
toDOM: node => [
|
||||||
'a',
|
'a',
|
||||||
{
|
{
|
||||||
...node.attrs,
|
...node.attrs,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export default class Mention extends TipTapMention {
|
|||||||
get schema() {
|
get schema() {
|
||||||
return {
|
return {
|
||||||
...super.schema,
|
...super.schema,
|
||||||
toDOM: (node) => {
|
toDOM: node => {
|
||||||
return [
|
return [
|
||||||
'a',
|
'a',
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,7 +17,7 @@ describe('EmbedComponent.vue', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: (a) => a,
|
$t: a => a,
|
||||||
$apollo: {
|
$apollo: {
|
||||||
mutate: jest
|
mutate: jest
|
||||||
.fn()
|
.fn()
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export default {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
Object.keys(this.PostsEmotionsCountByEmotion).map((emotion) => {
|
Object.keys(this.PostsEmotionsCountByEmotion).map(emotion => {
|
||||||
this.emotionsCount(emotion)
|
this.emotionsCount(emotion)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export default {
|
|||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'alert',
|
default: 'alert',
|
||||||
validator: (value) => {
|
validator: value => {
|
||||||
return value.match(/(messages|events|alert|tasks|docs|file)/)
|
return value.match(/(messages|events|alert|tasks|docs|file)/)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe('ImageUploader.vue', () => {
|
|||||||
$toast: {
|
$toast: {
|
||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
},
|
},
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export default {
|
|||||||
|
|
||||||
if (this.file.type === 'image/jpeg') {
|
if (this.file.type === 'image/jpeg') {
|
||||||
const canvas = this.cropper.getCroppedCanvas()
|
const canvas = this.cropper.getCroppedCanvas()
|
||||||
canvas.toBlob((blob) => {
|
canvas.toBlob(blob => {
|
||||||
const imageAspectRatio = canvas.width / canvas.height
|
const imageAspectRatio = canvas.width / canvas.height
|
||||||
const croppedImageFile = new File([blob], this.file.name, { type: this.file.type })
|
const croppedImageFile = new File([blob], this.file.name, { type: this.file.type })
|
||||||
onCropComplete(imageAspectRatio, croppedImageFile)
|
onCropComplete(imageAspectRatio, croppedImageFile)
|
||||||
|
|||||||
@ -14,12 +14,12 @@ describe('LocaleSwitch.vue', () => {
|
|||||||
mocks = {
|
mocks = {
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: () => 'en',
|
locale: () => 'en',
|
||||||
set: jest.fn((locale) => locale),
|
set: jest.fn(locale => locale),
|
||||||
},
|
},
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$toast: {
|
$toast: {
|
||||||
success: jest.fn((a) => a),
|
success: jest.fn(a => a),
|
||||||
error: jest.fn((a) => a),
|
error: jest.fn(a => a),
|
||||||
},
|
},
|
||||||
setPlaceholderText: jest.fn(),
|
setPlaceholderText: jest.fn(),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export default {
|
|||||||
return find(this.locales, { code: this.$i18n.locale() })
|
return find(this.locales, { code: this.$i18n.locale() })
|
||||||
},
|
},
|
||||||
routes() {
|
routes() {
|
||||||
const routes = this.locales.map((locale) => {
|
const routes = this.locales.map(locale => {
|
||||||
return {
|
return {
|
||||||
name: locale.name,
|
name: locale.name,
|
||||||
path: locale.code,
|
path: locale.code,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
const landscapeRatio = 1.3
|
const landscapeRatio = 1.3
|
||||||
const squareRatio = 1
|
const squareRatio = 1
|
||||||
const portraitRatio = 0.7
|
const portraitRatio = 0.7
|
||||||
const getRowSpan = (aspectRatio) => {
|
const getRowSpan = aspectRatio => {
|
||||||
if (aspectRatio >= landscapeRatio) return 13
|
if (aspectRatio >= landscapeRatio) return 13
|
||||||
else if (aspectRatio >= squareRatio) return 15
|
else if (aspectRatio >= squareRatio) return 15
|
||||||
else if (aspectRatio >= portraitRatio) return 18
|
else if (aspectRatio >= portraitRatio) return 18
|
||||||
|
|||||||
@ -15,7 +15,7 @@ describe('Modal.vue', () => {
|
|||||||
let state
|
let state
|
||||||
let mocks
|
let mocks
|
||||||
|
|
||||||
const createWrapper = (mountMethod) => {
|
const createWrapper = mountMethod => {
|
||||||
return () => {
|
return () => {
|
||||||
store = new Vuex.Store({
|
store = new Vuex.Store({
|
||||||
state,
|
state,
|
||||||
@ -38,7 +38,7 @@ describe('Modal.vue', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
},
|
},
|
||||||
$toast: {
|
$toast: {
|
||||||
success: () => {},
|
success: () => {},
|
||||||
|
|||||||
@ -26,7 +26,7 @@ describe('ConfirmModal.vue', () => {
|
|||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe('DisableModal.vue', () => {
|
|||||||
}
|
}
|
||||||
mocks = {
|
mocks = {
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
},
|
},
|
||||||
$toast: {
|
$toast: {
|
||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
@ -24,9 +24,12 @@ describe('DisableModal.vue', () => {
|
|||||||
},
|
},
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
mutate: jest.fn().mockResolvedValueOnce().mockRejectedValue({
|
mutate: jest
|
||||||
message: 'Not Authorised!',
|
.fn()
|
||||||
}),
|
.mockResolvedValueOnce()
|
||||||
|
.mockRejectedValue({
|
||||||
|
message: 'Not Authorised!',
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
location: {
|
location: {
|
||||||
reload: jest.fn(),
|
reload: jest.fn(),
|
||||||
|
|||||||
@ -17,9 +17,9 @@ describe('ReportModal.vue', () => {
|
|||||||
id: 'c43',
|
id: 'c43',
|
||||||
}
|
}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((a) => a),
|
$t: jest.fn(a => a),
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
},
|
},
|
||||||
$toast: {
|
$toast: {
|
||||||
success: () => {},
|
success: () => {},
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.form.reasonCategoryOptions = valuesReasonCategoryOptions.map((reasonCategory) => {
|
this.form.reasonCategoryOptions = valuesReasonCategoryOptions.map(reasonCategory => {
|
||||||
return {
|
return {
|
||||||
label: this.$t('report.reason.category.options.' + reasonCategory),
|
label: this.$t('report.reason.category.options.' + reasonCategory),
|
||||||
value: reasonCategory,
|
value: reasonCategory,
|
||||||
@ -134,7 +134,7 @@ export default {
|
|||||||
}, 1500)
|
}, 1500)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
this.success = false
|
this.success = false
|
||||||
switch (err.message) {
|
switch (err.message) {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe('Notification', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: (key) => key,
|
$t: key => key,
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { notifications } from '~/components/utils/Notifications'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', string => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
config.stubs['client-only'] = '<span><slot /></span>'
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
config.stubs['v-popover'] = '<span><slot /></span>'
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import NotificationMenu from './NotificationMenu'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', string => string)
|
||||||
|
|
||||||
config.stubs.dropdown = '<span class="dropdown"><slot :toggleMenu="() => null" /></span>'
|
config.stubs.dropdown = '<span class="dropdown"><slot :toggleMenu="() => null" /></span>'
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export default {
|
|||||||
notifications: unionBy(
|
notifications: unionBy(
|
||||||
[newNotification],
|
[newNotification],
|
||||||
previousResult.notifications,
|
previousResult.notifications,
|
||||||
(notification) => notification.id,
|
notification => notification.id,
|
||||||
).sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt)),
|
).sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import NotificationsTable from './NotificationsTable'
|
|||||||
import { notifications } from '~/components/utils/Notifications'
|
import { notifications } from '~/components/utils/Notifications'
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', string => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
config.stubs['client-only'] = '<span><slot /></span>'
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
@ -96,7 +96,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
it('renders the reason for the notification', () => {
|
it('renders the reason for the notification', () => {
|
||||||
const dsTexts = firstRowNotification.findAll('.ds-text')
|
const dsTexts = firstRowNotification.findAll('.ds-text')
|
||||||
const reason = dsTexts.filter(
|
const reason = dsTexts.filter(
|
||||||
(element) => element.text() === 'notifications.reason.mentioned_in_post',
|
element => element.text() === 'notifications.reason.mentioned_in_post',
|
||||||
)
|
)
|
||||||
expect(reason.exists()).toBe(true)
|
expect(reason.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
@ -109,7 +109,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
it("renders the Post's content", () => {
|
it("renders the Post's content", () => {
|
||||||
const boldTags = firstRowNotification.findAll('b')
|
const boldTags = firstRowNotification.findAll('b')
|
||||||
const content = boldTags.filter(
|
const content = boldTags.filter(
|
||||||
(element) => element.text() === postNotification.from.contentExcerpt,
|
element => element.text() === postNotification.from.contentExcerpt,
|
||||||
)
|
)
|
||||||
expect(content.exists()).toBe(true)
|
expect(content.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
@ -129,7 +129,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
it('renders the reason for the notification', () => {
|
it('renders the reason for the notification', () => {
|
||||||
const dsTexts = secondRowNotification.findAll('.ds-text')
|
const dsTexts = secondRowNotification.findAll('.ds-text')
|
||||||
const reason = dsTexts.filter(
|
const reason = dsTexts.filter(
|
||||||
(element) => element.text() === 'notifications.reason.mentioned_in_comment',
|
element => element.text() === 'notifications.reason.mentioned_in_comment',
|
||||||
)
|
)
|
||||||
expect(reason.exists()).toBe(true)
|
expect(reason.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
@ -142,7 +142,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
it("renders the Post's content", () => {
|
it("renders the Post's content", () => {
|
||||||
const boldTags = secondRowNotification.findAll('b')
|
const boldTags = secondRowNotification.findAll('b')
|
||||||
const content = boldTags.filter(
|
const content = boldTags.filter(
|
||||||
(element) => element.text() === commentNotification.from.contentExcerpt,
|
element => element.text() === commentNotification.from.contentExcerpt,
|
||||||
)
|
)
|
||||||
expect(content.exists()).toBe(true)
|
expect(content.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -90,7 +90,7 @@ describe('ChangePassword.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('submit form', () => {
|
describe('submit form', () => {
|
||||||
beforeEach(async (done) => {
|
beforeEach(async done => {
|
||||||
await wrapper.find('form').trigger('submit')
|
await wrapper.find('form').trigger('submit')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe('Request', () => {
|
|||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
},
|
},
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn(t => t),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
loading: false,
|
loading: false,
|
||||||
mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }),
|
mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }),
|
||||||
|
|||||||
@ -15,11 +15,19 @@ describe('ProgessBar.vue', () => {
|
|||||||
|
|
||||||
describe('given only goal and progress', () => {
|
describe('given only goal and progress', () => {
|
||||||
it('renders no title', () => {
|
it('renders no title', () => {
|
||||||
expect(Wrapper().find('.progress-bar__title').exists()).toBe(false)
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__title')
|
||||||
|
.exists(),
|
||||||
|
).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders no label', () => {
|
it('renders no label', () => {
|
||||||
expect(Wrapper().find('.progress-bar__label').exists()).toBe(false)
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__label')
|
||||||
|
.exists(),
|
||||||
|
).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calculates the progress bar width as a percentage of the goal', () => {
|
it('calculates the progress bar width as a percentage of the goal', () => {
|
||||||
@ -33,7 +41,11 @@ describe('ProgessBar.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the title', () => {
|
it('renders the title', () => {
|
||||||
expect(Wrapper().find('.progress-bar__title').text()).toBe('This is progress')
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__title')
|
||||||
|
.text(),
|
||||||
|
).toBe('This is progress')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -43,7 +55,11 @@ describe('ProgessBar.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the label', () => {
|
it('renders the label', () => {
|
||||||
expect(Wrapper().find('.progress-bar__label').text()).toBe('Going well')
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__label')
|
||||||
|
.text(),
|
||||||
|
).toBe('Going well')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -110,11 +110,11 @@
|
|||||||
:loading="$apollo.loading"
|
:loading="$apollo.loading"
|
||||||
:disabled="
|
:disabled="
|
||||||
errors ||
|
errors ||
|
||||||
!termsAndConditionsConfirmed ||
|
!termsAndConditionsConfirmed ||
|
||||||
!dataPrivacy ||
|
!dataPrivacy ||
|
||||||
!minimumAge ||
|
!minimumAge ||
|
||||||
!noCommercial ||
|
!noCommercial ||
|
||||||
!noPolitical
|
!noPolitical
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ $t('actions.save') }}
|
{{ $t('actions.save') }}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ describe('ReleaseModal.vue', () => {
|
|||||||
}
|
}
|
||||||
mocks = {
|
mocks = {
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
},
|
},
|
||||||
$toast: {
|
$toast: {
|
||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
@ -25,7 +25,10 @@ describe('ReleaseModal.vue', () => {
|
|||||||
},
|
},
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
mutate: jest.fn().mockResolvedValueOnce().mockRejectedValue({ message: 'Not Authorised!' }),
|
mutate: jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValueOnce()
|
||||||
|
.mockRejectedValue({ message: 'Not Authorised!' }),
|
||||||
},
|
},
|
||||||
location: {
|
location: {
|
||||||
reload: jest.fn(),
|
reload: jest.fn(),
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
isShouted: {
|
isShouted: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler: function (shouted) {
|
handler: function(shouted) {
|
||||||
this.shouted = shouted
|
this.shouted = shouted
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -66,7 +66,7 @@ export default {
|
|||||||
id: this.postId,
|
id: this.postId,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(res => {
|
||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
this.$emit('update', shout)
|
this.$emit('update', shout)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
error() {
|
error() {
|
||||||
const that = this
|
const that = this
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
that.error = false
|
that.error = false
|
||||||
}, 2000)
|
}, 2000)
|
||||||
},
|
},
|
||||||
@ -79,7 +79,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('user.avatar.submitted'))
|
this.$toast.success(this.$t('user.avatar.submitted'))
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
verror(file, message) {
|
verror(file, message) {
|
||||||
if (file.status === 'error') {
|
if (file.status === 'error') {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import UserTeaser from './UserTeaser.vue'
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
const filter = jest.fn((str) => str)
|
const filter = jest.fn(str => str)
|
||||||
|
|
||||||
localVue.filter('truncate', filter)
|
localVue.filter('truncate', filter)
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
:class="buttonClass"
|
:class="buttonClass"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
:type="type"
|
:type="type"
|
||||||
@click.capture="(event) => $emit('click', event)"
|
@click.capture="event => $emit('click', event)"
|
||||||
>
|
>
|
||||||
<base-icon v-if="icon" :name="icon" />
|
<base-icon v-if="icon" :name="icon" />
|
||||||
<loading-spinner v-if="loading" />
|
<loading-spinner v-if="loading" />
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export default {
|
|||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
validator: (value) => {
|
validator: value => {
|
||||||
return value.match(/(small|large)/)
|
return value.match(/(small|large)/)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -34,7 +34,11 @@ export default {
|
|||||||
userInitials() {
|
userInitials() {
|
||||||
if (this.isAnonymous) return ''
|
if (this.isAnonymous) return ''
|
||||||
|
|
||||||
return this.user.name.match(/\b\w/g).join('').substring(0, 3).toUpperCase()
|
return this.user.name
|
||||||
|
.match(/\b\w/g)
|
||||||
|
.join('')
|
||||||
|
.substring(0, 3)
|
||||||
|
.toUpperCase()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', string => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
config.stubs['client-only'] = '<span><slot /></span>'
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ describe('FiledReportsTable.vue', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
@ -47,7 +47,7 @@ describe('FiledReportsTable.vue', () => {
|
|||||||
|
|
||||||
describe('given reports', () => {
|
describe('given reports', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
filed = reports.map((report) => report.filed)
|
filed = reports.map(report => report.filed)
|
||||||
propsData.filed = filed[0]
|
propsData.filed = filed[0]
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
@ -74,7 +74,7 @@ describe('FiledReportsTable.vue', () => {
|
|||||||
it('renders the category text', () => {
|
it('renders the category text', () => {
|
||||||
const columns = wrapper.findAll('.ds-table-col')
|
const columns = wrapper.findAll('.ds-table-col')
|
||||||
const reasonCategory = columns.filter(
|
const reasonCategory = columns.filter(
|
||||||
(category) =>
|
category =>
|
||||||
category.text() === 'report.reason.category.options.pornographic_content_links',
|
category.text() === 'report.reason.category.options.pornographic_content_links',
|
||||||
)
|
)
|
||||||
expect(reasonCategory.exists()).toBe(true)
|
expect(reasonCategory.exists()).toBe(true)
|
||||||
@ -83,7 +83,7 @@ describe('FiledReportsTable.vue', () => {
|
|||||||
it("renders the Post's content", () => {
|
it("renders the Post's content", () => {
|
||||||
const columns = wrapper.findAll('.ds-table-col')
|
const columns = wrapper.findAll('.ds-table-col')
|
||||||
const reasonDescription = columns.filter(
|
const reasonDescription = columns.filter(
|
||||||
(column) => column.text() === 'This comment is porno!!!',
|
column => column.text() === 'This comment is porno!!!',
|
||||||
)
|
)
|
||||||
expect(reasonDescription.exists()).toBe(true)
|
expect(reasonDescription.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -25,7 +25,7 @@ describe('ReportList', () => {
|
|||||||
},
|
},
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$toast: {
|
$toast: {
|
||||||
error: jest.fn((message) => message),
|
error: jest.fn(message => message),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
mutations = {
|
mutations = {
|
||||||
|
|||||||
@ -158,9 +158,9 @@ export const reports = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const unreviewedReports = reports.filter((report) => !report.reviewed)
|
const unreviewedReports = reports.filter(report => !report.reviewed)
|
||||||
const reviewedReports = reports.filter((report) => report.reviewed)
|
const reviewedReports = reports.filter(report => report.reviewed)
|
||||||
const closedReports = reports.filter((report) => report.closed)
|
const closedReports = reports.filter(report => report.closed)
|
||||||
const filterOptions = [
|
const filterOptions = [
|
||||||
{ label: 'All', value: reports },
|
{ label: 'All', value: reports },
|
||||||
{ label: 'Unreviewed', value: unreviewedReports },
|
{ label: 'Unreviewed', value: unreviewedReports },
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
modalData() {
|
modalData() {
|
||||||
return function (report) {
|
return function(report) {
|
||||||
const identStart =
|
const identStart =
|
||||||
'moderation.reports.decideModal.' +
|
'moderation.reports.decideModal.' +
|
||||||
report.resource.__typename +
|
report.resource.__typename +
|
||||||
@ -131,7 +131,7 @@ export default {
|
|||||||
this.$toast.success(this.$t('moderation.reports.DecisionSuccess'))
|
this.$toast.success(this.$t('moderation.reports.DecisionSuccess'))
|
||||||
this.$apollo.queries.reportsList.refetch()
|
this.$apollo.queries.reportsList.refetch()
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
openModal(report) {
|
openModal(report) {
|
||||||
this.commitModalData(this.modalData(report))
|
this.commitModalData(this.modalData(report))
|
||||||
|
|||||||
@ -14,7 +14,7 @@ describe('ReportRow', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
@ -62,7 +62,7 @@ describe('ReportRow', () => {
|
|||||||
it('renders a decided text', () => {
|
it('renders a decided text', () => {
|
||||||
const decidedTitle = wrapper
|
const decidedTitle = wrapper
|
||||||
.findAll('.title')
|
.findAll('.title')
|
||||||
.filter((title) => title.text() === 'moderation.reports.decided')
|
.filter(title => title.text() === 'moderation.reports.decided')
|
||||||
expect(decidedTitle.exists()).toBe(true)
|
expect(decidedTitle.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -85,7 +85,12 @@ describe('ReportRow', () => {
|
|||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
it('renders the disabled icon', () => {
|
it('renders the disabled icon', () => {
|
||||||
expect(wrapper.find('.status-line').find(BaseIcon).props().name).toEqual('eye-slash')
|
expect(
|
||||||
|
wrapper
|
||||||
|
.find('.status-line')
|
||||||
|
.find(BaseIcon)
|
||||||
|
.props().name,
|
||||||
|
).toEqual('eye-slash')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders its current status', () => {
|
it('renders its current status', () => {
|
||||||
@ -99,7 +104,12 @@ describe('ReportRow', () => {
|
|||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
it('renders the enabled icon', () => {
|
it('renders the enabled icon', () => {
|
||||||
expect(wrapper.find('.status-line').find(BaseIcon).props().name).toEqual('eye')
|
expect(
|
||||||
|
wrapper
|
||||||
|
.find('.status-line')
|
||||||
|
.find(BaseIcon)
|
||||||
|
.props().name,
|
||||||
|
).toEqual('eye')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders its current status', () => {
|
it('renders its current status', () => {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ describe('ReportsTable', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe('SearchField.vue', () => {
|
|||||||
$apollo: {
|
$apollo: {
|
||||||
query: jest.fn(),
|
query: jest.fn(),
|
||||||
},
|
},
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
getters = { 'auth/isModerator': () => false }
|
getters = { 'auth/isModerator': () => false }
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
|
|||||||
@ -7,7 +7,7 @@ describe('SearchHeading.vue', () => {
|
|||||||
let mocks, wrapper, propsData
|
let mocks, wrapper, propsData
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
propsData = {
|
propsData = {
|
||||||
resourceType: 'Post',
|
resourceType: 'Post',
|
||||||
|
|||||||
@ -2,13 +2,13 @@ import { shallowMount } from '@vue/test-utils'
|
|||||||
import SearchPost from './SearchPost.vue'
|
import SearchPost from './SearchPost.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.filter('dateTime', (d) => d)
|
localVue.filter('dateTime', d => d)
|
||||||
|
|
||||||
describe('SearchPost.vue', () => {
|
describe('SearchPost.vue', () => {
|
||||||
let mocks, wrapper, propsData
|
let mocks, wrapper, propsData
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
propsData = {
|
propsData = {
|
||||||
option: {
|
option: {
|
||||||
@ -38,7 +38,7 @@ describe('SearchPost.vue', () => {
|
|||||||
wrapper
|
wrapper
|
||||||
.find('.search-post-meta')
|
.find('.search-post-meta')
|
||||||
.findAll('span')
|
.findAll('span')
|
||||||
.filter((item) => item.text() === '3')
|
.filter(item => item.text() === '3')
|
||||||
.exists(),
|
.exists(),
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
})
|
})
|
||||||
@ -48,7 +48,7 @@ describe('SearchPost.vue', () => {
|
|||||||
wrapper
|
wrapper
|
||||||
.find('.search-post-meta')
|
.find('.search-post-meta')
|
||||||
.findAll('span')
|
.findAll('span')
|
||||||
.filter((item) => item.text() === '6')
|
.filter(item => item.text() === '6')
|
||||||
.exists(),
|
.exists(),
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -19,7 +19,7 @@ describe('SearchableInput.vue', () => {
|
|||||||
$router: {
|
$router: {
|
||||||
push: jest.fn(),
|
push: jest.fn(),
|
||||||
},
|
},
|
||||||
$t: jest.fn((string) => string),
|
$t: jest.fn(string => string),
|
||||||
}
|
}
|
||||||
getters = { 'auth/isModerator': () => false }
|
getters = { 'auth/isModerator': () => false }
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
@ -98,7 +98,7 @@ describe('SearchableInput.vue', () => {
|
|||||||
select.element.value = 'Bob'
|
select.element.value = 'Bob'
|
||||||
select.trigger('input')
|
select.trigger('input')
|
||||||
const users = wrapper.findAll('.slug')
|
const users = wrapper.findAll('.slug')
|
||||||
const bob = users.filter((item) => item.text().match(/@bob-der-baumeister/))
|
const bob = users.filter(item => item.text().match(/@bob-der-baumeister/))
|
||||||
bob.trigger('click')
|
bob.trigger('click')
|
||||||
await Vue.nextTick()
|
await Vue.nextTick()
|
||||||
expect(mocks.$router.push).toHaveBeenCalledWith({
|
expect(mocks.$router.push).toHaveBeenCalledWith({
|
||||||
@ -111,7 +111,7 @@ describe('SearchableInput.vue', () => {
|
|||||||
select.element.value = 'Hash'
|
select.element.value = 'Hash'
|
||||||
select.trigger('input')
|
select.trigger('input')
|
||||||
const tags = wrapper.findAll('.hc-hashtag')
|
const tags = wrapper.findAll('.hc-hashtag')
|
||||||
const tag = tags.filter((item) => item.text().match(/#Hashtag/))
|
const tag = tags.filter(item => item.text().match(/#Hashtag/))
|
||||||
tag.trigger('click')
|
tag.trigger('click')
|
||||||
await Vue.nextTick()
|
await Vue.nextTick()
|
||||||
expect(mocks.$router.push).toHaveBeenCalledWith('?hashtag=Hashtag')
|
expect(mocks.$router.push).toHaveBeenCalledWith('?hashtag=Hashtag')
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
:icon-right="null"
|
:icon-right="null"
|
||||||
:options="options"
|
:options="options"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:filter="(item) => item"
|
:filter="item => item"
|
||||||
:no-options-available="emptyText"
|
:no-options-available="emptyText"
|
||||||
:auto-reset-search="!searchValue"
|
:auto-reset-search="!searchValue"
|
||||||
:placeholder="$t('search.placeholder')"
|
:placeholder="$t('search.placeholder')"
|
||||||
@ -88,8 +88,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
isFirstOfType(option) {
|
isFirstOfType(option) {
|
||||||
return (
|
return (
|
||||||
this.options.findIndex((o) => o === option) ===
|
this.options.findIndex(o => o === option) ===
|
||||||
this.options.findIndex((o) => o.__typename === option.__typename)
|
this.options.findIndex(o => o.__typename === option.__typename)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { normalizeEmail } from 'validator'
|
import { normalizeEmail } from 'validator'
|
||||||
|
|
||||||
export default (email) =>
|
export default email =>
|
||||||
normalizeEmail(email, {
|
normalizeEmail(email, {
|
||||||
// gmail_remove_dots: false, default
|
// gmail_remove_dots: false, default
|
||||||
gmail_remove_subaddress: false,
|
gmail_remove_subaddress: false,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ beforeEach(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('validReport', () => {
|
describe('validReport', () => {
|
||||||
const validate = (object) => {
|
const validate = object => {
|
||||||
const { formSchema } = validReport({ translate })
|
const { formSchema } = validReport({ translate })
|
||||||
const validator = new Schema(formSchema)
|
const validator = new Schema(formSchema)
|
||||||
return validator.validate(object, { suppressWarning: true }).catch(({ errors }) => {
|
return validator.validate(object, { suppressWarning: true }).catch(({ errors }) => {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function UniqueSlugForm({ translate, apollo, currentUser }) {
|
|||||||
asyncValidator(rule, value, callback) {
|
asyncValidator(rule, value, callback) {
|
||||||
debounce(() => {
|
debounce(() => {
|
||||||
const variables = { slug: value }
|
const variables = { slug: value }
|
||||||
apollo.query({ query: checkSlugAvailableQuery, variables }).then((response) => {
|
apollo.query({ query: checkSlugAvailableQuery, variables }).then(response => {
|
||||||
const {
|
const {
|
||||||
data: { User },
|
data: { User },
|
||||||
} = response
|
} = response
|
||||||
|
|||||||
@ -14,7 +14,7 @@ beforeEach(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('UniqueSlugForm', () => {
|
describe('UniqueSlugForm', () => {
|
||||||
const validate = (object) => {
|
const validate = object => {
|
||||||
const { formSchema } = UniqueSlugForm({ translate, apollo, currentUser })
|
const { formSchema } = UniqueSlugForm({ translate, apollo, currentUser })
|
||||||
const validator = new Schema(formSchema)
|
const validator = new Schema(formSchema)
|
||||||
return validator.validate(object, { suppressWarning: true }).catch(({ errors }) => {
|
return validator.validate(object, { suppressWarning: true }).catch(({ errors }) => {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export default function UpdateQuery(component, { $state, pageKey }) {
|
|||||||
$state.complete()
|
$state.complete()
|
||||||
}
|
}
|
||||||
const result = {}
|
const result = {}
|
||||||
result[pageKey] = unionBy(oldData, newData, (item) => item.id)
|
result[pageKey] = unionBy(oldData, newData, item => item.id)
|
||||||
$state.loaded()
|
$state.loaded()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
export default (i18n) => {
|
export default i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return {
|
return {
|
||||||
CreateComment: gql`
|
CreateComment: gql`
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
export default (app) => {
|
export default app => {
|
||||||
const lang = app.$i18n.locale().toUpperCase()
|
const lang = app.$i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
query Comment($postId: ID) {
|
query Comment($postId: ID) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
return gql`
|
return gql`
|
||||||
query($url: String!) {
|
query($url: String!) {
|
||||||
embed(url: $url) {
|
embed(url: $url) {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export const userFragment = gql`
|
|||||||
deleted
|
deleted
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
export const locationAndBadgesFragment = (lang) => gql`
|
export const locationAndBadgesFragment = lang => gql`
|
||||||
fragment locationAndBadges on User {
|
fragment locationAndBadges on User {
|
||||||
location {
|
location {
|
||||||
name: name${lang}
|
name: name${lang}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
tagsCategoriesAndPinnedFragment,
|
tagsCategoriesAndPinnedFragment,
|
||||||
} from './Fragments'
|
} from './Fragments'
|
||||||
|
|
||||||
export default (i18n) => {
|
export default i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
@ -44,7 +44,7 @@ export default (i18n) => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const filterPosts = (i18n) => {
|
export const filterPosts = i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
@ -69,7 +69,7 @@ export const filterPosts = (i18n) => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const profilePagePosts = (i18n) => {
|
export const profilePagePosts = i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
@ -107,7 +107,7 @@ export const PostsEmotionsByCurrentUser = () => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const relatedContributions = (i18n) => {
|
export const relatedContributions = i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
commentFragment,
|
commentFragment,
|
||||||
} from './Fragments'
|
} from './Fragments'
|
||||||
|
|
||||||
export default (i18n) => {
|
export default i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
@ -61,7 +61,7 @@ export const minimisedUserQuery = () => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const notificationQuery = (i18n) => {
|
export const notificationQuery = i18n => {
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
${commentFragment}
|
${commentFragment}
|
||||||
@ -100,7 +100,7 @@ export const notificationQuery = (i18n) => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const markAsReadMutation = (i18n) => {
|
export const markAsReadMutation = i18n => {
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
${commentFragment}
|
${commentFragment}
|
||||||
@ -174,7 +174,7 @@ export const notificationAdded = () => {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
export const followUserMutation = (i18n) => {
|
export const followUserMutation = i18n => {
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
${userCountsFragment}
|
${userCountsFragment}
|
||||||
@ -194,7 +194,7 @@ export const followUserMutation = (i18n) => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unfollowUserMutation = (i18n) => {
|
export const unfollowUserMutation = i18n => {
|
||||||
return gql`
|
return gql`
|
||||||
${userFragment}
|
${userFragment}
|
||||||
${userCountsFragment}
|
${userCountsFragment}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('error.vue', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((key) => key),
|
$t: jest.fn(key => key),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
export default function (options = {}) {
|
export default function(options = {}) {
|
||||||
const { queryId, querySlug, path, message = 'Page not found.' } = options
|
const { queryId, querySlug, path, message = 'Page not found.' } = options
|
||||||
return {
|
return {
|
||||||
asyncData: async (context) => {
|
asyncData: async context => {
|
||||||
const {
|
const {
|
||||||
params: { id, slug },
|
params: { id, slug },
|
||||||
redirect,
|
redirect,
|
||||||
|
|||||||
@ -261,7 +261,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const svgRule = config.module.rules.find((rule) => rule.test.test('.svg'))
|
const svgRule = config.module.rules.find(rule => rule.test.test('.svg'))
|
||||||
svgRule.test = /\.(png|jpe?g|gif|webp)$/
|
svgRule.test = /\.(png|jpe?g|gif|webp)$/
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
@ -291,10 +291,10 @@ export default {
|
|||||||
preTransformNode(abstractSyntaxTreeElement) {
|
preTransformNode(abstractSyntaxTreeElement) {
|
||||||
if (!ctx.isDev) {
|
if (!ctx.isDev) {
|
||||||
const { attrsMap, attrsList } = abstractSyntaxTreeElement
|
const { attrsMap, attrsList } = abstractSyntaxTreeElement
|
||||||
tagAttributesForTesting.forEach((attribute) => {
|
tagAttributesForTesting.forEach(attribute => {
|
||||||
if (attrsMap[attribute]) {
|
if (attrsMap[attribute]) {
|
||||||
delete attrsMap[attribute]
|
delete attrsMap[attribute]
|
||||||
const index = attrsList.findIndex((attr) => attr.name === attribute)
|
const index = attrsList.findIndex(attr => attr.name === attribute)
|
||||||
attrsList.splice(index, 1)
|
attrsList.splice(index, 1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('admin.donations.successfulUpdate'))
|
this.$toast.success(this.$t('admin.donations.successfulUpdate'))
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|||||||
@ -48,9 +48,9 @@ describe('PostIndex', () => {
|
|||||||
mutations,
|
mutations,
|
||||||
})
|
})
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: (key) => key,
|
$t: key => key,
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
removeLinks: jest.fn(),
|
removeLinks: jest.fn(),
|
||||||
},
|
},
|
||||||
$i18n: {
|
$i18n: {
|
||||||
@ -120,7 +120,10 @@ describe('PostIndex', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('calls store when using order by menu', () => {
|
it('calls store when using order by menu', () => {
|
||||||
wrapper.findAll('li').at(0).trigger('click')
|
wrapper
|
||||||
|
.findAll('li')
|
||||||
|
.at(0)
|
||||||
|
.trigger('click')
|
||||||
expect(mutations['posts/SELECT_ORDER']).toHaveBeenCalledWith({}, 'createdAt_asc')
|
expect(mutations['posts/SELECT_ORDER']).toHaveBeenCalledWith({}, 'createdAt_asc')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -161,7 +161,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
deletePost(deletedPost) {
|
deletePost(deletedPost) {
|
||||||
this.posts = this.posts.filter((post) => {
|
this.posts = this.posts.filter(post => {
|
||||||
return post.id !== deletedPost.id
|
return post.id !== deletedPost.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -181,7 +181,7 @@ export default {
|
|||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.Post.refetch()
|
this.$apollo.queries.Post.refetch()
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
unpinPost(post) {
|
unpinPost(post) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
@ -194,7 +194,7 @@ export default {
|
|||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.Post.refetch()
|
this.$apollo.queries.Post.refetch()
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|||||||
@ -15,9 +15,9 @@ describe('PostIndex', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData = {}
|
propsData = {}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: (string) => string,
|
$t: string => string,
|
||||||
$toast: {
|
$toast: {
|
||||||
error: jest.fn((string) => string),
|
error: jest.fn(string => string),
|
||||||
},
|
},
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: () => 'en',
|
locale: () => 'en',
|
||||||
|
|||||||
@ -48,8 +48,8 @@ describe('PostSlug', () => {
|
|||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
$filters: {
|
$filters: {
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
removeHtml: (a) => a,
|
removeHtml: a => a,
|
||||||
},
|
},
|
||||||
$route: {
|
$route: {
|
||||||
hash: '',
|
hash: '',
|
||||||
|
|||||||
@ -205,7 +205,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('post.menu.pinnedSuccessfully'))
|
this.$toast.success(this.$t('post.menu.pinnedSuccessfully'))
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
unpinPost(post) {
|
unpinPost(post) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
@ -216,7 +216,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('post.menu.unpinnedSuccessfully'))
|
this.$toast.success(this.$t('post.menu.unpinnedSuccessfully'))
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
toggleNewCommentForm(showNewCommentForm) {
|
toggleNewCommentForm(showNewCommentForm) {
|
||||||
this.showNewCommentForm = showNewCommentForm
|
this.showNewCommentForm = showNewCommentForm
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removePostFromList(deletedPost) {
|
removePostFromList(deletedPost) {
|
||||||
this.post.relatedContributions = this.post.relatedContributions.filter((contribution) => {
|
this.post.relatedContributions = this.post.relatedContributions.filter(contribution => {
|
||||||
return contribution.id !== deletedPost.id
|
return contribution.id !== deletedPost.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import ProfileSlug from './_slug.vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('date', (d) => d)
|
localVue.filter('date', d => d)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
config.stubs['client-only'] = '<span><slot /></span>'
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
config.stubs['v-popover'] = '<span><slot /></span>'
|
||||||
@ -56,8 +56,8 @@ describe('ProfileSlug', () => {
|
|||||||
describe('given an authenticated user', () => {
|
describe('given an authenticated user', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mocks.$filters = {
|
mocks.$filters = {
|
||||||
removeLinks: (c) => c,
|
removeLinks: c => c,
|
||||||
truncate: (a) => a,
|
truncate: a => a,
|
||||||
}
|
}
|
||||||
mocks.$store = {
|
mocks.$store = {
|
||||||
getters: {
|
getters: {
|
||||||
|
|||||||
@ -337,7 +337,7 @@ export default {
|
|||||||
},
|
},
|
||||||
socialMediaLinks() {
|
socialMediaLinks() {
|
||||||
const { socialMedia = [] } = this.user
|
const { socialMedia = [] } = this.user
|
||||||
return socialMedia.map((socialMedia) => {
|
return socialMedia.map(socialMedia => {
|
||||||
const { url } = socialMedia
|
const { url } = socialMedia
|
||||||
const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:/\n?]+)/g)
|
const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:/\n?]+)/g)
|
||||||
const [domain] = matches || []
|
const [domain] = matches || []
|
||||||
@ -364,7 +364,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removePostFromList(deletedPost) {
|
removePostFromList(deletedPost) {
|
||||||
this.posts = this.posts.filter((post) => {
|
this.posts = this.posts.filter(post => {
|
||||||
return post.id !== deletedPost.id
|
return post.id !== deletedPost.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -447,7 +447,7 @@ export default {
|
|||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.profilePagePosts.refetch()
|
this.$apollo.queries.profilePagePosts.refetch()
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
unpinPost(post) {
|
unpinPost(post) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
@ -460,7 +460,7 @@ export default {
|
|||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.profilePagePosts.refetch()
|
this.$apollo.queries.profilePagePosts.refetch()
|
||||||
})
|
})
|
||||||
.catch((error) => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
optimisticFollow({ followedByCurrentUser }) {
|
optimisticFollow({ followedByCurrentUser }) {
|
||||||
/*
|
/*
|
||||||
@ -473,7 +473,7 @@ export default {
|
|||||||
this.user.followedBy = [currentUser, ...this.user.followedBy]
|
this.user.followedBy = [currentUser, ...this.user.followedBy]
|
||||||
} else {
|
} else {
|
||||||
this.user.followedByCount--
|
this.user.followedByCount--
|
||||||
this.user.followedBy = this.user.followedBy.filter((user) => user.id !== currentUser.id)
|
this.user.followedBy = this.user.followedBy.filter(user => user.id !== currentUser.id)
|
||||||
}
|
}
|
||||||
this.user.followedByCurrentUser = followedByCurrentUser
|
this.user.followedByCurrentUser = followedByCurrentUser
|
||||||
},
|
},
|
||||||
|
|||||||
@ -58,7 +58,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
axios.get('/api/providers.json').then((response) => {
|
axios.get('/api/providers.json').then(response => {
|
||||||
this.providers = response.data
|
this.providers = response.data
|
||||||
})
|
})
|
||||||
if (this.currentUser.allowEmbedIframes) this.disabled = this.currentUser.allowEmbedIframes
|
if (this.currentUser.allowEmbedIframes) this.disabled = this.currentUser.allowEmbedIframes
|
||||||
|
|||||||
@ -73,11 +73,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
get: function () {
|
get: function() {
|
||||||
const { name, slug, locationName, about } = this.currentUser
|
const { name, slug, locationName, about } = this.currentUser
|
||||||
return { name, slug, locationName, about }
|
return { name, slug, locationName, about }
|
||||||
},
|
},
|
||||||
set: function (formData) {
|
set: function(formData) {
|
||||||
this.formData = formData
|
this.formData = formData
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -128,7 +128,7 @@ export default {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
const output = []
|
const output = []
|
||||||
res.data.features.forEach((item) => {
|
res.data.features.forEach(item => {
|
||||||
output.push({
|
output.push({
|
||||||
label: item.place_name,
|
label: item.place_name,
|
||||||
value: item.place_name,
|
value: item.place_name,
|
||||||
@ -162,7 +162,7 @@ export default {
|
|||||||
cancelToken: this.axiosSource.token,
|
cancelToken: this.axiosSource.token,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(res => {
|
||||||
this.cities = this.processCityResults(res)
|
this.cities = this.processCityResults(res)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe('EnterNoncePage', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = null
|
wrapper = null
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn(t => t),
|
||||||
$route: {
|
$route: {
|
||||||
query: {},
|
query: {},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -35,11 +35,11 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
form: {
|
form: {
|
||||||
get: function () {
|
get: function() {
|
||||||
const { email = '', nonce = '' } = this.$route.query
|
const { email = '', nonce = '' } = this.$route.query
|
||||||
return { email, nonce }
|
return { email, nonce }
|
||||||
},
|
},
|
||||||
set: function (formData) {
|
set: function(formData) {
|
||||||
this.formData = formData
|
this.formData = formData
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -21,7 +21,7 @@ describe('EmailSettingsIndexPage', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn(t => t),
|
||||||
$toast: {
|
$toast: {
|
||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
|
|||||||
@ -51,11 +51,11 @@ export default {
|
|||||||
currentUser: 'auth/user',
|
currentUser: 'auth/user',
|
||||||
}),
|
}),
|
||||||
form: {
|
form: {
|
||||||
get: function () {
|
get: function() {
|
||||||
const { email } = this.currentUser
|
const { email } = this.currentUser
|
||||||
return { email }
|
return { email }
|
||||||
},
|
},
|
||||||
set: function (formData) {
|
set: function(formData) {
|
||||||
this.formData = formData
|
this.formData = formData
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,7 +27,7 @@ describe('EmailVerifyPage', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn(t => t),
|
||||||
$toast: {
|
$toast: {
|
||||||
success: jest.fn(),
|
success: jest.fn(),
|
||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
|
|||||||
@ -141,7 +141,7 @@ export default {
|
|||||||
},
|
},
|
||||||
update: (store, { data }) => {
|
update: (store, { data }) => {
|
||||||
const socialMedia = this.currentUser.socialMedia.filter(
|
const socialMedia = this.currentUser.socialMedia.filter(
|
||||||
(element) => element.id !== link.id,
|
element => element.id !== link.id,
|
||||||
)
|
)
|
||||||
this.setCurrentUser({
|
this.setCurrentUser({
|
||||||
...this.currentUser,
|
...this.currentUser,
|
||||||
@ -159,7 +159,7 @@ export default {
|
|||||||
const isEditing = !!this.editingLink.id
|
const isEditing = !!this.editingLink.id
|
||||||
const url = this.formData.socialMediaUrl
|
const url = this.formData.socialMediaUrl
|
||||||
|
|
||||||
const duplicateUrl = this.socialMediaLinks.find((link) => link.url === url)
|
const duplicateUrl = this.socialMediaLinks.find(link => link.url === url)
|
||||||
if (duplicateUrl && duplicateUrl.id !== this.editingLink.id) {
|
if (duplicateUrl && duplicateUrl.id !== this.editingLink.id) {
|
||||||
return this.$toast.error(this.$t('settings.social-media.requireUnique'))
|
return this.$toast.error(this.$t('settings.social-media.requireUnique'))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export default ({ $axios, app }) => {
|
export default ({ $axios, app }) => {
|
||||||
$axios.onRequest((config) => {
|
$axios.onRequest(config => {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.log(Object.keys(app))
|
console.log(Object.keys(app))
|
||||||
// add current ui language
|
// add current ui language
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||||||
|
|
||||||
const componentFiles = require.context('../components/_new/generic', true, /Base[a-zA-Z]+\.vue/)
|
const componentFiles = require.context('../components/_new/generic', true, /Base[a-zA-Z]+\.vue/)
|
||||||
|
|
||||||
componentFiles.keys().forEach((fileName) => {
|
componentFiles.keys().forEach(fileName => {
|
||||||
const component = componentFiles(fileName)
|
const component = componentFiles(fileName)
|
||||||
const componentConfig = component.default || component
|
const componentConfig = component.default || component
|
||||||
const componentName = component.name || fileName.replace(/^.+\//, '').replace('.vue', '')
|
const componentName = component.name || fileName.replace(/^.+\//, '').replace('.vue', '')
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
const debug = app.$env && app.$env.NODE_ENV !== 'production'
|
const debug = app.$env && app.$env.NODE_ENV !== 'production'
|
||||||
const key = 'locale'
|
const key = 'locale'
|
||||||
|
|
||||||
const changeHandler = async (mutation) => {
|
const changeHandler = async mutation => {
|
||||||
if (process.server) return
|
if (process.server) return
|
||||||
|
|
||||||
const newLocale = mutation.payload.locale
|
const newLocale = mutation.payload.locale
|
||||||
@ -24,7 +24,7 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
|
|
||||||
app.$cookies.set(key, newLocale)
|
app.$cookies.set(key, newLocale)
|
||||||
if (!app.$i18n.localeExists(newLocale)) {
|
if (!app.$i18n.localeExists(newLocale)) {
|
||||||
import(`~/locales/${newLocale}.json`).then((res) => {
|
import(`~/locales/${newLocale}.json`).then(res => {
|
||||||
app.$i18n.add(newLocale, res.default)
|
app.$i18n.add(newLocale, res.default)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
Vue.use(vuexI18n.plugin, store, {
|
Vue.use(vuexI18n.plugin, store, {
|
||||||
onTranslationNotFound: function (locale, key) {
|
onTranslationNotFound: function(locale, key) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.warn(`vuex-i18n :: Key '${key}' not found for locale '${locale}'`)
|
console.warn(`vuex-i18n :: Key '${key}' not found for locale '${locale}'`)
|
||||||
@ -77,7 +77,7 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const availableLocales = locales.filter((lang) => !!lang.enabled)
|
const availableLocales = locales.filter(lang => !!lang.enabled)
|
||||||
const locale = find(availableLocales, ['code', userLocale]) ? userLocale : 'en'
|
const locale = find(availableLocales, ['code', userLocale]) ? userLocale : 'en'
|
||||||
|
|
||||||
if (locale !== 'en') {
|
if (locale !== 'en') {
|
||||||
@ -89,7 +89,7 @@ export default ({ app, req, cookie, store }) => {
|
|||||||
Vue.i18n.fallback('en')
|
Vue.i18n.fallback('en')
|
||||||
|
|
||||||
if (process.browser) {
|
if (process.browser) {
|
||||||
store.subscribe((mutation) => {
|
store.subscribe(mutation => {
|
||||||
if (mutation.type === 'i18n/SET_LOCALE') {
|
if (mutation.type === 'i18n/SET_LOCALE') {
|
||||||
changeHandler(mutation)
|
changeHandler(mutation)
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user