Lint fixes

This commit is contained in:
Wolfgang Huß 2019-05-27 12:39:37 +02:00
parent 68980f85c6
commit f9fe4f742f
11 changed files with 163 additions and 167 deletions

View File

@ -84,7 +84,7 @@ export default {
`
await this.$apollo.mutate({
mutation: gqlMutation,
variables: { id: this.comment.id }
variables: { id: this.comment.id },
})
this.$toast.success(this.$t(`delete.comment.success`))
this.$emit('deleteComment')
@ -92,6 +92,6 @@ export default {
this.$toast.error(err.message)
}
},
}
},
}
</script>

View File

@ -59,7 +59,7 @@ export default {
required: true,
validator: value => {
return value.match(/(contribution|comment|organization|user)/)
}
},
},
callbacks: { type: Object, required: true },
},
@ -101,7 +101,7 @@ export default {
callback: () => {
this.openModal('delete')
},
icon: 'trash'
icon: 'trash',
})
}
@ -153,8 +153,8 @@ export default {
data: {
type: this.resourceType,
resource: this.resource,
callbacks: this.callbacks
}
callbacks: this.callbacks,
},
})
},
},

View File

@ -24,7 +24,7 @@ describe('DeleteModal.vue', () => {
id: 'p23',
callbacks: {
confirm: () => Post.methods.deletePostCallback('list'),
cancel: null
cancel: null,
},
}
mocks = {
@ -65,7 +65,7 @@ describe('DeleteModal.vue', () => {
name: 'It is a post',
callbacks: {
confirm: () => Post.methods.deletePostCallback('list'),
cancel: null
cancel: null,
},
}
})
@ -73,9 +73,7 @@ describe('DeleteModal.vue', () => {
it('mentions post title', () => {
Wrapper()
const calls = mocks.$t.mock.calls
const expected = [
['delete.contribution.message', { name: 'It is a post' }]
]
const expected = [['delete.contribution.message', { name: 'It is a post' }]]
expect(calls).toEqual(expect.arrayContaining(expected))
})
})
@ -88,17 +86,15 @@ describe('DeleteModal.vue', () => {
name: 'It is the user of the comment',
callbacks: {
confirm: () => Post.methods.deletePostCallback('list'),
cancel: null
}
cancel: null,
},
}
})
it('mentions comments user name', () => {
Wrapper()
const calls = mocks.$t.mock.calls
const expected = [
['delete.comment.message', { name: 'It is the user of the comment' }]
]
const expected = [['delete.comment.message', { name: 'It is the user of the comment' }]]
expect(calls).toEqual(expect.arrayContaining(expected))
})
})
@ -122,7 +118,7 @@ describe('DeleteModal.vue', () => {
id: 'p23',
callbacks: {
confirm: () => Post.methods.deletePostCallback('list'),
cancel: null
cancel: null,
},
}
wrapper = Wrapper()
@ -195,8 +191,8 @@ describe('DeleteModal.vue', () => {
id: 'c3',
callbacks: {
confirm: () => Post.methods.deletePostCallback('list'),
cancel: null
}
cancel: null,
},
}
wrapper = Wrapper()
})

View File

@ -74,7 +74,7 @@ export default {
},
methods: {
async cancel() {
if (!!this.callbacks.cancel) {
if (this.callbacks.cancel) {
await this.callbacks.cancel()
}
this.isOpen = false
@ -85,7 +85,7 @@ export default {
async confirm() {
this.loading = true
try {
if (!!this.callbacks.confirm) {
if (this.callbacks.confirm) {
await this.callbacks.confirm()
}
this.success = true

View File

@ -55,7 +55,7 @@ export default {
},
methods: {
async cancel() {
if (!!this.callbacks.cancel) {
if (this.callbacks.cancel) {
await this.callbacks.cancel()
}
this.isOpen = false
@ -65,7 +65,7 @@ export default {
},
async confirm() {
try {
if (!!this.callbacks.confirm) {
if (this.callbacks.confirm) {
await this.callbacks.confirm()
}
await this.$apollo.mutate({

View File

@ -74,7 +74,7 @@ export default {
},
methods: {
async cancel() {
if (!!this.callbacks.cancel) {
if (this.callbacks.cancel) {
await this.callbacks.cancel()
}
this.isOpen = false
@ -85,7 +85,7 @@ export default {
async confirm() {
this.loading = true
try {
if (!!this.callbacks.confirm) {
if (this.callbacks.confirm) {
await this.callbacks.confirm()
}
await this.$apollo.mutate({

View File

@ -102,7 +102,7 @@ export default {
},
width: {
type: Object,
default: () => {}
default: () => {},
},
},
computed: {

View File

@ -14,7 +14,7 @@ export default {
`
await this.$apollo.mutate({
mutation: gqlMutation,
variables: { id: this.post.id }
variables: { id: this.post.id },
})
this.$toast.success(this.$t(`delete.contribution.success`))
switch (postDisplayType) {
@ -30,6 +30,6 @@ export default {
} catch (err) {
this.$toast.error(err.message)
}
}
}
},
},
}

View File

@ -2,7 +2,7 @@ import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import Methods from '~/mixins/PostMutationHelpers'
const {
methods: { deletePostCallback }
methods: { deletePostCallback },
} = Methods
// console.log(deletePostCallback())
@ -12,26 +12,26 @@ describe('PostMutationHelpers.js', () => {
beforeEach(() => {
post = {
id: 'p23'
id: 'p23',
}
mocks = {
$t: jest.fn(),
$filters: {
truncate: a => a
truncate: a => a,
},
$emit: jest.fn(),
$router: {
history: {
push: jest.fn()
}
push: jest.fn(),
},
},
$toast: {
success: () => {},
error: () => {}
error: () => {},
},
$apollo: {
mutate: jest.fn().mockResolvedValue()
}
mutate: jest.fn().mockResolvedValue(),
},
}
})

View File

@ -76,7 +76,7 @@ export default {
methods: {
deletePost(index) {
this.post.relatedContributions.splice(index, 1)
}
},
},
apollo: {
Post: {

View File

@ -24,7 +24,7 @@ describe('PostSlug', () => {
propsData = {}
mocks = {
post: {
id: 'p23'
id: 'p23',
},
$t: jest.fn(),
// $filters: {
@ -32,11 +32,11 @@ describe('PostSlug', () => {
// },
$toast: {
success: () => {},
error: () => {}
error: () => {},
},
$apollo: {
mutate: jest.fn().mockResolvedValue()
}
mutate: jest.fn().mockResolvedValue(),
},
}
})