test review

This commit is contained in:
ogerly 2019-12-04 11:20:27 +01:00
parent fd3accd147
commit 6ce797e8ef
10 changed files with 65 additions and 47 deletions

View File

@ -45,5 +45,5 @@ module.exports = {
default: () => new Date().toISOString(), default: () => new Date().toISOString(),
}, },
language: { type: 'string', allow: [null] }, language: { type: 'string', allow: [null] },
checkedBlur: { type: 'boolean', default: false }, blurImage: { type: 'boolean', default: false },
} }

View File

@ -304,7 +304,7 @@ export default {
'language', 'language',
'pinnedAt', 'pinnedAt',
'pinned', 'pinned',
'checkedBlur', 'blurImage',
], ],
hasMany: { hasMany: {
tags: '-[:TAGGED]->(related:Tag)', tags: '-[:TAGGED]->(related:Tag)',

View File

@ -82,7 +82,7 @@ input _PostFilter {
emotions_none: _PostEMOTEDFilter emotions_none: _PostEMOTEDFilter
emotions_single: _PostEMOTEDFilter emotions_single: _PostEMOTEDFilter
emotions_every: _PostEMOTEDFilter emotions_every: _PostEMOTEDFilter
checkedBlur: Boolean blurImage: Boolean
} }
enum _PostOrdering { enum _PostOrdering {
@ -128,7 +128,7 @@ type Post {
createdAt: String createdAt: String
updatedAt: String updatedAt: String
language: String language: String
checkedBlur: Boolean blurImage: Boolean
pinnedAt: String @cypher( pinnedAt: String @cypher(
statement: "MATCH (this)<-[pinned:PINNED]-(:User) WHERE NOT this.deleted = true AND NOT this.disabled = true RETURN pinned.createdAt" statement: "MATCH (this)<-[pinned:PINNED]-(:User) WHERE NOT this.deleted = true AND NOT this.disabled = true RETURN pinned.createdAt"
) )
@ -184,7 +184,7 @@ type Mutation {
language: String language: String
categoryIds: [ID] categoryIds: [ID]
contentExcerpt: String contentExcerpt: String
checkedBlur: Boolean blurImage: Boolean
): Post ): Post
UpdatePost( UpdatePost(
id: ID! id: ID!
@ -197,7 +197,7 @@ type Mutation {
visibility: Visibility visibility: Visibility
language: String language: String
categoryIds: [ID] categoryIds: [ID]
checkedBlur: Boolean blurImage: Boolean
): Post ): Post
DeletePost(id: ID!): Post DeletePost(id: ID!): Post
AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED
@ -218,7 +218,7 @@ type Query {
createdAt: String createdAt: String
updatedAt: String updatedAt: String
language: String language: String
checkedBlur: Boolean blurImage: Boolean
first: Int first: Int
offset: Int offset: Int
orderBy: [_PostOrdering] orderBy: [_PostOrdering]

View File

@ -352,7 +352,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
language: sample(languages), language: sample(languages),
image: faker.image.unsplash.food(), image: faker.image.unsplash.food(),
categoryIds: ['cat16'], categoryIds: ['cat16'],
checkedBlur: true, blurImage: true,
}), }),
factory.create('Post', { factory.create('Post', {
author: bobDerBaumeister, author: bobDerBaumeister,
@ -360,28 +360,28 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
language: sample(languages), language: sample(languages),
image: faker.image.unsplash.technology(), image: faker.image.unsplash.technology(),
categoryIds: ['cat1'], categoryIds: ['cat1'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: huey, author: huey,
id: 'p3', id: 'p3',
language: sample(languages), language: sample(languages),
categoryIds: ['cat3'], categoryIds: ['cat3'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: dewey, author: dewey,
id: 'p4', id: 'p4',
language: sample(languages), language: sample(languages),
categoryIds: ['cat4'], categoryIds: ['cat4'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: louie, author: louie,
id: 'p5', id: 'p5',
language: sample(languages), language: sample(languages),
categoryIds: ['cat5'], categoryIds: ['cat5'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
authorId: 'u1', authorId: 'u1',
@ -389,20 +389,20 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
language: sample(languages), language: sample(languages),
image: faker.image.unsplash.buildings(), image: faker.image.unsplash.buildings(),
categoryIds: ['cat6'], categoryIds: ['cat6'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: huey, author: huey,
id: 'p9', id: 'p9',
language: sample(languages), language: sample(languages),
categoryIds: ['cat9'], categoryIds: ['cat9'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: dewey, author: dewey,
id: 'p10', id: 'p10',
categoryIds: ['cat10'], categoryIds: ['cat10'],
checkedBlur: true, blurImage: true,
}), }),
factory.create('Post', { factory.create('Post', {
author: louie, author: louie,
@ -410,14 +410,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
language: sample(languages), language: sample(languages),
image: faker.image.unsplash.people(), image: faker.image.unsplash.people(),
categoryIds: ['cat11'], categoryIds: ['cat11'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: bobDerBaumeister, author: bobDerBaumeister,
id: 'p13', id: 'p13',
language: sample(languages), language: sample(languages),
categoryIds: ['cat13'], categoryIds: ['cat13'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: jennyRostock, author: jennyRostock,
@ -425,14 +425,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
language: sample(languages), language: sample(languages),
image: faker.image.unsplash.objects(), image: faker.image.unsplash.objects(),
categoryIds: ['cat14'], categoryIds: ['cat14'],
checkedBlur: false, blurImage: false,
}), }),
factory.create('Post', { factory.create('Post', {
author: huey, author: huey,
id: 'p15', id: 'p15',
language: sample(languages), language: sample(languages),
categoryIds: ['cat15'], categoryIds: ['cat15'],
checkedBlur: false, blurImage: false,
}), }),
]) ])
@ -451,14 +451,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
$title: String! $title: String!
$content: String! $content: String!
$categoryIds: [ID] $categoryIds: [ID]
$checkedBlur: Boolean $blurImage: Boolean
) { ) {
CreatePost( CreatePost(
id: $id id: $id
title: $title title: $title
content: $content content: $content
categoryIds: $categoryIds categoryIds: $categoryIds
checkedBlur: $checkedBlur blurImage: $blurImage
) { ) {
id id
} }
@ -473,7 +473,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
title: `Nature Philosophy Yoga`, title: `Nature Philosophy Yoga`,
content: hashtag1, content: hashtag1,
categoryIds: ['cat2'], categoryIds: ['cat2'],
checkedBlur: false, blurImage: false,
}, },
}), }),
mutate({ mutate({
@ -483,7 +483,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
title: 'This is post #7', title: 'This is post #7',
content: `${mention1} ${faker.lorem.paragraph()}`, content: `${mention1} ${faker.lorem.paragraph()}`,
categoryIds: ['cat7'], categoryIds: ['cat7'],
checkedBlur: false, blurImage: false,
}, },
}), }),
mutate({ mutate({
@ -494,7 +494,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
title: `Quantum Flow Theory explains Quantum Gravity`, title: `Quantum Flow Theory explains Quantum Gravity`,
content: hashtagAndMention1, content: hashtagAndMention1,
categoryIds: ['cat8'], categoryIds: ['cat8'],
checkedBlur: false, blurImage: false,
}, },
}), }),
mutate({ mutate({
@ -504,7 +504,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
title: 'This is post #12', title: 'This is post #12',
content: `${mention2} ${faker.lorem.paragraph()}`, content: `${mention2} ${faker.lorem.paragraph()}`,
categoryIds: ['cat12'], categoryIds: ['cat12'],
checkedBlur: false, blurImage: false,
}, },
}), }),
]) ])

