From f7aeb3c61673a706fcc1b82af96630b0c6403d1e Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 25 Nov 2019 11:23:57 +0100 Subject: [PATCH 001/290] added checkbox for blure Images in contribution form --- .../ContributionForm/ContributionForm.spec.js | 8 ++ .../ContributionForm/ContributionForm.vue | 69 ++++++++++++++++++ .../checkbox-set-blank-checked-line.png | Bin 0 -> 1742 bytes 3 files changed, 77 insertions(+) create mode 100644 webapp/static/img/checkbox/checkbox-set-blank-checked-line.png diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 52f77b3f2..185e9ad56 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -245,6 +245,14 @@ describe('ContributionForm.vue', () => { expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) }) + describe('questionable images should be blurred', () => { + + it('questionable images unset be blurred', async () => { + await wrapper.find('input[type="checkbox"]').trigger('click') + expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) + }) + }) + it("pushes the user to the post's page", async () => { wrapper.find('form').trigger('submit') await mocks.$apollo.mutate diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 734e3be81..aa74b498c 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -79,6 +79,28 @@ + + + + +
+ + + Bilder werden Verschwommen dargestellt + + + +
+
+
diff --git a/webapp/static/img/checkbox/checkbox-set-blank-checked-line.png b/webapp/static/img/checkbox/checkbox-set-blank-checked-line.png new file mode 100644 index 0000000000000000000000000000000000000000..5411a44368d8dd45fc4fc6efb4883ac0a058f96a GIT binary patch literal 1742 zcmeHG`)kc%7=LDEtc>4?c0`HNEPGp0b{fVk9GaCa*Ra?9(jm98<<{Dw!-Ss3Bz`cL z9l6%TC_lJ7R@iYlcA+rRvBb{YAD{R87x>8!^49tGea`bdpXc-WJny$+dLXw~a{pu^ z>XkPsC!Z)`CEm~WNW^nWc55G^M4CROU;;uSLu84VNQl%$#*ndOn2eB7m$ZhgCCg-m zth!n@#Fm(eg;-sy7!pguBtoJH(&qi!rBYmH@N z#aMMLkYsC^4U1uQq);o?2pbV23XW(sYK^i{F^Z{R4KR=fOVC0NgMkfbV4+!^AQ$7X zwPLM0eHe>~*|JzxCl@S`6t*H(6zV|=wN}}xScN?J0h;KB9ncRFPzcrl18J~CDR^Ko zumKG$bBX^L^tdJCkTc@ zum%`NqZ72i1A~DLXmu-c)kq`8QEUuGLLbH=5>>ZAZ~cyiw^6rGZ%K}n=et|4XQkul zx#PC&33ik{4Q}}!EvLYn1ZZ3bYzgK;lQ+t{iGTf3ym?D1J`P%!AD96e|K#~oQwQAP zWvK1BW>V2wqLf?imvCTs$^fEnOY(BY7Hm8mi;fLE&!+4L%|p9BZrw7lt^9pc#j(uF zgpw1#Mtp0n+}M3*>ELR98K2l550`DzyT{`hE%WZ*`@Xx_-|xu5j?!WC3YVuRWp;Eu z|Lk8_pSq{@weQ^Hn$<~1n>y19{be7QuB)%jdQnv3@AouPG!AX6e}(nx%JGZCSR~F zem*VI-Znh-Qu*N@E2f1y->fRCjqkm%p(^)7s5)L9-O=bD@}#+|rL;0SzEP)U#JYZ> z?Rq?;<1$_r^geenwz^^Nm4=_ARxBR%=yc1o`#0Y{m~|uMYp=>p3Y7(Xy{DxenVj;h zvH8%c-9A{u_Uxgg*cP literal 0 HcmV?d00001 From 7f3f81822ee563f981034e5d85518d1157320655 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 28 Nov 2019 20:40:35 +0100 Subject: [PATCH 002/290] blur the image ok. --- backend/src/models/Post.js | 1 + backend/src/schema/resolvers/posts.js | 10 +- backend/src/schema/types/type/Post.gql | 6 +- backend/src/seed/seed-db.js | 32 ++++- .../ContributionForm/ContributionForm.spec.js | 5 +- .../ContributionForm/ContributionForm.vue | 111 +++++++++++------- webapp/components/PostCard/PostCard.vue | 40 ++++++- webapp/components/TeaserImage/TeaserImage.vue | 2 + webapp/graphql/Fragments.js | 1 + webapp/graphql/PostMutations.js | 6 + webapp/locales/de.json | 6 +- webapp/locales/en.json | 4 +- 12 files changed, 168 insertions(+), 56 deletions(-) diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js index 5ac8378c2..2d2a164db 100644 --- a/backend/src/models/Post.js +++ b/backend/src/models/Post.js @@ -45,4 +45,5 @@ module.exports = { default: () => new Date().toISOString(), }, language: { type: 'string', allow: [null] }, + checkedBlur: { type: 'boolean', default: false }, } diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index ee6a82d42..44558be4d 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -297,7 +297,15 @@ export default { }, Post: { ...Resolver('Post', { - undefinedToNull: ['activityId', 'objectId', 'image', 'language', 'pinnedAt', 'pinned'], + undefinedToNull: [ + 'activityId', + 'objectId', + 'image', + 'language', + 'pinnedAt', + 'pinned', + 'checkedBlur', + ], hasMany: { tags: '-[:TAGGED]->(related:Tag)', categories: '-[:CATEGORIZED]->(related:Category)', diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index b29ac5386..f24018567 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -82,6 +82,7 @@ input _PostFilter { emotions_none: _PostEMOTEDFilter emotions_single: _PostEMOTEDFilter emotions_every: _PostEMOTEDFilter + checkedBlur: Boolean } enum _PostOrdering { @@ -127,6 +128,7 @@ type Post { createdAt: String updatedAt: String language: String + checkedBlur: Boolean pinnedAt: String @cypher( statement: "MATCH (this)<-[pinned:PINNED]-(:User) WHERE NOT this.deleted = true AND NOT this.disabled = true RETURN pinned.createdAt" ) @@ -140,7 +142,6 @@ type Post { LIMIT 10 """ ) - tags: [Tag]! @relation(name: "TAGGED", direction: "OUT") categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT") @@ -183,6 +184,7 @@ type Mutation { language: String categoryIds: [ID] contentExcerpt: String + checkedBlur: Boolean ): Post UpdatePost( id: ID! @@ -195,6 +197,7 @@ type Mutation { visibility: Visibility language: String categoryIds: [ID] + checkedBlur: Boolean ): Post DeletePost(id: ID!): Post AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED @@ -215,6 +218,7 @@ type Query { createdAt: String updatedAt: String language: String + checkedBlur: Boolean first: Int offset: Int orderBy: [_PostOrdering] diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 692d95542..1fd819a87 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -352,6 +352,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.food(), categoryIds: ['cat16'], + checkedBlur: true, }), factory.create('Post', { author: bobDerBaumeister, @@ -359,24 +360,28 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.technology(), categoryIds: ['cat1'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p3', language: sample(languages), categoryIds: ['cat3'], + checkedBlur: false, }), factory.create('Post', { author: dewey, id: 'p4', language: sample(languages), categoryIds: ['cat4'], + checkedBlur: false, }), factory.create('Post', { author: louie, id: 'p5', language: sample(languages), categoryIds: ['cat5'], + checkedBlur: false, }), factory.create('Post', { authorId: 'u1', @@ -384,17 +389,20 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.buildings(), categoryIds: ['cat6'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p9', language: sample(languages), categoryIds: ['cat9'], + checkedBlur: false, }), factory.create('Post', { author: dewey, id: 'p10', categoryIds: ['cat10'], + checkedBlur: true, }), factory.create('Post', { author: louie, @@ -402,12 +410,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.people(), categoryIds: ['cat11'], + checkedBlur: false, }), factory.create('Post', { author: bobDerBaumeister, id: 'p13', language: sample(languages), categoryIds: ['cat13'], + checkedBlur: false, }), factory.create('Post', { author: jennyRostock, @@ -415,12 +425,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.objects(), categoryIds: ['cat14'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p15', language: sample(languages), categoryIds: ['cat15'], + checkedBlur: false, }), ]) @@ -434,8 +446,20 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] const hashtagAndMention1 = 'The new physics of #QuantenFlussTheorie can explain #QuantumGravity! @peter-lustig got that already. ;-)' const createPostMutation = gql` - mutation($id: ID, $title: String!, $content: String!, $categoryIds: [ID]) { - CreatePost(id: $id, title: $title, content: $content, categoryIds: $categoryIds) { + mutation( + $id: ID + $title: String! + $content: String! + $categoryIds: [ID] + $checkedBlur: Boolean + ) { + CreatePost( + id: $id + title: $title + content: $content + categoryIds: $categoryIds + checkedBlur: $checkedBlur + ) { id } } @@ -449,6 +473,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Nature Philosophy Yoga`, content: hashtag1, categoryIds: ['cat2'], + checkedBlur: false, }, }), mutate({ @@ -458,6 +483,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #7', content: `${mention1} ${faker.lorem.paragraph()}`, categoryIds: ['cat7'], + checkedBlur: false, }, }), mutate({ @@ -468,6 +494,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Quantum Flow Theory explains Quantum Gravity`, content: hashtagAndMention1, categoryIds: ['cat8'], + checkedBlur: false, }, }), mutate({ @@ -477,6 +504,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #12', content: `${mention2} ${faker.lorem.paragraph()}`, categoryIds: ['cat12'], + checkedBlur: false, }, }), ]) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 185e9ad56..603724eca 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -245,10 +245,9 @@ describe('ContributionForm.vue', () => { expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) }) - describe('questionable images should be blurred', () => { - + describe('questionable images should be blurred', () => { 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) }) }) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index aa74b498c..98e515766 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -15,6 +15,27 @@ /> + + + + + + + + @@ -78,28 +99,7 @@ - - - - - - - +
this.contribution.language === o.value) : null form.categoryIds = this.categoryIds(this.contribution.categories) + form.checkedBlur = this.contribution.checkedBlur + + // console.log(this.contribution.checkedBlur) + // console.log(this.contribution) } + return { form, formSchema: { @@ -186,6 +193,7 @@ export default { }, }, language: { required: true }, + checkedBlur: { required: false }, }, languageOptions, id, @@ -194,9 +202,13 @@ export default { users: [], contentMin: 3, hashtags: [], - checkedBlur: false, elem: null, - elem1: null, + checkedBlur: false, + } + }, + created() { + if (this.contribution && this.contribution.checkedBlur) { + this.checkedChange() } }, computed: { @@ -209,21 +221,29 @@ export default { }, methods: { checkedChange() { - this.elem = this.$el.querySelector('img') - this.elem1 = this.$el.querySelector('img.thumbnail-preview') + // console.log( 'checkedChange') + // console.log( 'this.checkedBlur old', this.checkedBlur) + // console.log( 'THIS', this.$el) + // console.log( 'THIS.form', this.form) + + if (this.$el) { + this.elem = this.$el.querySelector('img') + } else { + } if (this.checkedBlur) { this.elem.classList.remove('img-blur-in') this.checkedBlur = false + this.form.checkedBlur = false + this.form.checkbox = false } else { if (this.elem != null) { - this.elem.classList.add('img-blur-in') + this.elem.classList.add('img-blur-in') } - if (this.elem1 != null) { - this.elem1.classList.add('img-blur-in') - } - this.checkedBlur = true + this.form.checkedBlur = true + this.form.checkbox = true } + // console.log( 'this.checkedBlur new', this.checkedBlur) }, submit() { const { @@ -246,6 +266,7 @@ export default { language, image, imageUpload: teaserImage, + checkedBlur: this.form.checkbox, }, }) .then(({ data }) => { @@ -307,6 +328,21 @@ export default { } + + diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostCard/PostCard.vue index e65e17102..78f9f9e95 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostCard/PostCard.vue @@ -2,8 +2,17 @@ + + + + + + diff --git a/webapp/pages/moderation/images.vue b/webapp/pages/moderation/images.vue deleted file mode 100644 index 86e222f0e..000000000 --- a/webapp/pages/moderation/images.vue +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 769b978b8..7331daf6d 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -12,21 +12,21 @@ > 4?c0`HNEPGp0b{fVk9GaCa*Ra?9(jm98<<{Dw!-Ss3Bz`cL z9l6%TC_lJ7R@iYlcA+rRvBb{YAD{R87x>8!^49tGea`bdpXc-WJny$+dLXw~a{pu^ z>XkPsC!Z)`CEm~WNW^nWc55G^M4CROU;;uSLu84VNQl%$#*ndOn2eB7m$ZhgCCg-m zth!n@#Fm(eg;-sy7!pguBtoJH(&qi!rBYmH@N z#aMMLkYsC^4U1uQq);o?2pbV23XW(sYK^i{F^Z{R4KR=fOVC0NgMkfbV4+!^AQ$7X zwPLM0eHe>~*|JzxCl@S`6t*H(6zV|=wN}}xScN?J0h;KB9ncRFPzcrl18J~CDR^Ko zumKG$bBX^L^tdJCkTc@ zum%`NqZ72i1A~DLXmu-c)kq`8QEUuGLLbH=5>>ZAZ~cyiw^6rGZ%K}n=et|4XQkul zx#PC&33ik{4Q}}!EvLYn1ZZ3bYzgK;lQ+t{iGTf3ym?D1J`P%!AD96e|K#~oQwQAP zWvK1BW>V2wqLf?imvCTs$^fEnOY(BY7Hm8mi;fLE&!+4L%|p9BZrw7lt^9pc#j(uF zgpw1#Mtp0n+}M3*>ELR98K2l550`DzyT{`hE%WZ*`@Xx_-|xu5j?!WC3YVuRWp;Eu z|Lk8_pSq{@weQ^Hn$<~1n>y19{be7QuB)%jdQnv3@AouPG!AX6e}(nx%JGZCSR~F zem*VI-Znh-Qu*N@E2f1y->fRCjqkm%p(^)7s5)L9-O=bD@}#+|rL;0SzEP)U#JYZ> z?Rq?;<1$_r^geenwz^^Nm4=_ARxBR%=yc1o`#0Y{m~|uMYp=>p3Y7(Xy{DxenVj;h zvH8%c-9A{u_Uxgg*cP From 7c26e844637b54f28dee70d1a79d8fb007e590cd Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 4 Dec 2019 15:17:21 +0100 Subject: [PATCH 011/290] rename Blur() to blur() --- webapp/pages/post/_id/_slug/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 7331daf6d..311b95f04 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -23,7 +23,7 @@ class="bluricon-post" icon="eye-slash" primary - @click.prevent="Blur" + @click.prevent="blur" > Date: Wed, 4 Dec 2019 15:23:16 +0100 Subject: [PATCH 012/290] lint fix --- webapp/components/ContributionForm/ContributionForm.spec.js | 1 - webapp/pages/post/_id/_slug/index.vue | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 889995595..53057a771 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -250,7 +250,6 @@ describe('ContributionForm.vue', () => { await wrapper.find('input[type="checkbox"]').trigger('click') expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) expect(wrapper.find('.images-set-blur').exists()).toBe(true) - }) }) diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 311b95f04..e0949498a 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -23,7 +23,7 @@ class="bluricon-post" icon="eye-slash" primary - @click.prevent="blur" + @click.prevent="setBlur" > Date: Fri, 6 Dec 2019 09:16:14 +0100 Subject: [PATCH 013/290] fix and changes revies, fix lint --- .../ContributionForm/ContributionForm.spec.js | 1 - .../ContributionForm/ContributionForm.vue | 37 +++++-------------- webapp/components/PostCard/PostCard.vue | 3 +- webapp/pages/post/_id/_slug/index.vue | 32 ++++++++-------- 4 files changed, 26 insertions(+), 47 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index c8d36459e..c84700106 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -249,7 +249,6 @@ describe('ContributionForm.vue', () => { wrapper.find(TeaserImage).vm.$emit('addTeaserImage', imageUpload) expect(wrapper.find('.images-set-blur').exists()).toBe(false) await wrapper.find('input[type="checkbox"]').trigger('click') - expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) expect(wrapper.find('.images-set-blur').exists()).toBe(true) }) }) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 5d6ff1351..f2ec8327e 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -10,7 +10,7 @@ -
- +
+
@@ -45,8 +38,8 @@ class="blurImageCheckbox" type="checkbox" id="blur_img" - v-model="checkedBlur" - @change="form.checkbox = checkedBlur" + v-model="blurImage" + @change="form.checkbox = blurImage" /> @@ -223,13 +216,13 @@ export default { contentMin: 3, hashtags: [], elem: null, - checkedBlur: false, + blurImage: false, } }, created() {}, mounted() { if (this.contribution && this.contribution.blurImage === true) { - this.checkedBlur = true + this.blurImage = true } }, computed: { @@ -242,8 +235,8 @@ export default { }, methods: { unBlur() { - if (this.checkedBlur) { - this.checkedBlur = false + if (this.blurImage) { + this.blurImage = false } }, submit() { @@ -335,18 +328,6 @@ export default { From 433e7d409a69d13ec1f631dce79843aa77d09f2a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 27 Nov 2019 10:17:39 +0100 Subject: [PATCH 019/290] changed data structure --- webapp/components/SearchInput/SearchInput.story.js | 13 ++++++------- webapp/components/SearchInput/SearchInput.vue | 10 ++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/webapp/components/SearchInput/SearchInput.story.js b/webapp/components/SearchInput/SearchInput.story.js index fbef28f15..c65241b30 100644 --- a/webapp/components/SearchInput/SearchInput.story.js +++ b/webapp/components/SearchInput/SearchInput.story.js @@ -6,10 +6,12 @@ import helpers from '~/storybook/helpers' helpers.init() export const results = [ + { + heading: 'Contributions' + }, { id: 'de100841-2336-4b01-a574-f1bd2c0b262a', searchType: 'Contributions', - firstType: true, slug: 'user-post-by-jenny', label: 'User Post by Jenny', value: 'User Post by Jenny', @@ -24,7 +26,6 @@ export const results = [ { id: 'f48f00a0-c412-432f-8334-4276a4e15d1c', searchType: 'Contributions', - firstType: false, slug: 'eum-quos-est-molestiae-enim-magni-consequuntur-sed-commodi-eos', label: 'Eum quos est molestiae enim magni consequuntur sed commodi eos.', value: 'Eum quos est molestiae enim magni consequuntur sed commodi eos.', @@ -39,7 +40,6 @@ export const results = [ { id: 'p7', searchType: 'Contributions', - firstType: false, slug: 'this-is-post-7', label: 'This is post #7', value: 'This is post #7', @@ -54,7 +54,6 @@ export const results = [ { id: 'p12', searchType: 'Contributions', - firstType: false, slug: 'this-is-post-12', label: 'This is post #12', value: 'This is post #12', @@ -66,9 +65,11 @@ export const results = [ slug: 'louie', }, }, + { + heading: 'Users' + }, { id: 'u1', - firstType: true, searchType: 'Users', name: 'Peter Lustig', label: 'Peter Lustig', @@ -85,7 +86,6 @@ export const results = [ { id: 'u2', searchType: 'Users', - firstType: false, name: 'Bob der Baumeister', label: 'Bob der Baumeister', slug: 'bob-der-baumeister', @@ -93,7 +93,6 @@ export const results = [ { id: '7b654f72-f4da-4315-8bed-39de0859754b', searchType: 'Users', - firstType: false, name: 'Tonya Mohr', label: 'Tonya Mohr', slug: 'tonya-mohr', diff --git a/webapp/components/SearchInput/SearchInput.vue b/webapp/components/SearchInput/SearchInput.vue index 81958d636..0d73485c3 100644 --- a/webapp/components/SearchInput/SearchInput.vue +++ b/webapp/components/SearchInput/SearchInput.vue @@ -37,8 +37,10 @@ @click.capture.native="isOpen = true" > diff --git a/webapp/pages/settings/my-email-address/enter-nonce.vue b/webapp/pages/settings/my-email-address/enter-nonce.vue index 85755953a..b9fd1a291 100644 --- a/webapp/pages/settings/my-email-address/enter-nonce.vue +++ b/webapp/pages/settings/my-email-address/enter-nonce.vue @@ -17,9 +17,9 @@ /> diff --git a/webapp/pages/settings/my-email-address/index.vue b/webapp/pages/settings/my-email-address/index.vue index 8b3889b0d..58cdc7124 100644 --- a/webapp/pages/settings/my-email-address/index.vue +++ b/webapp/pages/settings/my-email-address/index.vue @@ -19,9 +19,9 @@ {{ backendErrors.message }} - + {{ $t('actions.save') }} - + diff --git a/webapp/pages/settings/my-social-media.vue b/webapp/pages/settings/my-social-media.vue index 677c4423d..e19c4fb9a 100644 --- a/webapp/pages/settings/my-social-media.vue +++ b/webapp/pages/settings/my-social-media.vue @@ -24,22 +24,20 @@ {{ link.url }} | - - - - - - + + @@ -54,12 +52,12 @@ :placeholder="$t('settings.social-media.placeholder')" /> - + {{ editingLink.id ? $t('actions.save') : $t('settings.social-media.submit') }} - - + + {{ $t('actions.cancel') }} - + @@ -226,5 +224,10 @@ export default { .ds-list-item-prefix { align-self: center; } + + .ds-list-item-content { + display: flex; + align-items: center; + } } diff --git a/webapp/pages/settings/privacy.vue b/webapp/pages/settings/privacy.vue index 3decdefbe..e1d440b05 100644 --- a/webapp/pages/settings/privacy.vue +++ b/webapp/pages/settings/privacy.vue @@ -4,7 +4,7 @@ - {{ $t('actions.save') }} + {{ $t('actions.save') }} diff --git a/webapp/pages/terms-and-conditions-confirm.vue b/webapp/pages/terms-and-conditions-confirm.vue index 24af8a23d..17695cad5 100644 --- a/webapp/pages/terms-and-conditions-confirm.vue +++ b/webapp/pages/terms-and-conditions-confirm.vue @@ -2,11 +2,11 @@

- + {{ $t(`termsAndConditions.termsAndConditionsNewConfirmText`) }} - +

@@ -17,7 +17,7 @@
From ad274040596ccb7453d14ed73fa94eaab137853e Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 19 Dec 2019 12:48:13 +0530 Subject: [PATCH 089/290] fix failing component tests --- .../CommentForm/CommentForm.spec.js | 6 +++--- webapp/components/CommentForm/CommentForm.vue | 2 +- .../CommentList/CommentList.spec.js | 7 +------ .../components/FilterMenu/FilterMenu.spec.js | 2 +- .../FilterPosts/FilterPosts.spec.js | 10 +++++----- .../NotificationMenu/NotificationMenu.spec.js | 20 +++++++++---------- webapp/pages/settings/my-social-media.spec.js | 8 ++++---- webapp/pages/settings/my-social-media.vue | 2 ++ 8 files changed, 27 insertions(+), 30 deletions(-) diff --git a/webapp/components/CommentForm/CommentForm.spec.js b/webapp/components/CommentForm/CommentForm.spec.js index 47bc01982..5dde84008 100644 --- a/webapp/components/CommentForm/CommentForm.spec.js +++ b/webapp/components/CommentForm/CommentForm.spec.js @@ -74,7 +74,7 @@ describe('CommentForm.vue', () => { it('calls `clear` method when the cancel button is clicked', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(cancelMethodSpy).toHaveBeenCalledTimes(1) }) @@ -162,13 +162,13 @@ describe('CommentForm.vue', () => { describe('cancel button is clicked', () => { it('calls `closeEditWindow` method', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(closeMethodSpy).toHaveBeenCalledTimes(1) }) it('emits `showEditCommentMenu` event', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(wrapper.emitted('showEditCommentMenu')).toEqual([[false]]) }) }) diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 88253065f..d536a0ed2 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -5,7 +5,7 @@
- + {{ $t('actions.cancel') }} diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 0c037d2ff..064b8f136 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -63,12 +63,7 @@ describe('CommentList.vue', () => { it('displays a comments counter', () => { wrapper = Wrapper() - expect(wrapper.find('span.ds-tag').text()).toEqual('1') - }) - - it('displays a comments counter', () => { - wrapper = Wrapper() - expect(wrapper.find('span.ds-tag').text()).toEqual('1') + expect(wrapper.find('.count').text()).toEqual('1') }) describe('scrollToAnchor mixin', () => { diff --git a/webapp/components/FilterMenu/FilterMenu.spec.js b/webapp/components/FilterMenu/FilterMenu.spec.js index 079ef5487..d70af323f 100644 --- a/webapp/components/FilterMenu/FilterMenu.spec.js +++ b/webapp/components/FilterMenu/FilterMenu.spec.js @@ -39,7 +39,7 @@ describe('FilterMenu.vue', () => { describe('click "clear-search-button" button', () => { it('emits clearSearch', () => { - wrapper.find({ name: 'clear-search-button' }).trigger('click') + wrapper.find('[name="clear-search-button"]').trigger('click') expect(wrapper.emitted().clearSearch).toHaveLength(1) }) }) diff --git a/webapp/components/FilterPosts/FilterPosts.spec.js b/webapp/components/FilterPosts/FilterPosts.spec.js index b0d4d8f16..b864a8a46 100644 --- a/webapp/components/FilterPosts/FilterPosts.spec.js +++ b/webapp/components/FilterPosts/FilterPosts.spec.js @@ -92,7 +92,7 @@ describe('FilterPosts.vue', () => { it('starts with all categories button active', () => { const wrapper = openFilterPosts() allCategoriesButton = wrapper.findAll('button').at(1) - expect(allCategoriesButton.attributes().class).toContain('.base-button.--primary') + expect(allCategoriesButton.attributes().class).toContain('--primary') }) it('calls TOGGLE_CATEGORY when clicked', () => { @@ -115,7 +115,7 @@ describe('FilterPosts.vue', () => { getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9']) const wrapper = openFilterPosts() democracyAndPoliticsButton = wrapper.findAll('button').at(4) - expect(democracyAndPoliticsButton.attributes().class).toContain('base-button.--primary') + expect(democracyAndPoliticsButton.attributes().class).toContain('--primary') }) it('sets language button attribute `primary` when corresponding language is filtered', () => { @@ -124,14 +124,14 @@ describe('FilterPosts.vue', () => { spanishButton = wrapper .findAll('button.language-buttons') .at(languages.findIndex(l => l.code === 'es')) - expect(spanishButton.attributes().class).toContain('base-button.--primary') + expect(spanishButton.attributes().class).toContain('--primary') }) it('sets "filter-by-followed-authors-only" button attribute `primary`', () => { getters['posts/filteredByUsersFollowed'] = jest.fn(() => true) const wrapper = openFilterPosts() expect( - wrapper.find({ name: 'filter-by-followed-authors-only' }).classes('base-button.--primary'), + wrapper.find('.base-button[name="filter-by-followed-authors-only"]').classes('--primary'), ).toBe(true) }) @@ -139,7 +139,7 @@ describe('FilterPosts.vue', () => { let wrapper beforeEach(() => { wrapper = openFilterPosts() - wrapper.find({ name: 'filter-by-followed-authors-only' }).trigger('click') + wrapper.find('.base-button[name="filter-by-followed-authors-only"]').trigger('click') }) it('calls TOGGLE_FILTER_BY_FOLLOWED', () => { diff --git a/webapp/components/NotificationMenu/NotificationMenu.spec.js b/webapp/components/NotificationMenu/NotificationMenu.spec.js index 530d202e2..45d109a7e 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.spec.js +++ b/webapp/components/NotificationMenu/NotificationMenu.spec.js @@ -1,4 +1,4 @@ -import { config, shallowMount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import NotificationMenu from './NotificationMenu' const localVue = global.localVue @@ -22,9 +22,9 @@ describe('NotificationMenu.vue', () => { } }) - describe('shallowMount', () => { + describe('mount', () => { const Wrapper = () => { - return shallowMount(NotificationMenu, { + return mount(NotificationMenu, { data, mocks, localVue, @@ -33,7 +33,7 @@ describe('NotificationMenu.vue', () => { it('counter displays 0', () => { wrapper = Wrapper() - expect(wrapper.find('base-button-stub').text()).toEqual('0') + expect(wrapper.find('.count').text()).toEqual('0') }) it('no dropdown is rendered', () => { @@ -67,12 +67,12 @@ describe('NotificationMenu.vue', () => { it('counter displays 0', () => { wrapper = Wrapper() - expect(wrapper.find('base-button-stub').text()).toEqual('0') + expect(wrapper.find('.count').text()).toEqual('0') }) - it('button is not primary', () => { + it('counter is not colored', () => { wrapper = Wrapper() - expect(wrapper.find('base-button-stub').props('primary')).toBe(false) + expect(wrapper.find('.count').classes()).toContain('--inactive') }) }) @@ -130,12 +130,12 @@ describe('NotificationMenu.vue', () => { it('displays the number of unread notifications', () => { wrapper = Wrapper() - expect(wrapper.find('base-button-stub').text()).toEqual('2') + expect(wrapper.find('.count').text()).toEqual('2') }) - it('renders primary button', () => { + it('renders the counter in red', () => { wrapper = Wrapper() - expect(wrapper.find('base-button-stub').props('primary')).toBe(true) + expect(wrapper.find('.count').classes()).toContain('--danger') }) }) }) diff --git a/webapp/pages/settings/my-social-media.spec.js b/webapp/pages/settings/my-social-media.spec.js index b1c9e0649..cf994e397 100644 --- a/webapp/pages/settings/my-social-media.spec.js +++ b/webapp/pages/settings/my-social-media.spec.js @@ -119,11 +119,11 @@ describe('my-social-media.vue', () => { }) it('displays the edit button', () => { - expect(wrapper.find('a[name="edit"]').exists()).toBe(true) + expect(wrapper.find('.base-button[data-test="edit-button"]').exists()).toBe(true) }) it('displays the delete button', () => { - expect(wrapper.find('a[name="delete"]').exists()).toBe(true) + expect(wrapper.find('.base-button[data-test="delete-button"]').exists()).toBe(true) }) }) @@ -138,7 +138,7 @@ describe('my-social-media.vue', () => { describe('editing social media link', () => { beforeEach(() => { - const editButton = wrapper.find('a[name="edit"]') + const editButton = wrapper.find('.base-button[data-test="edit-button"]') editButton.trigger('click') input = wrapper.find('input#editSocialMedia') }) @@ -169,7 +169,7 @@ describe('my-social-media.vue', () => { describe('deleting social media link', () => { beforeEach(() => { - const deleteButton = wrapper.find('a[name="delete"]') + const deleteButton = wrapper.find('.base-button[data-test="delete-button"]') deleteButton.trigger('click') }) diff --git a/webapp/pages/settings/my-social-media.vue b/webapp/pages/settings/my-social-media.vue index e19c4fb9a..d89896cb8 100644 --- a/webapp/pages/settings/my-social-media.vue +++ b/webapp/pages/settings/my-social-media.vue @@ -30,6 +30,7 @@ ghost @click="handleEditSocialMedia(link)" :title="$t('actions.edit')" + data-test="edit-button" /> From 56b1a74e64419e628aae853654f88514c0619ec3 Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 19 Dec 2019 12:53:38 +0530 Subject: [PATCH 090/290] let eslint do some magic --- webapp/components/CommentForm/CommentForm.vue | 7 +++++-- .../components/ContributionForm/ContributionForm.vue | 6 +----- .../FilterPosts/GeneralFilterMenuItems.vue | 6 +----- webapp/components/LoginForm/LoginForm.vue | 8 +------- .../_new/generic/BaseButton/BaseButton.story.js | 4 ++-- .../_new/generic/BaseButton/BaseButton.vue | 9 ++++----- .../_new/generic/CounterIcon/CounterIcon.vue | 2 +- .../_new/generic/LoadingSpinner/LoadingSpinner.vue | 12 ++---------- webapp/nuxt.config.js | 5 +---- webapp/pages/index.vue | 6 +++++- webapp/pages/terms-and-conditions-confirm.vue | 4 +++- webapp/storybook/config.js | 3 ++- 12 files changed, 28 insertions(+), 44 deletions(-) diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index d536a0ed2..9227d1e8b 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -5,7 +5,11 @@
- + {{ $t('actions.cancel') }} @@ -67,7 +71,6 @@ export default { this.$emit('showEditCommentMenu', false) }, handleCancel() { - console.log('handle cancel') if (!this.update) { this.clear() } else { diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index d67af69d9..281f40fd5 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -82,11 +82,7 @@
- + {{ $t('actions.cancel') }} diff --git a/webapp/components/FilterPosts/GeneralFilterMenuItems.vue b/webapp/components/FilterPosts/GeneralFilterMenuItems.vue index cb499c898..c2b7acadd 100644 --- a/webapp/components/FilterPosts/GeneralFilterMenuItems.vue +++ b/webapp/components/FilterPosts/GeneralFilterMenuItems.vue @@ -37,11 +37,7 @@
- + diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index ba635575a..e1eb0c693 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -50,13 +50,7 @@ {{ $t('login.forgotPassword') }} - + {{ $t('login.login') }} diff --git a/webapp/components/_new/generic/BaseButton/BaseButton.story.js b/webapp/components/_new/generic/BaseButton/BaseButton.story.js index 900c7b9a2..1621939c0 100644 --- a/webapp/components/_new/generic/BaseButton/BaseButton.story.js +++ b/webapp/components/_new/generic/BaseButton/BaseButton.story.js @@ -47,7 +47,7 @@ storiesOf('Generic/BaseButton', module) Small S
- ` + `, })) .add('primary', () => ({ @@ -80,5 +80,5 @@ storiesOf('Generic/BaseButton', module)
- ` + `, })) diff --git a/webapp/components/_new/generic/BaseButton/BaseButton.vue b/webapp/components/_new/generic/BaseButton/BaseButton.vue index 1044a30c7..fb69a00c0 100644 --- a/webapp/components/_new/generic/BaseButton/BaseButton.vue +++ b/webapp/components/_new/generic/BaseButton/BaseButton.vue @@ -3,7 +3,7 @@ :type="type" :class="buttonClass" :disabled="loading" - @click.capture="(event) => $emit('click', event)" + @click.capture="event => $emit('click', event)" > @@ -73,8 +73,8 @@ export default { else if (this.size === 'large') buttonClass += ' --large' return buttonClass - } - } + }, + }, } @@ -93,7 +93,7 @@ export default { overflow: hidden; font-weight: $font-weight-bold; cursor: pointer; - transition: background-color .1s; + transition: background-color 0.1s; &:focus { outline: 1px dashed $color-primary; @@ -168,7 +168,6 @@ export default { } &.--large { - } &.--circle { diff --git a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue index 6202f823c..4f2d79a58 100644 --- a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue +++ b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue @@ -45,7 +45,7 @@ export default { border-radius: 50%; transform: translateX(50%); - color:$color-neutral-100; + color: $color-neutral-100; background-color: $color-primary; font-size: 10px; line-height: 1; diff --git a/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue b/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue index 98e7dc200..74e9d91bc 100644 --- a/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue +++ b/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue @@ -1,14 +1,6 @@ diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index f467b78e3..1e368f01a 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -94,10 +94,7 @@ export default { /* ** Global CSS */ - css: [ - '~assets/_new/styles/resets.scss', - '~assets/styles/main.scss', - ], + css: ['~assets/_new/styles/resets.scss', '~assets/styles/main.scss'], /* ** Global processed styles diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index 66d9eebfa..f9223a01b 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -42,7 +42,11 @@ diff --git a/webapp/storybook/config.js b/webapp/storybook/config.js index 60b61d787..576136f92 100644 --- a/webapp/storybook/config.js +++ b/webapp/storybook/config.js @@ -2,6 +2,7 @@ import { addParameters, configure } from '@storybook/vue' import Vue from 'vue' import Vuex from 'vuex' import { action } from '@storybook/addon-actions' +// eslint-disable-next-line import/no-webpack-loader-syntax import '!style-loader!css-loader!sass-loader!../assets/_new/styles/resets.scss' Vue.use(Vuex) @@ -60,7 +61,7 @@ addParameters({ options: { storySort: (a, b) => a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, { numeric: true }), - } + }, }) configure(loadStories, module) From 5c1242b999a539ade8951676d55b0799aa0d5aea Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 19 Dec 2019 13:07:07 +0530 Subject: [PATCH 091/290] reduce CounterIcon tests to only test logic --- .../generic/CounterIcon/CounterIcon.spec.js | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/webapp/components/_new/generic/CounterIcon/CounterIcon.spec.js b/webapp/components/_new/generic/CounterIcon/CounterIcon.spec.js index 01d753c9d..49be22bde 100644 --- a/webapp/components/_new/generic/CounterIcon/CounterIcon.spec.js +++ b/webapp/components/_new/generic/CounterIcon/CounterIcon.spec.js @@ -5,33 +5,41 @@ import BaseIcon from '../BaseIcon/BaseIcon' const localVue = global.localVue describe('CounterIcon.vue', () => { - let propsData, wrapper, tag + let propsData, wrapper, count const Wrapper = () => { return mount(CounterIcon, { propsData, localVue }) } - describe('given a valid icon name and count', () => { + describe('given a valid icon name and count below 100', () => { beforeEach(() => { - propsData = { icon: 'comments', count: 1 } + propsData = { icon: 'comments', count: 42 } wrapper = Wrapper() - tag = wrapper.find('.ds-tag') + count = wrapper.find('.count') }) - it('renders BaseIcon', () => { + it('renders the icon', () => { expect(wrapper.find(BaseIcon).exists()).toBe(true) }) it('renders the count', () => { - expect(tag.text()).toEqual('1') + expect(count.text()).toEqual('42') + }) + }) + + describe('given a valid icon name and count above 100', () => { + beforeEach(() => { + propsData = { icon: 'comments', count: 750 } + wrapper = Wrapper() + count = wrapper.find('.count') }) - it('uses a round tag', () => { - expect(tag.classes()).toContain('ds-tag-round') + it('renders the icon', () => { + expect(wrapper.find(BaseIcon).exists()).toBe(true) }) - it('uses a primary button', () => { - expect(tag.classes()).toContain('ds-tag-primary') + it('renders the capped count with a plus', () => { + expect(count.text()).toEqual('99+') }) }) }) From a0c34180a80479b12ff44990b994378940d4702d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:42:27 +0000 Subject: [PATCH 092/290] build(deps): bump metascraper-image from 5.8.10 to 5.8.12 in /backend Bumps [metascraper-image](https://github.com/microlinkhq/metascraper) from 5.8.10 to 5.8.12. - [Release notes](https://github.com/microlinkhq/metascraper/releases) - [Changelog](https://github.com/microlinkhq/metascraper/blob/master/CHANGELOG.md) - [Commits](https://github.com/microlinkhq/metascraper/compare/v5.8.10...v5.8.12) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index bd0851f67..b0d85c616 100644 --- a/backend/package.json +++ b/backend/package.json @@ -68,7 +68,7 @@ "metascraper-clearbit-logo": "^5.3.0", "metascraper-date": "^5.8.12", "metascraper-description": "^5.8.12", - "metascraper-image": "^5.8.10", + "metascraper-image": "^5.8.12", "metascraper-lang": "^5.8.10", "metascraper-lang-detector": "^4.10.2", "metascraper-logo": "^5.8.12", diff --git a/backend/yarn.lock b/backend/yarn.lock index b1fbc40d1..73a203d0d 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -5841,12 +5841,12 @@ metascraper-description@^5.8.12: dependencies: "@metascraper/helpers" "^5.8.12" -metascraper-image@^5.8.10: - version "5.8.10" - resolved "https://registry.yarnpkg.com/metascraper-image/-/metascraper-image-5.8.10.tgz#fe21811ca88eef13e64812462fb5a21ee48933dc" - integrity sha512-WOPnTupaDEl58iZp0M6kFlUcRSRQFSPWATPUi3AeW31VJM2sepxmJlqc5qVFTen/Lm+kI23firrvEg5N8tFUVA== +metascraper-image@^5.8.12: + version "5.8.12" + resolved "https://registry.yarnpkg.com/metascraper-image/-/metascraper-image-5.8.12.tgz#a4b9c1cef08e86a1c5c36c0c6e132cad409a3d0b" + integrity sha512-mxzCYEKFknEG4MrRkk3KHN/LxqVnvRFwKOrfNHeRdXWSOI7ANM9SGe+5tYuXrNsONhXfMZp32PJswVqAlWsSLA== dependencies: - "@metascraper/helpers" "^5.8.10" + "@metascraper/helpers" "^5.8.12" metascraper-lang-detector@^4.10.2: version "4.10.2" From 95dfbe4a4327b877ad853cd9a7c2a48190876645 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:48:03 +0000 Subject: [PATCH 093/290] build(deps-dev): bump @babel/core from 7.7.5 to 7.7.7 Bumps [@babel/core](https://github.com/babel/babel) from 7.7.5 to 7.7.7. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](https://github.com/babel/babel/compare/v7.7.5...v7.7.7) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 2a78fc8ee..51d1993ac 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "version": "auto-changelog -p" }, "devDependencies": { - "@babel/core": "^7.7.5", + "@babel/core": "^7.7.7", "@babel/preset-env": "^7.7.7", "@babel/register": "^7.7.4", "auto-changelog": "^1.16.2", diff --git a/yarn.lock b/yarn.lock index 5fa788b62..0ddaae0a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29,15 +29,15 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.5.tgz#ae1323cd035b5160293307f50647e83f8ba62f7e" - integrity sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw== +"@babel/core@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.7.tgz#ee155d2e12300bcc0cff6a8ad46f2af5063803e9" + integrity sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.4" + "@babel/generator" "^7.7.7" "@babel/helpers" "^7.7.4" - "@babel/parser" "^7.7.5" + "@babel/parser" "^7.7.7" "@babel/template" "^7.7.4" "@babel/traverse" "^7.7.4" "@babel/types" "^7.7.4" @@ -49,10 +49,10 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.4.4", "@babel/generator@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" - integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== +"@babel/generator@^7.4.4", "@babel/generator@^7.7.4", "@babel/generator@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.7.tgz#859ac733c44c74148e1a72980a64ec84b85f4f45" + integrity sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ== dependencies: "@babel/types" "^7.7.4" jsesc "^2.5.1" @@ -326,10 +326,10 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.4.5", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" - integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== +"@babel/parser@^7.4.5", "@babel/parser@^7.7.4", "@babel/parser@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937" + integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw== "@babel/plugin-proposal-async-generator-functions@^7.2.0", "@babel/plugin-proposal-async-generator-functions@^7.7.4": version "7.7.4" From f06c3a0db4ea5d0675919708275aed83e76c350c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:48:24 +0000 Subject: [PATCH 094/290] build(deps-dev): bump @babel/cli from 7.7.5 to 7.7.7 in /backend Bumps [@babel/cli](https://github.com/babel/babel) from 7.7.5 to 7.7.7. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](https://github.com/babel/babel/compare/v7.7.5...v7.7.7) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 3f70fa1ae..647f08206 100644 --- a/backend/package.json +++ b/backend/package.json @@ -97,7 +97,7 @@ "xregexp": "^4.2.4" }, "devDependencies": { - "@babel/cli": "~7.7.5", + "@babel/cli": "~7.7.7", "@babel/core": "~7.7.5", "@babel/node": "~7.7.7", "@babel/plugin-proposal-throw-expressions": "^7.7.4", diff --git a/backend/yarn.lock b/backend/yarn.lock index f7b54d491..824723d8c 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -33,10 +33,10 @@ resolved "https://registry.yarnpkg.com/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.24.tgz#3ce939cb127fb8aaa3ffc1e90dff9b8af9f2e3dc" integrity sha512-8GqG48m1XqyXh4mIZrtB5xOhUwSsh1WsrrsaZQOEYYql3YN9DEu9OOSg0ILzXHZo/h2Q74777YE4YzlArQzQEQ== -"@babel/cli@~7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.5.tgz#25702cc65418efc06989af3727897b9f4c8690b6" - integrity sha512-y2YrMGXM3NUyu1Myg0pxg+Lx6g8XhEyvLHYNRwTBV6fDek3H7Io6b7N/LXscLs4HWn4HxMdy7f2rM1rTMp2mFg== +"@babel/cli@~7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.7.tgz#56849acbf81d1a970dd3d1b3097c8ebf5da3f534" + integrity sha512-XQw5KyCZyu/M8/0rYiZyuwbgIQNzOrJzs9dDLX+MieSgBwTLvTj4QVbLmxJACAIvQIDT7PtyHN2sC48EOWTgaA== dependencies: commander "^4.0.1" convert-source-map "^1.1.0" From 12d5befe879520f3bf5a88066797ce0e8c2e712b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2019 12:30:48 +0000 Subject: [PATCH 095/290] build(deps-dev): bump @babel/preset-env from 7.7.6 to 7.7.7 in /backend Bumps [@babel/preset-env](https://github.com/babel/babel) from 7.7.6 to 7.7.7. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](https://github.com/babel/babel/compare/v7.7.6...v7.7.7) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 65 ++++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/backend/package.json b/backend/package.json index 3ef2531f9..6de3ac834 100644 --- a/backend/package.json +++ b/backend/package.json @@ -101,7 +101,7 @@ "@babel/core": "~7.7.5", "@babel/node": "~7.7.7", "@babel/plugin-proposal-throw-expressions": "^7.7.4", - "@babel/preset-env": "~7.7.6", + "@babel/preset-env": "~7.7.7", "@babel/register": "~7.7.0", "apollo-server-testing": "~2.9.14", "babel-core": "~7.0.0-0", diff --git a/backend/yarn.lock b/backend/yarn.lock index 1749715c2..131e894e0 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -323,10 +323,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.7.4" -"@babel/plugin-proposal-object-rest-spread@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71" - integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ== +"@babel/plugin-proposal-object-rest-spread@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz#9f27075004ab99be08c5c1bd653a2985813cb370" + integrity sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.7.4" @@ -347,10 +347,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-throw-expressions" "^7.7.4" -"@babel/plugin-proposal-unicode-property-regex@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.4.tgz#7c239ccaf09470dbe1d453d50057460e84517ebb" - integrity sha512-cHgqHgYvffluZk85dJ02vloErm3Y6xtH+2noOBOJ2kXOJH3aVCDnj5eR/lVNlTnYu4hndAPJD3rTFjW3qee0PA== +"@babel/plugin-proposal-unicode-property-regex@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz#433fa9dac64f953c12578b29633f456b68831c4e" + integrity sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" @@ -463,10 +463,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.4.tgz#f7ccda61118c5b7a2599a72d5e3210884a021e96" - integrity sha512-mk0cH1zyMa/XHeb6LOTXTbG7uIJ8Rrjlzu91pUx/KS3JpcgaTDwMS8kM+ar8SLOvlL2Lofi4CGBAjCo3a2x+lw== +"@babel/plugin-transform-dotall-regex@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz#3e9713f1b69f339e87fa796b097d73ded16b937b" + integrity sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" @@ -573,10 +573,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.7.4" -"@babel/plugin-transform-parameters@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" - integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== +"@babel/plugin-transform-parameters@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz#7a884b2460164dc5f194f668332736584c760007" + integrity sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew== dependencies: "@babel/helper-call-delegate" "^7.7.4" "@babel/helper-get-function-arity" "^7.7.4" @@ -648,19 +648,19 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/preset-env@~7.7.6": - version "7.7.6" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.6.tgz#39ac600427bbb94eec6b27953f1dfa1d64d457b2" - integrity sha512-k5hO17iF/Q7tR9Jv8PdNBZWYW6RofxhnxKjBMc0nG4JTaWvOTiPoO/RLFwAKcA4FpmuBFm6jkoqaRJLGi0zdaQ== +"@babel/preset-env@~7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.7.tgz#c294167b91e53e7e36d820e943ece8d0c7fe46ac" + integrity sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg== dependencies: "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-proposal-async-generator-functions" "^7.7.4" "@babel/plugin-proposal-dynamic-import" "^7.7.4" "@babel/plugin-proposal-json-strings" "^7.7.4" - "@babel/plugin-proposal-object-rest-spread" "^7.7.4" + "@babel/plugin-proposal-object-rest-spread" "^7.7.7" "@babel/plugin-proposal-optional-catch-binding" "^7.7.4" - "@babel/plugin-proposal-unicode-property-regex" "^7.7.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.7.7" "@babel/plugin-syntax-async-generators" "^7.7.4" "@babel/plugin-syntax-dynamic-import" "^7.7.4" "@babel/plugin-syntax-json-strings" "^7.7.4" @@ -674,7 +674,7 @@ "@babel/plugin-transform-classes" "^7.7.4" "@babel/plugin-transform-computed-properties" "^7.7.4" "@babel/plugin-transform-destructuring" "^7.7.4" - "@babel/plugin-transform-dotall-regex" "^7.7.4" + "@babel/plugin-transform-dotall-regex" "^7.7.7" "@babel/plugin-transform-duplicate-keys" "^7.7.4" "@babel/plugin-transform-exponentiation-operator" "^7.7.4" "@babel/plugin-transform-for-of" "^7.7.4" @@ -688,7 +688,7 @@ "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4" "@babel/plugin-transform-new-target" "^7.7.4" "@babel/plugin-transform-object-super" "^7.7.4" - "@babel/plugin-transform-parameters" "^7.7.4" + "@babel/plugin-transform-parameters" "^7.7.7" "@babel/plugin-transform-property-literals" "^7.7.4" "@babel/plugin-transform-regenerator" "^7.7.5" "@babel/plugin-transform-reserved-words" "^7.7.4" @@ -700,7 +700,7 @@ "@babel/plugin-transform-unicode-regex" "^7.7.4" "@babel/types" "^7.7.4" browserslist "^4.6.0" - core-js-compat "^3.4.7" + core-js-compat "^3.6.0" invariant "^2.2.2" js-levenshtein "^1.1.3" semver "^5.5.0" @@ -2700,13 +2700,13 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -core-js-compat@^3.4.7: - version "3.4.8" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.8.tgz#f72e6a4ed76437ea710928f44615f926a81607d5" - integrity sha512-l3WTmnXHV2Sfu5VuD7EHE2w7y+K68+kULKt5RJg8ZJk3YhHF1qLD4O8v8AmNq+8vbOwnPFFDvds25/AoEvMqlQ== +core-js-compat@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.0.tgz#4eb6cb69d03d99159ed7c860cd5fcf7d23a62ea9" + integrity sha512-Z3eCNjGgoYluH89Jt4wVkfYsc/VdLrA2/woX5lm0isO/pCT+P+Y+o65bOuEnjDJLthdwTBxbCVzptTXtc18fJg== dependencies: browserslist "^4.8.2" - semver "^6.3.0" + semver "7.0.0" core-js@^2.4.0, core-js@^2.6.5: version "2.6.9" @@ -7470,6 +7470,11 @@ semver-diff@^2.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== + semver@^6.0.0, semver@^6.1.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" From b79c292ef4f76b307131566c24d849c2e35c8089 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 19 Dec 2019 17:13:14 +0100 Subject: [PATCH 096/290] Fix failing component tests - Extract testing logic to SearchableInput spec - write new tests for SearchResources --- .../SearchResources/SearchResources.spec.js | 158 +++++------------- .../SearchResources/SearchResources.story.js | 2 +- .../SearchableInput/SearchableInput.spec.js | 128 ++++++++++++++ 3 files changed, 174 insertions(+), 114 deletions(-) create mode 100644 webapp/components/generic/SearchableInput/SearchableInput.spec.js diff --git a/webapp/components/features/SearchResources/SearchResources.spec.js b/webapp/components/features/SearchResources/SearchResources.spec.js index cc4d230c2..27a75dbfc 100644 --- a/webapp/components/features/SearchResources/SearchResources.spec.js +++ b/webapp/components/features/SearchResources/SearchResources.spec.js @@ -1,139 +1,71 @@ -import { mount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' +import Vuex from 'vuex' import SearchResources from './SearchResources.vue' - +import SearchableInput from '~/components/generic/SearchableInput/SearchableInput' +import { results as searchResults } from './SearchResources.story' const localVue = global.localVue localVue.filter('truncate', () => 'truncated string') localVue.filter('dateTime', () => Date.now) +config.stubs['nuxt-link'] = '' describe('SearchResources.vue', () => { - let mocks - let propsData - + let mocks, wrapper, getters beforeEach(() => { - propsData = {} + mocks = { + $apollo: { + query: jest.fn(), + }, + $t: jest.fn(string => string), + } + getters = { 'auth/isModerator': () => false } + wrapper = Wrapper() }) + const Wrapper = () => { + const store = new Vuex.Store({ + getters, + }) + return mount(SearchResources, { mocks, localVue, store }) + } + describe('mount', () => { - const Wrapper = () => { - mocks = { - $t: () => {}, - } - return mount(SearchResources, { mocks, localVue, propsData }) - } - - it('renders', () => { - expect(Wrapper().is('div')).toBe(true) - }) - - it('has id "nav-search"', () => { - expect(Wrapper().contains('[data-test="search-resources"]')).toBe(true) - }) - - it('defaults to an empty value', () => { - expect(Wrapper().vm.value).toBe('') - }) - - it('defaults to id "nav-search"', () => { - expect(Wrapper().vm.id).toBe('nav-search') - }) - - it('default to a 300 millisecond delay from the time the user stops typing to when the search starts', () => { - expect(Wrapper().vm.delay).toEqual(300) - }) - - it('defaults to an empty array as results', () => { - expect(Wrapper().vm.results).toEqual([]) + it('defaults to an empty array as searchResults', () => { + expect(wrapper.vm.searchResults).toEqual([]) }) it('defaults to pending false, as in the search is not pending', () => { - expect(Wrapper().vm.pending).toBe(false) + expect(wrapper.vm.pending).toBe(false) }) - it('accepts values as a string', () => { - propsData = { value: 'abc' } - const wrapper = Wrapper() - expect(wrapper.vm.value).toEqual('abc') - }) - - describe('testing custom functions', () => { - let select - let wrapper - + describe('Emitted events', () => { + let searchableInputComponent beforeEach(() => { - wrapper = Wrapper() - select = wrapper.find('.ds-select') - select.trigger('focus') - select.element.value = 'abcd' + searchableInputComponent = wrapper.find(SearchableInput) }) - it('opens the select dropdown when focused on', () => { - expect(wrapper.vm.isOpen).toBe(true) + describe('query event', () => { + it('calls an apollo query', () => { + searchableInputComponent.vm.$emit('query', 'abcd') + expect(mocks.$apollo.query).toHaveBeenCalledWith( + expect.objectContaining({ variables: { query: 'abcd' } }), + ) + }) }) - it('opens the select dropdown and blurs after focused on', () => { - select.trigger('blur') - expect(wrapper.vm.isOpen).toBe(false) - }) + describe('clearSearch event', () => { + beforeEach(() => { + wrapper.setData({ searchResults, pending: true }) + searchableInputComponent.vm.$emit('clearSearch') + }) - it('is clearable', () => { - select.trigger('input') - select.trigger('keyup.esc') - expect(wrapper.emitted().clear.length).toBe(1) - }) + it('clears searchResults', () => { + expect(wrapper.vm.searchResults).toEqual([]) + }) - it('changes the unprocessedSearchResources as the value changes', () => { - select.trigger('input') - expect(wrapper.vm.unprocessedSearchResources).toBe('abcd') - }) - - it('searches for the term when enter is pressed', async () => { - select.trigger('input') - select.trigger('keyup.enter') - await expect(wrapper.emitted().search[0]).toEqual(['abcd']) - }) - - it('calls onDelete when the delete key is pressed', () => { - const spy = jest.spyOn(wrapper.vm, 'onDelete') - select.trigger('input') - select.trigger('keyup.delete') - expect(spy).toHaveBeenCalledTimes(1) - }) - - it('calls query when a user starts a search by pressing enter', () => { - const spy = jest.spyOn(wrapper.vm, 'query') - select.trigger('input') - select.trigger('keyup.enter') - expect(spy).toHaveBeenCalledWith('abcd') - }) - - it('calls onSelect when a user selects an item in the search dropdown menu', async () => { - // searched for term in the browser, copied the results from Vuex in Vue dev tools - propsData = { - results: [ - { - __typename: 'Post', - author: { - __typename: 'User', - id: 'u5', - name: 'Trick', - slug: 'trick', - }, - commentsCount: 0, - createdAt: '2019-03-13T11:00:20.835Z', - id: 'p10', - label: 'Eos aut illo omnis quis eaque et iure aut.', - shoutedCount: 0, - slug: 'eos-aut-illo-omnis-quis-eaque-et-iure-aut', - value: 'Eos aut illo omnis quis eaque et iure aut.', - }, - ], - } - wrapper = Wrapper() - select.trigger('input') - const results = wrapper.find('.ds-select-option') - results.trigger('click') - await expect(wrapper.emitted().select[0]).toEqual(propsData.results) + it('set pending to false', () => { + expect(wrapper.vm.pending).toBe(false) + }) }) }) }) diff --git a/webapp/components/features/SearchResources/SearchResources.story.js b/webapp/components/features/SearchResources/SearchResources.story.js index 328259917..c2cd8f4fa 100644 --- a/webapp/components/features/SearchResources/SearchResources.story.js +++ b/webapp/components/features/SearchResources/SearchResources.story.js @@ -7,7 +7,7 @@ helpers.init() export const results = [ { - id: 'de100841-2336-4b01-a574-f1bd2c0b262a', + id: 'post-by-jenny', __typename: 'Post', slug: 'user-post-by-jenny', title: 'User Post by Jenny', diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js new file mode 100644 index 000000000..98528a466 --- /dev/null +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -0,0 +1,128 @@ +import { config, mount } from '@vue/test-utils' +import Vuex from 'vuex' +import Vue from 'vue' +import SearchableInput from './SearchableInput' +import { results } from '~/components/features/SearchResources/SearchResources.story' + +const localVue = global.localVue + +localVue.filter('truncate', () => 'truncated string') +localVue.filter('dateTime', () => Date.now) +config.stubs['nuxt-link'] = '' + +describe('SearchableInput.vue', () => { + let mocks, propsData, getters + + beforeEach(() => { + propsData = {} + mocks = { + $router: { + push: jest.fn(), + }, + $t: jest.fn(string => string), + } + getters = { 'auth/isModerator': () => false } + }) + + describe('mount', () => { + const Wrapper = () => { + const store = new Vuex.Store({ + getters, + }) + return mount(SearchableInput, { mocks, localVue, propsData, store }) + } + + it('defaults to an empty value', () => { + expect(Wrapper().vm.value).toBe('') + }) + + it('default to a 300 millisecond delay from the time the user stops typing to when the search starts', () => { + expect(Wrapper().vm.delay).toEqual(300) + }) + + it('defaults to an empty array as options', () => { + expect(Wrapper().vm.options).toEqual([]) + }) + + describe('testing custom functions', () => { + let select, wrapper + + beforeEach(() => { + wrapper = Wrapper() + select = wrapper.find('.ds-select') + select.trigger('focus') + select.element.value = 'abcd' + }) + + it('opens the select dropdown when focused on', () => { + expect(wrapper.vm.isOpen).toBe(true) + }) + + it('opens the select dropdown and blurs after focused on', () => { + select.trigger('blur') + expect(wrapper.vm.isOpen).toBe(false) + }) + + it('is clearable', () => { + select.trigger('input') + select.trigger('keyup.esc') + expect(wrapper.emitted().clearSearch.length).toBe(1) + }) + + it('changes the unprocessedSearchInput as the value changes', () => { + select.trigger('input') + expect(wrapper.vm.unprocessedSearchInput).toBe('abcd') + }) + + it('searches for the term when enter is pressed', async () => { + select.element.value = 'ab' + select.trigger('input') + select.trigger('keyup.enter') + await expect(wrapper.emitted().query[0]).toEqual(['ab']) + }) + + it('calls onDelete when the delete key is pressed', () => { + const spy = jest.spyOn(wrapper.vm, 'onDelete') + select.trigger('input') + select.trigger('keyup.delete') + expect(spy).toHaveBeenCalledTimes(1) + }) + + describe('navigating to resource', () => { + beforeEach(() => { + propsData = { options: results } + wrapper = Wrapper() + select = wrapper.find('.ds-select') + select.trigger('focus') + }) + + it('pushes to post page', async () => { + select.element.value = 'Post' + select.trigger('input') + const post = wrapper.find('.search-post') + post.trigger('click') + await Vue.nextTick().then(() => { + expect(mocks.$router.push).toHaveBeenCalledWith({ + name: 'post-id-slug', + params: { id: 'post-by-jenny', slug: 'user-post-by-jenny' }, + }) + }) + }) + + it("pushes to user's profile", async () => { + select.element.value = 'Bob' + select.trigger('input') + const users = wrapper.findAll('.userinfo') + const bob = users.filter(item => item.text() === '@bob-der-baumeister') + bob.trigger('click') + await Vue.nextTick().then(() => { + expect(mocks.$router.push).toHaveBeenCalledWith({ + name: 'profile-id-slug', + params: { id: 'u2', slug: 'bob-der-baumeister' }, + }) + }) + }) + }) + }) + }) +}) From 46191e5889ddf4fb9b4b722bd109503d9f79e398 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 19 Dec 2019 17:13:58 +0100 Subject: [PATCH 097/290] Refactor isOfFirstType to computed/styling updates --- .../generic/SearchPost/SearchPost.vue | 7 ++- .../SearchableInput/SearchableInput.vue | 63 ++++++++----------- 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/webapp/components/generic/SearchPost/SearchPost.vue b/webapp/components/generic/SearchPost/SearchPost.vue index 97108afe8..b7657a3cf 100644 --- a/webapp/components/generic/SearchPost/SearchPost.vue +++ b/webapp/components/generic/SearchPost/SearchPost.vue @@ -11,7 +11,7 @@ {{ option.commentsCount }} - + {{ option.shoutedCount }} @@ -58,4 +58,9 @@ export default { vertical-align: sub; } } +.post-shouted { + width: 36px; + display: inline-block; + text-align: right; +} diff --git a/webapp/components/generic/SearchableInput/SearchableInput.vue b/webapp/components/generic/SearchableInput/SearchableInput.vue index 0163ed393..8386c08af 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.vue +++ b/webapp/components/generic/SearchableInput/SearchableInput.vue @@ -10,11 +10,8 @@ >
-   + - diff --git a/webapp/components/EnterNonce/EnterNonce.vue b/webapp/components/EnterNonce/EnterNonce.vue index b44201a42..eb44c3235 100644 --- a/webapp/components/EnterNonce/EnterNonce.vue +++ b/webapp/components/EnterNonce/EnterNonce.vue @@ -17,7 +17,7 @@ {{ $t('components.enter-nonce.form.description') }} - + {{ $t('components.enter-nonce.form.next') }} diff --git a/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue b/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue index 6d91098ad..9189f417d 100644 --- a/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue +++ b/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue @@ -16,7 +16,7 @@ circle icon="check" @click="resetCategories" - :primary="!filteredCategoryIds.length" + :filled="!filteredCategoryIds.length" /> @@ -41,7 +41,7 @@ diff --git a/webapp/components/FilterPosts/FilterPosts.spec.js b/webapp/components/FilterPosts/FilterPosts.spec.js index b864a8a46..c05a3d85f 100644 --- a/webapp/components/FilterPosts/FilterPosts.spec.js +++ b/webapp/components/FilterPosts/FilterPosts.spec.js @@ -92,7 +92,7 @@ describe('FilterPosts.vue', () => { it('starts with all categories button active', () => { const wrapper = openFilterPosts() allCategoriesButton = wrapper.findAll('button').at(1) - expect(allCategoriesButton.attributes().class).toContain('--primary') + expect(allCategoriesButton.attributes().class).toContain('--filled') }) it('calls TOGGLE_CATEGORY when clicked', () => { @@ -111,27 +111,27 @@ describe('FilterPosts.vue', () => { expect(mutations['posts/TOGGLE_LANGUAGE']).toHaveBeenCalledWith({}, 'en') }) - it('sets category button attribute `primary` when corresponding category is filtered', () => { + it('sets category button attribute `filled` when corresponding category is filtered', () => { getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9']) const wrapper = openFilterPosts() democracyAndPoliticsButton = wrapper.findAll('button').at(4) - expect(democracyAndPoliticsButton.attributes().class).toContain('--primary') + expect(democracyAndPoliticsButton.attributes().class).toContain('--filled') }) - it('sets language button attribute `primary` when corresponding language is filtered', () => { + it('sets language button attribute `filled` when corresponding language is filtered', () => { getters['posts/filteredLanguageCodes'] = jest.fn(() => ['es']) const wrapper = openFilterPosts() spanishButton = wrapper .findAll('button.language-buttons') .at(languages.findIndex(l => l.code === 'es')) - expect(spanishButton.attributes().class).toContain('--primary') + expect(spanishButton.attributes().class).toContain('--filled') }) - it('sets "filter-by-followed-authors-only" button attribute `primary`', () => { + it('sets "filter-by-followed-authors-only" button attribute `filled`', () => { getters['posts/filteredByUsersFollowed'] = jest.fn(() => true) const wrapper = openFilterPosts() expect( - wrapper.find('.base-button[name="filter-by-followed-authors-only"]').classes('--primary'), + wrapper.find('.base-button[name="filter-by-followed-authors-only"]').classes('--filled'), ).toBe(true) }) diff --git a/webapp/components/FilterPosts/FilterPosts.vue b/webapp/components/FilterPosts/FilterPosts.vue index 281b46413..787751004 100644 --- a/webapp/components/FilterPosts/FilterPosts.vue +++ b/webapp/components/FilterPosts/FilterPosts.vue @@ -3,7 +3,7 @@ @@ -36,7 +36,7 @@ {{ language.code.toUpperCase() }} diff --git a/webapp/components/FollowButton.vue b/webapp/components/FollowButton.vue index 14d98ef48..31856e6b4 100644 --- a/webapp/components/FollowButton.vue +++ b/webapp/components/FollowButton.vue @@ -4,7 +4,7 @@ :disabled="disabled || !followId" :loading="loading" :icon="icon" - :primary="isFollowed && !hovered" + :filled="isFollowed && !hovered" :danger="isFollowed && hovered" @mouseenter.native="onHover" @mouseleave.native="hovered = false" diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index e1eb0c693..c140edb47 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -50,7 +50,7 @@ {{ $t('login.forgotPassword') }} - + {{ $t('login.login') }} diff --git a/webapp/components/Password/Change.vue b/webapp/components/Password/Change.vue index 1ce61dcf7..547aab6a1 100644 --- a/webapp/components/Password/Change.vue +++ b/webapp/components/Password/Change.vue @@ -24,7 +24,7 @@ /> - + {{ $t('settings.security.change-password.button') }} diff --git a/webapp/components/PasswordReset/ChangePassword.vue b/webapp/components/PasswordReset/ChangePassword.vue index 5661827fa..ab3334c6d 100644 --- a/webapp/components/PasswordReset/ChangePassword.vue +++ b/webapp/components/PasswordReset/ChangePassword.vue @@ -24,7 +24,7 @@ /> - + {{ $t('settings.security.change-password.button') }} diff --git a/webapp/components/PasswordReset/Request.vue b/webapp/components/PasswordReset/Request.vue index e5c4aabac..5f4baf357 100644 --- a/webapp/components/PasswordReset/Request.vue +++ b/webapp/components/PasswordReset/Request.vue @@ -23,7 +23,7 @@ {{ $t('actions.save') }} diff --git a/webapp/components/Registration/Signup.vue b/webapp/components/Registration/Signup.vue index 67cd09f92..8a9447a69 100644 --- a/webapp/components/Registration/Signup.vue +++ b/webapp/components/Registration/Signup.vue @@ -33,7 +33,7 @@
- + {{ $t('contribution.teaserImage.cropperConfirm') }} - + {{ $t('actions.save') }} diff --git a/webapp/pages/admin/users.vue b/webapp/pages/admin/users.vue index 8b8f4ef31..e56be70ab 100644 --- a/webapp/pages/admin/users.vue +++ b/webapp/pages/admin/users.vue @@ -12,7 +12,7 @@ /> - + diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index f9223a01b..58de701cf 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -8,7 +8,7 @@
@@ -49,7 +49,7 @@ }" class="post-add-button" icon="plus" - primary + filled circle /> diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 5a504fdcc..1e2ad3834 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -227,7 +227,7 @@ class="profile-post-add-button" icon="plus" circle - primary + filled /> diff --git a/webapp/pages/settings/embeds.vue b/webapp/pages/settings/embeds.vue index b417dc017..22050c636 100644 --- a/webapp/pages/settings/embeds.vue +++ b/webapp/pages/settings/embeds.vue @@ -16,10 +16,10 @@ {{ $t('settings.embeds.status.change.question') }} - + {{ $t('settings.embeds.status.change.deny') }} - + {{ $t('settings.embeds.status.change.allow') }} diff --git a/webapp/pages/settings/index.vue b/webapp/pages/settings/index.vue index 0f641c6f9..20034d5af 100644 --- a/webapp/pages/settings/index.vue +++ b/webapp/pages/settings/index.vue @@ -31,7 +31,7 @@ :placeholder="$t('settings.data.labelBio')" /> diff --git a/webapp/pages/settings/my-email-address/enter-nonce.vue b/webapp/pages/settings/my-email-address/enter-nonce.vue index b9fd1a291..91b2e269f 100644 --- a/webapp/pages/settings/my-email-address/enter-nonce.vue +++ b/webapp/pages/settings/my-email-address/enter-nonce.vue @@ -17,7 +17,7 @@ /> diff --git a/webapp/pages/settings/my-email-address/index.vue b/webapp/pages/settings/my-email-address/index.vue index 58cdc7124..4e01bbb44 100644 --- a/webapp/pages/settings/my-email-address/index.vue +++ b/webapp/pages/settings/my-email-address/index.vue @@ -19,7 +19,7 @@ {{ backendErrors.message }} - + {{ $t('actions.save') }} diff --git a/webapp/pages/settings/my-social-media.vue b/webapp/pages/settings/my-social-media.vue index d89896cb8..5f489c303 100644 --- a/webapp/pages/settings/my-social-media.vue +++ b/webapp/pages/settings/my-social-media.vue @@ -54,7 +54,7 @@ :placeholder="$t('settings.social-media.placeholder')" /> - + {{ editingLink.id ? $t('actions.save') : $t('settings.social-media.submit') }} diff --git a/webapp/pages/settings/privacy.vue b/webapp/pages/settings/privacy.vue index e1d440b05..f759926b7 100644 --- a/webapp/pages/settings/privacy.vue +++ b/webapp/pages/settings/privacy.vue @@ -4,7 +4,7 @@ - {{ $t('actions.save') }} + {{ $t('actions.save') }} diff --git a/webapp/pages/terms-and-conditions-confirm.vue b/webapp/pages/terms-and-conditions-confirm.vue index 38fadbdf8..0716048b5 100644 --- a/webapp/pages/terms-and-conditions-confirm.vue +++ b/webapp/pages/terms-and-conditions-confirm.vue @@ -17,7 +17,7 @@ From 93b6323c3480d2ebf84a431650ebb8ef585fa197 Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 9 Jan 2020 13:37:15 +0530 Subject: [PATCH 213/290] make cancel buttons red --- webapp/components/CommentForm/CommentForm.vue | 1 + webapp/components/DeleteData/DeleteData.vue | 2 +- webapp/components/Modal/ConfirmModal.vue | 7 ++++++- webapp/components/Modal/DisableModal.vue | 2 +- webapp/components/Modal/ReportModal.vue | 1 + webapp/components/ReleaseModal/ReleaseModal.vue | 2 +- webapp/components/TeaserImage/TeaserImage.vue | 1 + webapp/components/features/ReportRow/ReportRow.vue | 1 + webapp/pages/settings/my-social-media.vue | 2 +- 9 files changed, 14 insertions(+), 5 deletions(-) diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 9d4428e2d..063a3d599 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -9,6 +9,7 @@ :disabled="disabled && !update" @click="handleCancel" data-test="cancel-button" + danger > {{ $t('actions.cancel') }} diff --git a/webapp/components/DeleteData/DeleteData.vue b/webapp/components/DeleteData/DeleteData.vue index 045d00f26..167fa505f 100644 --- a/webapp/components/DeleteData/DeleteData.vue +++ b/webapp/components/DeleteData/DeleteData.vue @@ -62,7 +62,7 @@ /> - + {{ $t('settings.deleteUserAccount.name') }} diff --git a/webapp/components/Modal/ConfirmModal.vue b/webapp/components/Modal/ConfirmModal.vue index 282dbed5e..9eb81b5ea 100644 --- a/webapp/components/Modal/ConfirmModal.vue +++ b/webapp/components/Modal/ConfirmModal.vue @@ -10,7 +10,12 @@

diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index a68c427a6..94938361d 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -18,6 +18,7 @@ size="small" circle danger + filled @click="cancelCrop" />

diff --git a/webapp/components/features/ReportRow/ReportRow.vue b/webapp/components/features/ReportRow/ReportRow.vue index 4e69f6910..af9a317cd 100644 --- a/webapp/components/features/ReportRow/ReportRow.vue +++ b/webapp/components/features/ReportRow/ReportRow.vue @@ -64,6 +64,7 @@ {{ editingLink.id ? $t('actions.save') : $t('settings.social-media.submit') }} - + {{ $t('actions.cancel') }} From 04e5ecc87d172072e4d943fe1437a14ddbb5bffc Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 9 Jan 2020 13:48:30 +0530 Subject: [PATCH 214/290] fix tests and lint errors --- webapp/components/DeleteData/DeleteData.vue | 8 +++++++- .../components/NotificationMenu/NotificationMenu.spec.js | 2 +- webapp/components/_new/generic/BaseButton/BaseButton.vue | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/components/DeleteData/DeleteData.vue b/webapp/components/DeleteData/DeleteData.vue index 167fa505f..9ecdbb850 100644 --- a/webapp/components/DeleteData/DeleteData.vue +++ b/webapp/components/DeleteData/DeleteData.vue @@ -62,7 +62,13 @@ /> - + {{ $t('settings.deleteUserAccount.name') }} diff --git a/webapp/components/NotificationMenu/NotificationMenu.spec.js b/webapp/components/NotificationMenu/NotificationMenu.spec.js index 45d109a7e..8020c8bb4 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.spec.js +++ b/webapp/components/NotificationMenu/NotificationMenu.spec.js @@ -5,7 +5,7 @@ const localVue = global.localVue localVue.filter('truncate', string => string) -config.stubs.dropdown = '' +config.stubs.dropdown = '' describe('NotificationMenu.vue', () => { let wrapper diff --git a/webapp/components/_new/generic/BaseButton/BaseButton.vue b/webapp/components/_new/generic/BaseButton/BaseButton.vue index 6b484b9a1..3cbe38ab2 100644 --- a/webapp/components/_new/generic/BaseButton/BaseButton.vue +++ b/webapp/components/_new/generic/BaseButton/BaseButton.vue @@ -102,7 +102,7 @@ export default { } &.--danger.--filled { - @include buttonStates($color-scheme: danger, $filled: true) + @include buttonStates($color-scheme: danger, $filled: true); } &.--circle { From b71638d29f5b5157027b34638bf611df439d76ff Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 9 Jan 2020 14:31:25 +0530 Subject: [PATCH 215/290] use scss variables in base button component --- .../_new/styles/mixins/buttonStates.scss | 10 +++------ webapp/assets/_new/styles/tokens.scss | 8 +++++++ .../_new/generic/BaseButton/BaseButton.vue | 22 +++++++++++-------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/webapp/assets/_new/styles/mixins/buttonStates.scss b/webapp/assets/_new/styles/mixins/buttonStates.scss index bce2fc927..b8e1509a6 100644 --- a/webapp/assets/_new/styles/mixins/buttonStates.scss +++ b/webapp/assets/_new/styles/mixins/buttonStates.scss @@ -12,10 +12,10 @@ color: $main-color; border-color: $main-color; background-color: transparent; - transition: background-color 0.1s; + transition: background-color $duration-short; &:focus { - outline: 1px dashed $main-color; + outline: $border-size-base dashed $main-color; } &:enabled { @@ -38,10 +38,6 @@ cursor: default; } - &.--loading { - color: $color-neutral-80; - } - @if $filled { color: $color-neutral-100; border-color: $main-color; @@ -61,7 +57,7 @@ } &:disabled { - color: $color-neutral-80; + color: $color-neutral-100; background-color: $color-neutral-60; border-color: $color-neutral-60; } diff --git a/webapp/assets/_new/styles/tokens.scss b/webapp/assets/_new/styles/tokens.scss index 30a859980..29ba0286d 100644 --- a/webapp/assets/_new/styles/tokens.scss +++ b/webapp/assets/_new/styles/tokens.scss @@ -250,6 +250,14 @@ $size-avatar-base: 44px; $size-avatar-large: 64px; $size-avatar-x-large: 114px; +/** + * @tokens Size Buttons + * @presenter Spacing + */ + + $size-button-base: 36px; + $size-button-small: 26px; + /** * @tokens Shadow * @presenter Shadow diff --git a/webapp/components/_new/generic/BaseButton/BaseButton.vue b/webapp/components/_new/generic/BaseButton/BaseButton.vue index 3cbe38ab2..b616995c5 100644 --- a/webapp/components/_new/generic/BaseButton/BaseButton.vue +++ b/webapp/components/_new/generic/BaseButton/BaseButton.vue @@ -84,11 +84,11 @@ export default { display: inline-flex; align-items: center; justify-content: center; - height: 36px; - padding: 0 12px; + height: $size-button-base; + padding: 0 $space-x-small; vertical-align: bottom; - border: 1px solid; - border-radius: 6px; + border: $border-size-base solid; + border-radius: $border-radius-x-large; overflow: hidden; font-weight: $font-weight-bold; cursor: pointer; @@ -106,7 +106,7 @@ export default { } &.--circle { - width: 36px; + width: $size-button-base; border-radius: 50%; } @@ -115,21 +115,25 @@ export default { } &.--small { - height: 26px; + height: $size-button-small; font-size: $font-size-small; &.--circle { - width: 26px; + width: $size-button-small; } } &:not(.--icon-only) > .base-icon { - margin-right: 6px; + margin-right: $space-xx-small; + } + + &:disabled.--loading { + color: $color-neutral-80; } > .loading-spinner { position: absolute; - height: 26px; + height: $size-button-small; color: $color-neutral-60; } From 3dcdd8d1b23c0418a9e934f0d9123d1acf5f080a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2020 09:08:46 +0000 Subject: [PATCH 216/290] build(deps): bump metascraper-title from 5.8.13 to 5.9.5 in /backend Bumps [metascraper-title](https://github.com/microlinkhq/metascraper) from 5.8.13 to 5.9.5. - [Release notes](https://github.com/microlinkhq/metascraper/releases) - [Changelog](https://github.com/microlinkhq/metascraper/blob/master/CHANGELOG.md) - [Commits](https://github.com/microlinkhq/metascraper/compare/v5.8.13...v5.9.5) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index 99f1d78e3..895402b12 100644 --- a/backend/package.json +++ b/backend/package.json @@ -74,7 +74,7 @@ "metascraper-logo": "^5.8.13", "metascraper-publisher": "^5.9.5", "metascraper-soundcloud": "^5.9.5", - "metascraper-title": "^5.8.13", + "metascraper-title": "^5.9.5", "metascraper-url": "^5.8.13", "metascraper-video": "^5.9.5", "metascraper-youtube": "^5.8.13", diff --git a/backend/yarn.lock b/backend/yarn.lock index 041332efa..dd8a1b454 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -5971,12 +5971,12 @@ metascraper-soundcloud@^5.9.5: "@metascraper/helpers" "^5.9.5" tldts "~5.6.3" -metascraper-title@^5.8.13: - version "5.8.13" - resolved "https://registry.yarnpkg.com/metascraper-title/-/metascraper-title-5.8.13.tgz#f2f54f18004333cbab559c929d44a7e8a443b9d2" - integrity sha512-emlfacAfRwbTn5eYZ3kUx5iHt+8WHjjrQNHe/gGjuSKXJrOQvsdDLznhfa+Ca38119WYyTodzC8WX+MS3/rscg== +metascraper-title@^5.9.5: + version "5.9.5" + resolved "https://registry.yarnpkg.com/metascraper-title/-/metascraper-title-5.9.5.tgz#4adc9b4bec6652acd435e5035e560a503281b41e" + integrity sha512-zRgWLjTUtunaLcFq/FLYy7aRxyfxJoHaTH1HwXmYTSjL6Fu55I1zjzkwy6NU4INwovhKinAsijc00Ednj4FIAg== dependencies: - "@metascraper/helpers" "^5.8.13" + "@metascraper/helpers" "^5.9.5" lodash "~4.17.15" metascraper-url@^5.8.13: From af5aaf5b42629d553d799ab978505b0182686526 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2020 09:08:50 +0000 Subject: [PATCH 217/290] build(deps): bump metascraper-logo from 5.8.13 to 5.9.5 in /backend Bumps [metascraper-logo](https://github.com/microlinkhq/metascraper) from 5.8.13 to 5.9.5. - [Release notes](https://github.com/microlinkhq/metascraper/releases) - [Changelog](https://github.com/microlinkhq/metascraper/blob/master/CHANGELOG.md) - [Commits](https://github.com/microlinkhq/metascraper/compare/v5.8.13...v5.9.5) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index 99f1d78e3..abf47b012 100644 --- a/backend/package.json +++ b/backend/package.json @@ -71,7 +71,7 @@ "metascraper-image": "^5.9.4", "metascraper-lang": "^5.8.13", "metascraper-lang-detector": "^4.10.2", - "metascraper-logo": "^5.8.13", + "metascraper-logo": "^5.9.5", "metascraper-publisher": "^5.9.5", "metascraper-soundcloud": "^5.9.5", "metascraper-title": "^5.8.13", diff --git a/backend/yarn.lock b/backend/yarn.lock index 041332efa..26b42b66e 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -5949,12 +5949,12 @@ metascraper-lang@^5.8.13: dependencies: "@metascraper/helpers" "^5.8.13" -metascraper-logo@^5.8.13: - version "5.8.13" - resolved "https://registry.yarnpkg.com/metascraper-logo/-/metascraper-logo-5.8.13.tgz#5882eb580589c1079302c3bc8bc855eb1e004946" - integrity sha512-alJrgCnzkobAjM5CggRtvjjAiJCJzvQEObOlqmFdHheHqk5owSRcoGeJLOCwrYo7RjBx2m3Gult1S4LJzwae5g== +metascraper-logo@^5.9.5: + version "5.9.5" + resolved "https://registry.yarnpkg.com/metascraper-logo/-/metascraper-logo-5.9.5.tgz#1fee5b3de1c79380d50c8e2ecd3d102b6cb9f7d4" + integrity sha512-rbBLYVX4xSIzzeQJaUyibQYzjlNGlkyri14ixpIlCdlri3KQ0rRKnwQSeOSUlAu1rVsL7JlsMrhMDCb21dX9sQ== dependencies: - "@metascraper/helpers" "^5.8.13" + "@metascraper/helpers" "^5.9.5" metascraper-publisher@^5.9.5: version "5.9.5" From c975006e02dbd2325a2110c350b79442c1eeb9fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2020 09:09:34 +0000 Subject: [PATCH 218/290] build(deps): bump metascraper-description in /backend Bumps [metascraper-description](https://github.com/microlinkhq/metascraper) from 5.8.15 to 5.9.5. - [Release notes](https://github.com/microlinkhq/metascraper/releases) - [Changelog](https://github.com/microlinkhq/metascraper/blob/master/CHANGELOG.md) - [Commits](https://github.com/microlinkhq/metascraper/compare/v5.8.15...v5.9.5) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index be24abaa0..0145579e5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -67,7 +67,7 @@ "metascraper-author": "^5.9.5", "metascraper-clearbit-logo": "^5.3.0", "metascraper-date": "^5.9.5", - "metascraper-description": "^5.8.15", + "metascraper-description": "^5.9.5", "metascraper-image": "^5.9.5", "metascraper-lang": "^5.8.13", "metascraper-lang-detector": "^4.10.2", diff --git a/backend/yarn.lock b/backend/yarn.lock index ebc86be73..57c3f6534 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -5919,12 +5919,12 @@ metascraper-date@^5.9.5: dependencies: "@metascraper/helpers" "^5.9.5" -metascraper-description@^5.8.15: - version "5.8.15" - resolved "https://registry.yarnpkg.com/metascraper-description/-/metascraper-description-5.8.15.tgz#9b7ce85eb72bc0ef6551edd2758b42d35739783c" - integrity sha512-vArkHijLXpSu5G33VezUvq2SRutokHDhzvinQB8XXW9TkI/BacZs4Lpr92v31/EophPap43nLwjZUDEe3h+GOA== +metascraper-description@^5.9.5: + version "5.9.5" + resolved "https://registry.yarnpkg.com/metascraper-description/-/metascraper-description-5.9.5.tgz#1b397ff97eeee963c254416d16f0d13ee7bce319" + integrity sha512-dZwk/x6dUHKCaSvtBCsTECftCi2ZGoEQbjCyvVXF3aTGz9KRxLMePkWFhrG4UXdBPvlYFwGkHp7scoIDwCXNPQ== dependencies: - "@metascraper/helpers" "^5.8.13" + "@metascraper/helpers" "^5.9.5" metascraper-image@^5.9.5: version "5.9.5" From 61e6868c18673733b9e2a28efcb94f42769801f4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2020 09:09:42 +0000 Subject: [PATCH 219/290] build(deps): bump date-fns from 2.8.1 to 2.9.0 in /webapp Bumps [date-fns](https://github.com/date-fns/date-fns) from 2.8.1 to 2.9.0. - [Release notes](https://github.com/date-fns/date-fns/releases) - [Changelog](https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md) - [Commits](https://github.com/date-fns/date-fns/compare/v2.8.1...v2.9.0) Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index cb15c5525..05850f401 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -70,7 +70,7 @@ "cookie-universal-nuxt": "~2.1.0", "cropperjs": "^1.5.5", "cross-env": "~6.0.3", - "date-fns": "2.8.1", + "date-fns": "2.9.0", "express": "~4.17.1", "graphql": "~14.5.8", "jsonwebtoken": "~8.5.1", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 3163c58df..8ea758964 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -6209,10 +6209,10 @@ data-urls@^1.0.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" -date-fns@2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.8.1.tgz#2109362ccb6c87c3ca011e9e31f702bc09e4123b" - integrity sha512-EL/C8IHvYRwAHYgFRse4MGAPSqlJVlOrhVYZ75iQBKrnv+ZedmYsgwH3t+BCDuZDXpoo07+q9j4qgSSOa7irJg== +date-fns@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.9.0.tgz#d0b175a5c37ed5f17b97e2272bbc1fa5aec677d2" + integrity sha512-khbFLu/MlzLjEzy9Gh8oY1hNt/Dvxw3J6Rbc28cVoYWQaC1S3YI4xwkF9ZWcjDLscbZlY9hISMr66RFzZagLsA== date-fns@^1.27.2: version "1.30.1" From 70d632e3926cd61682be0e73e8700910faa448c3 Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Thu, 9 Jan 2020 14:47:14 +0530 Subject: [PATCH 220/290] use scss tokens for counter icon and loading spinner --- webapp/assets/_new/styles/tokens.scss | 7 +++++++ .../_new/generic/CounterIcon/CounterIcon.vue | 10 +++++----- .../_new/generic/LoadingSpinner/LoadingSpinner.vue | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/webapp/assets/_new/styles/tokens.scss b/webapp/assets/_new/styles/tokens.scss index 29ba0286d..36c6d8d5b 100644 --- a/webapp/assets/_new/styles/tokens.scss +++ b/webapp/assets/_new/styles/tokens.scss @@ -258,6 +258,13 @@ $size-avatar-x-large: 114px; $size-button-base: 36px; $size-button-small: 26px; +/** + * @tokens Size Buttons + * @presenter Spacing + */ + + $size-icon-base: 16px; + /** * @tokens Shadow * @presenter Shadow diff --git a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue index 4f2d79a58..00b4b9c53 100644 --- a/webapp/components/_new/generic/CounterIcon/CounterIcon.vue +++ b/webapp/components/_new/generic/CounterIcon/CounterIcon.vue @@ -33,21 +33,21 @@ export default { > .count { position: absolute; - top: -4px; + top: -$space-xx-small; right: 0; display: inline-flex; align-items: center; justify-content: center; - height: 16px; - min-width: 16px; - padding: 3px; + height: $size-icon-base; + min-width: $size-icon-base; + padding: 3px; // magic number to center count border-radius: 50%; transform: translateX(50%); color: $color-neutral-100; background-color: $color-primary; - font-size: 10px; + font-size: 10px; // magic number to center count line-height: 1; text-align: center; diff --git a/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue b/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue index 74e9d91bc..529a029d9 100644 --- a/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue +++ b/webapp/components/_new/generic/LoadingSpinner/LoadingSpinner.vue @@ -12,7 +12,7 @@ export default { diff --git a/webapp/components/generic/SearchPost/SearchPost.spec.js b/webapp/components/generic/SearchPost/SearchPost.spec.js index a945444c7..39cf5dcc0 100644 --- a/webapp/components/generic/SearchPost/SearchPost.spec.js +++ b/webapp/components/generic/SearchPost/SearchPost.spec.js @@ -28,10 +28,11 @@ describe('SearchPost.vue', () => { return shallowMount(SearchPost, { mocks, localVue, propsData }) } - describe('mount', () => { + describe('shallowMount', () => { it('renders post title', () => { expect(wrapper.find('.search-option-label').text()).toMatch('Post Title') }) + it('renders post commentsCount', () => { expect( wrapper @@ -41,6 +42,7 @@ describe('SearchPost.vue', () => { .exists(), ).toBe(true) }) + it('renders post shoutedCount', () => { expect( wrapper @@ -50,9 +52,11 @@ describe('SearchPost.vue', () => { .exists(), ).toBe(true) }) + it('renders post author', () => { expect(wrapper.find('.search-post-author').text()).toContain('Post Author') }) + it('renders post createdAt', () => { expect(wrapper.find('.search-post-author').text()).toContain('23.08.2019') }) diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index 77955be83..d5320932c 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -2,7 +2,7 @@ import { config, mount } from '@vue/test-utils' import Vuex from 'vuex' import Vue from 'vue' import SearchableInput from './SearchableInput' -import { results } from '~/components/features/SearchResources/SearchResources.story' +import { results } from '~/components/features/SearchField/SearchField.story' const localVue = global.localVue diff --git a/webapp/components/generic/SearchableInput/SearchableInput.vue b/webapp/components/generic/SearchableInput/SearchableInput.vue index 1d80246cc..5a5c38525 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.vue +++ b/webapp/components/generic/SearchableInput/SearchableInput.vue @@ -39,13 +39,13 @@ @@ -62,6 +62,7 @@ import SearchPost from '~/components/generic/SearchPost/SearchPost.vue' import HcUser from '~/components/User/User.vue' export default { + name: 'SearchableInput', components: { SearchHeading, SearchPost, @@ -169,25 +170,16 @@ export default { }, } -