View File

@ -199,7 +199,7 @@ describe('ContributionForm.vue', () => {
categoryIds: ['cat12'], categoryIds: ['cat12'],
imageUpload: null, imageUpload: null,
image: null, image: null,
checkedBlur: false, blurImage: false,
}, },
} }
postTitleInput = wrapper.find('.ds-input') postTitleInput = wrapper.find('.ds-input')
@ -244,8 +244,10 @@ describe('ContributionForm.vue', () => {
describe('questionable images should be blurred', () => { describe('questionable images should be blurred', () => {
it('questionable images unset be blurred', async () => { it('questionable images unset be blurred', async () => {
await wrapper.find('input[type="checkbox"]').trigger('click') await wrapper.find('input[type="checkbox"]').trigger('click')
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true)
expect(wrapper.find('img.img-blur-in').exists()).toBe(true)
}) })
}) })

View File

@ -40,11 +40,12 @@
<ds-text align="right"> <ds-text align="right">
<label for="blur_img">{{ $t('contribution.shockingPicture') }}</label> <label for="blur_img">{{ $t('contribution.shockingPicture') }}</label>
<input <input
name="checkedBlur" name="blurImage"
class="blurImageCheckbox"
type="checkbox" type="checkbox"
id="blur_img" id="blur_img"
:checked="checkedBlur" :checked="checkedBlur"
@change="checkedChange" @change="(checkedBlur = !checkedBlur), (form.checkbox = !checkedBlur)"
/> />
<label for="blur_img"><span class=""></span></label> <label for="blur_img"><span class=""></span></label>
@ -190,7 +191,7 @@ export default {
? languageOptions.find(o => this.contribution.language === o.value) ? languageOptions.find(o => this.contribution.language === o.value)
: null : null
form.categoryIds = this.categoryIds(this.contribution.categories) form.categoryIds = this.categoryIds(this.contribution.categories)
form.checkbox = this.contribution.checkedBlur form.checkbox = this.contribution.blurImage
} }
return { return {
@ -225,7 +226,7 @@ export default {
}, },
created() {}, created() {},
mounted() { mounted() {
if (this.contribution && this.contribution.checkedBlur === true) { if (this.contribution && this.contribution.blurImage === true) {
this.checkedChange() this.checkedChange()
this.$el.querySelector('.hc-attachments-upload-area-post img').classList.add('img-blur-in') this.$el.querySelector('.hc-attachments-upload-area-post img').classList.add('img-blur-in')
} }
@ -246,15 +247,19 @@ export default {
}, },
checkedChange() { checkedChange() {
if (this.$el) { if (this.$el) {
console.log(this.$el.querySelector('.crop-overlay'))
console.log(document.querySelector('.crop-overlay'))
this.elem = this.$el.querySelector('img') this.elem = this.$el.querySelector('img')
} else { } else {
} }
if (this.checkedBlur) { if (this.checkedBlur) {
this.elem.classList.remove('img-blur-in') this.elem.classList.remove('img-blur-in')
document.querySelector('.crop-overlay').classList.remove('images-set-blur')
this.checkedBlur = false this.checkedBlur = false
this.form.checkbox = false this.form.checkbox = false
} else { } else {
if (this.elem != null) { if (this.elem != null) {
this.elem.classList.add('img-blur-in') this.elem.classList.add('img-blur-in')
} }
this.checkedBlur = true this.checkedBlur = true
@ -282,7 +287,7 @@ export default {
language, language,
image, image,
imageUpload: teaserImage, imageUpload: teaserImage,
checkedBlur: this.form.checkbox, blurImage: this.form.checkbox,
}, },
}) })
.then(({ data }) => { .then(({ data }) => {
@ -357,7 +362,18 @@ export default {
-o-transition: all ease 0.2s; -o-transition: all ease 0.2s;
transition: all ease 0.2s; transition: all ease 0.2s;
} }
.images-set-blur img{
-webkit-filter: blur(32px);
-moz-filter: blur(32px);
-ms-filter: blur(32px);
-o-filter: blur(32px);
filter: blur(32px);
-webkit-transition: all ease 0.2s;
-moz-transition: all ease 0.2s;
-ms-transition: all ease 0.2s;
-o-transition: all ease 0.2s;
transition: all ease 0.2s;
}
.blurBox { .blurBox {
text-align: right; text-align: right;
position: relative; position: relative;

View File

@ -6,7 +6,7 @@
'post-card': true, 'post-card': true,
'disabled-content': post.disabled, 'disabled-content': post.disabled,
'post--pinned': isPinned, 'post--pinned': isPinned,
'images-set-blur': post.checkedBlur, 'images-set-blur': post.blurImage,
}" }"
> >
<!-- Post Link Target --> <!-- Post Link Target -->

View File

@ -46,7 +46,7 @@ export const postFragment = lang => gql`
slug slug
image image
language language
checkedBlur blurImage
author { author {
...user ...user
} }

View File

@ -9,7 +9,7 @@ export default () => {
$language: String $language: String
$categoryIds: [ID] $categoryIds: [ID]
$imageUpload: Upload $imageUpload: Upload
$checkedBlur: Boolean $blurImage: Boolean
) { ) {
CreatePost( CreatePost(
title: $title title: $title
@ -17,14 +17,14 @@ export default () => {
language: $language language: $language
categoryIds: $categoryIds categoryIds: $categoryIds
imageUpload: $imageUpload imageUpload: $imageUpload
checkedBlur: $checkedBlur blurImage: $blurImage
) { ) {
title title
slug slug
content content
contentExcerpt contentExcerpt
language language
checkedBlur blurImage
} }
} }
`, `,
@ -37,7 +37,7 @@ export default () => {
$imageUpload: Upload $imageUpload: Upload
$categoryIds: [ID] $categoryIds: [ID]
$image: String $image: String
$checkedBlur: Boolean $blurImage: Boolean
) { ) {
UpdatePost( UpdatePost(
id: $id id: $id
@ -47,7 +47,7 @@ export default () => {
imageUpload: $imageUpload imageUpload: $imageUpload
categoryIds: $categoryIds categoryIds: $categoryIds
image: $image image: $image
checkedBlur: $checkedBlur blurImage: $blurImage
) { ) {
id id
title title
@ -55,7 +55,7 @@ export default () => {
content content
contentExcerpt contentExcerpt
language language
checkedBlur blurImage
pinnedBy { pinnedBy {
id id
name name

View File

@ -7,12 +7,12 @@
:class="{ :class="{
'post-card': true, 'post-card': true,
'disabled-content': post.disabled, 'disabled-content': post.disabled,
'images-set-blur': post.checkedBlur, 'images-set-blur': post.blurImage,
}" }"
> >
<ds-text align="right" class="blurBox"> <ds-text align="right" class="blurBox">
<ds-button <ds-button
v-show="post.checkedBlur" v-show="post.blurImage"
class="bluricon-post" class="bluricon-post"
icon="eye" icon="eye"
primary primary
@ -26,7 +26,7 @@
@click.prevent="Blur" @click.prevent="Blur"
></ds-button> ></ds-button>
<img <img
v-show="post.checkedBlur" v-show="post.blurImage"
:src="post.image | proxyApiUrl" :src="post.image | proxyApiUrl"
class="blurImgPreview" class="blurImgPreview"
@click.prevent="unBlur" @click.prevent="unBlur"
@ -178,14 +178,14 @@ export default {
}, },
methods: { methods: {
unBlur() { unBlur() {
if (this.post.checkedBlur) { if (this.post.blurImage) {
this.post.checkedBlur = false this.post.blurImage = false
this.blur = true this.blur = true
} }
}, },
Blur() { Blur() {
if (!this.post.checkedBlur) { if (!this.post.blurImage) {
this.post.checkedBlur = true this.post.blurImage = true
this.blur = false this.blur = false
} }
}, },