From 490fb7fdeb3f666756504f10fd073a9776b700d5 Mon Sep 17 00:00:00 2001 From: ogerly Date: Sat, 21 Dec 2019 22:11:38 +0100 Subject: [PATCH 01/17] first example dynamisch usermention for answer comments --- webapp/components/Comment/Comment.vue | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index cc7f815b9..3da39f435 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -55,6 +55,13 @@ + +
@@ -168,6 +175,22 @@ export default { this.$toast.error(err.message) } }, + answerComment() { + if (document.querySelector('.is-empty')) { + document.querySelector('.is-empty').innerHTML = '@' + this.comment.author.slug + } else { + const html = document.querySelector('.editor-content').innerHTML + const slug = + '@d' + + this.comment.author.slug + + '' + document.querySelector('.editor-content').innerHTML = html + '' + slug + } + }, }, } From 28839ee2b4f8c5d77965d24b4e24d312fc43eb91 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 6 Jan 2020 18:02:46 +0100 Subject: [PATCH 02/17] click on 'answered' to put the username of the respective comment into the editor as a mention. --- webapp/components/Comment/Comment.vue | 26 ++++++++++++++------------ webapp/locales/de.json | 3 ++- webapp/locales/en.json | 3 ++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 3da39f435..46163bed0 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -56,7 +56,7 @@ @d' + + this.comment.author.slug + + '' + document.querySelector('.editor-content div').focus() if (document.querySelector('.is-empty')) { - document.querySelector('.is-empty').innerHTML = '@' + this.comment.author.slug + document.querySelector('.is-empty').innerHTML = slug + ' ' } else { - const html = document.querySelector('.editor-content').innerHTML - const slug = - '@d' + - this.comment.author.slug + - '' - document.querySelector('.editor-content').innerHTML = html + '' + slug + const html = document.querySelector('.editor-content').innerHTML + document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' ' } }, }, diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 880d22c87..060892d03 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -269,7 +269,8 @@ "comment": { "submit": "Kommentiere", "submitted": "Kommentar Gesendet", - "updated": "Änderungen gespeichert" + "updated": "Änderungen gespeichert", + "answered": "answered" }, "edited": "bearbeitet" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 94183d7e7..69215d484 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -423,7 +423,8 @@ "comment": { "submit": "Comment", "submitted": "Comment Submitted", - "updated": "Changes Saved" + "updated": "Changes Saved", + "answered": "answered" }, "edited": "edited" }, From 9aa680ce509f62f57774981815094a1c273d8fa6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 7 Jan 2020 05:40:09 +0100 Subject: [PATCH 03/17] Fix lint --- webapp/components/Comment/Comment.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 46163bed0..ed7b9b064 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -113,8 +113,8 @@ export default { if (this.isLongComment && this.isCollapsed) { return this.$filters.truncate(this.comment.content, COMMENT_TRUNCATE_TO_LENGTH) } - - return this.comment.content + // console.log(this.comment.content.replace(/\?/gi, '?++')) + return this.comment.content.replace(/\?/gi, ' ') }, displaysComment() { return !this.unavailable || this.isModerator @@ -187,10 +187,10 @@ export default { '' document.querySelector('.editor-content div').focus() if (document.querySelector('.is-empty')) { - document.querySelector('.is-empty').innerHTML = slug + ' ' + document.querySelector('.is-empty').innerHTML = slug + ' ' } else { - const html = document.querySelector('.editor-content').innerHTML - document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' ' + const html = document.querySelector('.editor-content').innerHTML + document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' ' } }, }, From 223d1ca3c01659ebbf2c8da090cd17dfb5fc9f41 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 7 Jan 2020 06:02:19 +0100 Subject: [PATCH 04/17] remove console --- webapp/components/Comment/Comment.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index ed7b9b064..3063fc400 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -114,7 +114,7 @@ export default { return this.$filters.truncate(this.comment.content, COMMENT_TRUNCATE_TO_LENGTH) } // console.log(this.comment.content.replace(/\?/gi, '?++')) - return this.comment.content.replace(/\?/gi, ' ') + return this.comment.content }, displaysComment() { return !this.unavailable || this.isModerator From 9d09dae2f44995a8216804afe15e4a51d4f8b5c8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 14 Jan 2020 18:36:35 +0100 Subject: [PATCH 05/17] slug from editor comands set --- webapp/components/Comment/Comment.vue | 41 ++++++++----------- webapp/components/CommentForm/CommentForm.vue | 3 ++ webapp/components/CommentList/CommentList.vue | 4 ++ webapp/components/Editor/Editor.vue | 4 +- webapp/locales/de.json | 2 +- webapp/locales/en.json | 2 +- webapp/pages/post/_id/_slug/index.vue | 11 ++++- 7 files changed, 38 insertions(+), 29 deletions(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 3063fc400..aeedb9e52 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -54,13 +54,14 @@ + -
@@ -86,7 +87,6 @@ export default { isTarget, isCollapsed: !isTarget, openEditCommentMenu: false, - answered: this.$t('post.comment.answered'), } }, components: { @@ -113,7 +113,6 @@ export default { if (this.isLongComment && this.isCollapsed) { return this.$filters.truncate(this.comment.content, COMMENT_TRUNCATE_TO_LENGTH) } - // console.log(this.comment.content.replace(/\?/gi, '?++')) return this.comment.content }, displaysComment() { @@ -149,6 +148,10 @@ export default { }, }, methods: { + reply(comment) { + const message = { slug: this.comment.author.slug, id: this.comment.author.id } + this.$emit('reply', message) + }, checkAnchor(anchor) { return `#${this.anchor}` === anchor }, @@ -176,23 +179,6 @@ export default { this.$toast.error(err.message) } }, - answerComment() { - const slug = - '@d' + - this.comment.author.slug + - '' - document.querySelector('.editor-content div').focus() - if (document.querySelector('.is-empty')) { - document.querySelector('.is-empty').innerHTML = slug + ' ' - } else { - const html = document.querySelector('.editor-content').innerHTML - document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' ' - } - }, }, } @@ -218,6 +204,11 @@ export default { float: right; } +.answerbutton { + float: right; + top: 0px; +} + @keyframes highlight { 0% { border: 1px solid $color-primary; diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 6cdd08af3..c2a0e4562 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -57,6 +57,9 @@ export default { } }, methods: { + reply(message) { + this.$refs.editor.insertReply(message) + }, updateEditorContent(value) { const sanitizedContent = this.$filters.removeHtml(value, false) if (!this.update) { diff --git a/webapp/components/CommentList/CommentList.vue b/webapp/components/CommentList/CommentList.vue index 25ed62f68..d21f2b407 100644 --- a/webapp/components/CommentList/CommentList.vue +++ b/webapp/components/CommentList/CommentList.vue @@ -8,6 +8,7 @@
{} }, }, methods: { + reply(message) { + this.$emit('reply', message) + }, checkAnchor(anchor) { return anchor === '#comments' }, diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index 6c8a1908a..f62d7abf7 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -141,7 +141,6 @@ export default { methods: { openSuggestionList({ items, query, range, command, virtualNode }, suggestionType) { this.suggestionType = suggestionType - this.query = this.sanitizeQuery(query) this.filteredItems = items this.suggestionRange = range @@ -237,6 +236,9 @@ export default { const content = e.getHTML() this.$emit('input', content) }, + insertReply(message) { + this.editor.commands.mention({ id: message.id, label: message.slug }) + }, toggleLinkInput(attrs, element) { if (!this.isLinkInputActive && attrs && element) { this.$refs.linkInput.linkUrl = attrs.href diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 060892d03..a394424cb 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -270,7 +270,7 @@ "submit": "Kommentiere", "submitted": "Kommentar Gesendet", "updated": "Änderungen gespeichert", - "answered": "answered" + "answer": "Antworten" }, "edited": "bearbeitet" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 69215d484..e6e3426a7 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -424,7 +424,7 @@ "submit": "Comment", "submitted": "Comment Submitted", "updated": "Changes Saved", - "answered": "answered" + "answer": "Answer" }, "edited": "edited" }, diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 067650d15..06bbe554d 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -72,12 +72,18 @@ - + @@ -150,6 +156,9 @@ export default { }, }, methods: { + reply(message) { + this.$refs.commentForm && this.$refs.commentForm.reply(message) + }, isAuthor(id) { return this.$store.getters['auth/user'].id === id }, From 8edb551c159272f005da502d7a021105dd0904d2 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 15 Jan 2020 07:40:01 +0100 Subject: [PATCH 06/17] ready to be merged or rebased --- webapp/components/Comment/Comment.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index aeedb9e52..b31414449 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -60,9 +60,9 @@ @click.prevent="reply" v-scroll-to="'.editor'" class="answerbutton" + size="small" > -
@@ -208,6 +208,9 @@ export default { float: right; top: 0px; } +.answerbutton:after { + clear: both; +} @keyframes highlight { 0% { From 6877c9da91c65037b06c653af2ea85effd827ebf Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 16 Jan 2020 12:29:28 +0100 Subject: [PATCH 07/17] Use new base-button, rename CSS class --- webapp/assets/_new/icons/svgs/level-down.svg | 5 +++++ webapp/components/Comment/Comment.vue | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100755 webapp/assets/_new/icons/svgs/level-down.svg diff --git a/webapp/assets/_new/icons/svgs/level-down.svg b/webapp/assets/_new/icons/svgs/level-down.svg new file mode 100755 index 000000000..e6455391e --- /dev/null +++ b/webapp/assets/_new/icons/svgs/level-down.svg @@ -0,0 +1,5 @@ + + +level-down + + diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index b31414449..b682c712a 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -54,14 +54,15 @@ - + > @@ -75,6 +76,7 @@ import ContentViewer from '~/components/Editor/ContentViewer' import HcCommentForm from '~/components/CommentForm/CommentForm' import CommentMutations from '~/graphql/CommentMutations' import scrollToAnchor from '~/mixins/scrollToAnchor.js' +import BaseButton from '~/components/_new/generic/BaseButton/BaseButton' export default { mixins: [scrollToAnchor], @@ -94,6 +96,7 @@ export default { ContentMenu, ContentViewer, HcCommentForm, + BaseButton, }, props: { routeHash: { type: String, default: () => '' }, @@ -204,11 +207,11 @@ export default { float: right; } -.answerbutton { +.reply-button { float: right; top: 0px; } -.answerbutton:after { +.reply-button:after { clear: both; } From 73b005a900d43ccc639a3250ac77ae0ff4a54718 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 20 Jan 2020 11:18:35 +0100 Subject: [PATCH 08/17] test: added some test --- webapp/components/Comment/Comment.spec.js | 25 ++++++++++++++++--- webapp/components/Comment/Comment.vue | 11 ++++---- .../CommentList/CommentList.spec.js | 18 +++++++++++++ webapp/components/CommentList/CommentList.vue | 1 + webapp/locales/de.json | 2 +- webapp/locales/en.json | 2 +- webapp/pages/post/_id/_slug/index.spec.js | 19 ++++++++++++-- 7 files changed, 66 insertions(+), 12 deletions(-) diff --git a/webapp/components/Comment/Comment.spec.js b/webapp/components/Comment/Comment.spec.js index b307700d9..ea04d7c5b 100644 --- a/webapp/components/Comment/Comment.spec.js +++ b/webapp/components/Comment/Comment.spec.js @@ -1,4 +1,4 @@ -import { config, shallowMount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import Comment from './Comment.vue' import Vuex from 'vuex' @@ -47,14 +47,14 @@ describe('Comment.vue', () => { } }) - describe('shallowMount', () => { + describe('mount', () => { beforeEach(jest.useFakeTimers) Wrapper = () => { const store = new Vuex.Store({ getters, }) - return shallowMount(Comment, { + return mount(Comment, { store, propsData, mocks, @@ -68,6 +68,7 @@ describe('Comment.vue', () => { id: '2', contentExcerpt: 'Hello I am a comment content', content: 'Hello I am comment content', + author: { id: 'commentAuthorId', slug: 'ogerly'} } }) @@ -199,6 +200,24 @@ describe('Comment.vue', () => { }) }) }) + + describe('click reply button', () => { + + beforeEach(async () => { + wrapper = Wrapper() + await wrapper.find('.reply-button').trigger('click') + }) + it('emits "reply"', () => { + expect(wrapper.emitted('reply')).toEqual([ + [ + { + id: 'commentAuthorId', + slug: 'ogerly' + }, + ], + ]) + }) + }) }) }) }) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index b31414449..da205aaee 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -55,11 +55,11 @@ @@ -76,6 +76,7 @@ import HcCommentForm from '~/components/CommentForm/CommentForm' import CommentMutations from '~/graphql/CommentMutations' import scrollToAnchor from '~/mixins/scrollToAnchor.js' + export default { mixins: [scrollToAnchor], data() { @@ -148,7 +149,7 @@ export default { }, }, methods: { - reply(comment) { + reply() { const message = { slug: this.comment.author.slug, id: this.comment.author.id } this.$emit('reply', message) }, @@ -204,11 +205,11 @@ export default { float: right; } -.answerbutton { +.reply-button { float: right; top: 0px; } -.answerbutton:after { +.reply-button:after { clear: both; } diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 0c037d2ff..0b4a667a7 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -103,4 +103,22 @@ describe('CommentList.vue', () => { }) }) }) + + describe('Comment', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('Comment emitted reply()', () => { + wrapper.find('.comment-tag').vm.$emit('reply') + expect(wrapper.emitted('reply')).toEqual([ + [ + { + id: 'commentAuthorId', + slug: 'ogerly' + }, + ], + ]) + }) + }) }) diff --git a/webapp/components/CommentList/CommentList.vue b/webapp/components/CommentList/CommentList.vue index d21f2b407..061210176 100644 --- a/webapp/components/CommentList/CommentList.vue +++ b/webapp/components/CommentList/CommentList.vue @@ -17,6 +17,7 @@ @deleteComment="updateCommentList" @updateComment="updateCommentList" @toggleNewCommentForm="toggleNewCommentForm" + class="comment-tag" /> diff --git a/webapp/locales/de.json b/webapp/locales/de.json index a394424cb..de9797596 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -270,7 +270,7 @@ "submit": "Kommentiere", "submitted": "Kommentar Gesendet", "updated": "Änderungen gespeichert", - "answer": "Antworten" + "reply": "Antworten" }, "edited": "bearbeitet" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index e6e3426a7..9226793c1 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -424,7 +424,7 @@ "submit": "Comment", "submitted": "Comment Submitted", "updated": "Changes Saved", - "answer": "Answer" + "reply": "Reply" }, "edited": "edited" }, diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index db960bb67..d7c234c4c 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -1,16 +1,16 @@ import { config, shallowMount } from '@vue/test-utils' import PostSlug from './index.vue' import Vuex from 'vuex' +import CommentList from '~/components/CommentList/CommentList' const localVue = global.localVue -config.stubs['client-only'] = '' - describe('PostSlug', () => { let wrapper let Wrapper let store let mocks + let propsData beforeEach(() => { store = new Vuex.Store({ @@ -20,6 +20,7 @@ describe('PostSlug', () => { }, }, }) + propsData = {} mocks = { $t: jest.fn(), $filters: { @@ -44,12 +45,14 @@ describe('PostSlug', () => { } }) + describe('shallowMount', () => { Wrapper = () => { return shallowMount(PostSlug, { store, mocks, localVue, + propsData, }) } @@ -92,4 +95,16 @@ describe('PostSlug', () => { }) }) }) + + describe('given a comment', () => { + wrapper = Wrapper() + const bar = wrapper.find(CommentList) + it('hc-comment-list', () => { + expect(bar).toBe({"selector": "Component"}) + }) + + + + }) }) + From 00c03979190d8c326b2512085e75ac6b7acfcc04 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 22 Jan 2020 11:25:44 +0100 Subject: [PATCH 09/17] test: specs is not ok --- webapp/components/Comment/Comment.spec.js | 22 ++--- webapp/components/Comment/Comment.vue | 1 - .../CommentList/CommentList.spec.js | 31 ++++--- webapp/pages/post/_id/_slug/index.spec.js | 80 ++++++++++++------- webapp/pages/post/_id/_slug/index.vue | 15 ++-- 5 files changed, 86 insertions(+), 63 deletions(-) diff --git a/webapp/components/Comment/Comment.spec.js b/webapp/components/Comment/Comment.spec.js index ea04d7c5b..229d88663 100644 --- a/webapp/components/Comment/Comment.spec.js +++ b/webapp/components/Comment/Comment.spec.js @@ -68,7 +68,7 @@ describe('Comment.vue', () => { id: '2', contentExcerpt: 'Hello I am a comment content', content: 'Hello I am comment content', - author: { id: 'commentAuthorId', slug: 'ogerly'} + author: { id: 'commentAuthorId', slug: 'ogerly' }, } }) @@ -202,21 +202,21 @@ describe('Comment.vue', () => { }) describe('click reply button', () => { - beforeEach(async () => { wrapper = Wrapper() await wrapper.find('.reply-button').trigger('click') - }) + }) + it('emits "reply"', () => { expect(wrapper.emitted('reply')).toEqual([ - [ - { - id: 'commentAuthorId', - slug: 'ogerly' - }, - ], - ]) - }) + [ + { + id: 'commentAuthorId', + slug: 'ogerly', + }, + ], + ]) + }) }) }) }) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index da205aaee..4df37ff2d 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -76,7 +76,6 @@ import HcCommentForm from '~/components/CommentForm/CommentForm' import CommentMutations from '~/graphql/CommentMutations' import scrollToAnchor from '~/mixins/scrollToAnchor.js' - export default { mixins: [scrollToAnchor], data() { diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 0b4a667a7..c8d0b0ca6 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -102,23 +102,22 @@ describe('CommentList.vue', () => { }) }) }) - }) - describe('Comment', () => { - beforeEach(() => { - wrapper = Wrapper() + describe('Comment', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + it.only('Comment emitted reply()', () => { + wrapper.find('.comment-tag').vm.$emit('reply') + expect(wrapper.emitted('reply')).toEqual([ + [ + { + id: 'commentAuthorId', + slug: 'ogerly', + }, + ], + ]) + }) }) - - it('Comment emitted reply()', () => { - wrapper.find('.comment-tag').vm.$emit('reply') - expect(wrapper.emitted('reply')).toEqual([ - [ - { - id: 'commentAuthorId', - slug: 'ogerly' - }, - ], - ]) - }) }) }) diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index d7c234c4c..7ab4dcb28 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -1,7 +1,11 @@ -import { config, shallowMount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import PostSlug from './index.vue' import Vuex from 'vuex' -import CommentList from '~/components/CommentList/CommentList' +import Vue from 'vue' + +config.stubs['client-only'] = '' +config.stubs['nuxt-link'] = '' +config.stubs['router-link'] = '' const localVue = global.localVue @@ -16,8 +20,9 @@ describe('PostSlug', () => { store = new Vuex.Store({ getters: { 'auth/user': () => { - return {} + return { id: '1stUser' } }, + 'auth/isModerator': () => false, }, }) propsData = {} @@ -25,6 +30,7 @@ describe('PostSlug', () => { $t: jest.fn(), $filters: { truncate: a => a, + removeHtml: a => a, }, $route: { hash: '', @@ -41,14 +47,15 @@ describe('PostSlug', () => { }, $apollo: { mutate: jest.fn().mockResolvedValue(), + query: jest.fn().mockResolvedValue(), }, + $scrollTo: jest.fn(), } }) - - describe('shallowMount', () => { + describe('mount', () => { Wrapper = () => { - return shallowMount(PostSlug, { + return mount(PostSlug, { store, mocks, localVue, @@ -56,20 +63,18 @@ describe('PostSlug', () => { }) } - beforeEach(jest.useFakeTimers) - describe('test Post callbacks', () => { beforeEach(() => { wrapper = Wrapper() - wrapper.setData({ - post: { - id: 'p23', - name: 'It is a post', - author: { - id: 'u1', - }, - }, - }) + // wrapper.setData({ + // post: { + // id: 'p23', + // name: 'It is a post', + // author: { + // id: 'u1', + // }, + // }, + // }) }) describe('deletion of Post from Page by invoking "deletePostCallback()"', () => { @@ -94,17 +99,38 @@ describe('PostSlug', () => { }) }) }) - }) - describe('given a comment', () => { - wrapper = Wrapper() - const bar = wrapper.find(CommentList) - it('hc-comment-list', () => { - expect(bar).toBe({"selector": "Component"}) + describe('test Post callbacks', () => { + beforeEach(() => { + beforeEach(jest.useFakeTimers) + wrapper = Wrapper() + }) + it('CommentList', () => { + wrapper.setData({ + post: { + id: 1, + author: { + id: '1stUser', + }, + comments: [ + { + id: 'comment134', + contentExcerpt: 'this is a comment', + content: 'this is a comment', + author: { + id: '1stUser', + slug: '1st-user', + }, + }, + ], + }, + }) + jest.runAllTimers() + Vue.nextTick() + const spy = jest.spyOn(wrapper.vm, 'reply') + console.log(spy) + expect(spy).toBe(true) + }) }) - - - }) }) - diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 06bbe554d..27c6fe0a8 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -72,10 +72,11 @@ { // NOTE: quick fix for jumping flexbox implementation @@ -210,6 +205,10 @@ export default { id: this.$route.params.id, } }, + update({ Post }) { + this.post = Post + this.title = this.post.title + }, fetchPolicy: 'cache-and-network', }, }, From d15037607ca0dec4d95f15130183ac0bb129afe5 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 23 Jan 2020 13:05:36 +0100 Subject: [PATCH 10/17] Add component test for direct reply to comment - we have found it challenging to add component tests that mount the tiptap editor, so we are stubbing it, which means that we will add e2e tests to up the coverage of how much of the workflow has automated tests --- webapp/components/Comment/Comment.spec.js | 3 + webapp/components/CommentForm/CommentForm.vue | 5 +- .../CommentList/CommentList.spec.js | 11 ++- webapp/pages/post/_id/_slug/index.spec.js | 96 +++++++++---------- webapp/pages/post/_id/_slug/index.vue | 19 ++-- 5 files changed, 67 insertions(+), 67 deletions(-) diff --git a/webapp/components/Comment/Comment.spec.js b/webapp/components/Comment/Comment.spec.js index 229d88663..dc97f0569 100644 --- a/webapp/components/Comment/Comment.spec.js +++ b/webapp/components/Comment/Comment.spec.js @@ -3,8 +3,11 @@ import Comment from './Comment.vue' import Vuex from 'vuex' const localVue = global.localVue +localVue.directive('scrollTo', jest.fn()) config.stubs['client-only'] = '' +config.stubs['nuxt-link'] = '' +config.stubs['content-viewer'] = '' describe('Comment.vue', () => { let propsData diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 61cba42d5..81eceb21c 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -52,6 +52,7 @@ export default { }, methods: { reply(message) { + if (!this.$refs.editor.insertReply) return null this.$refs.editor.insertReply(message) }, updateEditorContent(value) { @@ -136,8 +137,8 @@ export default { query() { return minimisedUserQuery() }, - result(result) { - this.users = result.data.User + update({ User }) { + this.users = User }, }, }, diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 4feef5c77..02d2f2f42 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -1,10 +1,13 @@ import { config, mount } from '@vue/test-utils' import CommentList from './CommentList' +import Comment from '~/components/Comment/Comment' import Vuex from 'vuex' +import Vue from 'vue' const localVue = global.localVue localVue.filter('truncate', string => string) +localVue.directive('scrollTo', jest.fn()) config.stubs['v-popover'] = '' config.stubs['nuxt-link'] = '' @@ -102,8 +105,12 @@ describe('CommentList.vue', () => { beforeEach(() => { wrapper = Wrapper() }) - it.only('Comment emitted reply()', () => { - wrapper.find('.comment-tag').vm.$emit('reply') + it('Comment emitted reply()', () => { + wrapper.find(Comment).vm.$emit('reply', { + id: 'commentAuthorId', + slug: 'ogerly', + }) + Vue.nextTick() expect(wrapper.emitted('reply')).toEqual([ [ { diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index e66e124ad..f662539c8 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -1,20 +1,20 @@ import { config, mount } from '@vue/test-utils' -import PostSlug from './index.vue' import Vuex from 'vuex' -import Vue from 'vue' +import PostSlug from './index.vue' +import CommentList from '~/components/CommentList/CommentList' config.stubs['client-only'] = '' config.stubs['nuxt-link'] = '' config.stubs['router-link'] = '' +config.stubs['content-viewer'] = '' +config.stubs['hc-editor'] = '' +config.stubs['hc-emotions'] = '' const localVue = global.localVue +localVue.directive('scrollTo', jest.fn()) describe('PostSlug', () => { - let wrapper - let Wrapper - let store - let mocks - let propsData + let wrapper, Wrapper, store, mocks, propsData, spy beforeEach(() => { store = new Vuex.Store({ @@ -50,7 +50,38 @@ describe('PostSlug', () => { query: jest.fn().mockResolvedValue(), }, $scrollTo: jest.fn(), + $refs: { + editor: { + insertReply: jest.fn(), + }, + commentForm: { + reply: jest.fn(), + }, + }, } + jest.useFakeTimers() + wrapper = Wrapper() + wrapper.setData({ + post: { + id: '1', + author: { + id: '1stUser', + }, + comments: [ + { + id: 'comment134', + contentExcerpt: 'this is a comment', + content: 'this is a comment', + author: { + id: '1stUser', + slug: '1st-user', + }, + }, + ], + }, + ready: true, + }) + spy = jest.spyOn(wrapper.vm, 'reply') }) describe('mount', () => { @@ -64,22 +95,9 @@ describe('PostSlug', () => { } describe('test Post callbacks', () => { - beforeEach(() => { - wrapper = Wrapper() - // wrapper.setData({ - // post: { - // id: 'p23', - // name: 'It is a post', - // author: { - // id: 'u1', - // }, - // }, - // }) - }) - describe('deletion of Post from Page by invoking "deletePostCallback()"', () => { - beforeEach(() => { - wrapper.vm.deletePostCallback() + beforeEach(async () => { + await wrapper.vm.deletePostCallback() }) describe('after timeout', () => { @@ -100,35 +118,13 @@ describe('PostSlug', () => { }) }) - describe('test Post callbacks', () => { - beforeEach(() => { - beforeEach(jest.useFakeTimers) - wrapper = Wrapper() - }) - it('CommentList', () => { - wrapper.setData({ - post: { - id: 1, - author: { - id: '1stUser', - }, - comments: [ - { - id: 'comment134', - contentExcerpt: 'this is a comment', - content: 'this is a comment', - author: { - id: '1stUser', - slug: '1st-user', - }, - }, - ], - }, + describe('reply method called when emitted reply received', () => { + it('CommentList', async () => { + wrapper.find(CommentList).vm.$emit('reply', { + id: 'commentAuthorId', + slug: 'ogerly', }) - jest.runAllTimers() - Vue.nextTick() - const spy = jest.spyOn(wrapper.vm, 'reply') - expect(spy).toBe(true) + expect(spy).toHaveBeenCalledTimes(1) }) }) }) diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 2a703a96b..dac0dc36a 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -84,8 +84,7 @@ - { // NOTE: quick fix for jumping flexbox implementation @@ -227,8 +219,9 @@ export default { } }, update({ Post }) { - this.post = Post + this.post = Post[0] || {} this.title = this.post.title + this.blurred = this.post.imageBlurred }, fetchPolicy: 'cache-and-network', }, From 853ff9b92b32493af778af62f1a63dca5edb03f0 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 23 Jan 2020 14:03:14 +0100 Subject: [PATCH 11/17] Stub component, rename component, refactor - We need to stub the Editor since it throws difficult to interpret errors about view.root.getSelection, but we want to stub it's methods as well, so that we don't need a guard clause just for tests. - CommentForm is already multiword - Favor update over result for Vue apollo smart queries --- webapp/components/Comment/Comment.spec.js | 11 +++++------ webapp/components/Comment/Comment.vue | 6 +++--- webapp/components/CommentForm/CommentForm.vue | 1 - webapp/components/Emotions/Emotions.vue | 2 +- webapp/pages/post/_id/_slug/index.spec.js | 12 +++++++----- webapp/pages/post/_id/_slug/index.vue | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/webapp/components/Comment/Comment.spec.js b/webapp/components/Comment/Comment.spec.js index dc97f0569..1ba238bf5 100644 --- a/webapp/components/Comment/Comment.spec.js +++ b/webapp/components/Comment/Comment.spec.js @@ -7,14 +7,9 @@ localVue.directive('scrollTo', jest.fn()) config.stubs['client-only'] = '' config.stubs['nuxt-link'] = '' -config.stubs['content-viewer'] = '' describe('Comment.vue', () => { - let propsData - let mocks - let getters - let wrapper - let Wrapper + let propsData, mocks, stubs, getters, wrapper, Wrapper beforeEach(() => { propsData = {} @@ -42,6 +37,9 @@ describe('Comment.vue', () => { }), }, } + stubs = { + ContentViewer: true, + } getters = { 'auth/user': () => { return {} @@ -62,6 +60,7 @@ describe('Comment.vue', () => { propsData, mocks, localVue, + stubs, }) } diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 239cdf817..0f37dae5d 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -33,7 +33,7 @@
- { - let wrapper, Wrapper, store, mocks, propsData, spy + let store, propsData, mocks, stubs, wrapper, Wrapper, spy beforeEach(() => { store = new Vuex.Store({ @@ -47,7 +44,7 @@ describe('PostSlug', () => { }, $apollo: { mutate: jest.fn().mockResolvedValue(), - query: jest.fn().mockResolvedValue(), + query: jest.fn().mockResolvedValue({ data: { PostEmotionsCountByEmotion: {} } }), }, $scrollTo: jest.fn(), $refs: { @@ -59,6 +56,10 @@ describe('PostSlug', () => { }, }, } + stubs = { + HcEditor: { render: () => {}, methods: { insertReply: () => null } }, + ContentViewer: true, + } jest.useFakeTimers() wrapper = Wrapper() wrapper.setData({ @@ -91,6 +92,7 @@ describe('PostSlug', () => { mocks, localVue, propsData, + stubs, }) } diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index dac0dc36a..79e0af21c 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -91,7 +91,7 @@ @reply="reply" /> - Date: Mon, 27 Jan 2020 13:44:40 +0100 Subject: [PATCH 12/17] Check that stubbed component method is called --- .../components/CommentList/CommentList.spec.js | 1 + webapp/pages/post/_id/_slug/index.spec.js | 18 ++++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 02d2f2f42..ac7b88c0e 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -105,6 +105,7 @@ describe('CommentList.vue', () => { beforeEach(() => { wrapper = Wrapper() }) + it('Comment emitted reply()', () => { wrapper.find(Comment).vm.$emit('reply', { id: 'commentAuthorId', diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index 2ae34b15e..6c5cb5259 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -11,7 +11,7 @@ const localVue = global.localVue localVue.directive('scrollTo', jest.fn()) describe('PostSlug', () => { - let store, propsData, mocks, stubs, wrapper, Wrapper, spy + let store, propsData, mocks, stubs, wrapper, Wrapper beforeEach(() => { store = new Vuex.Store({ @@ -47,17 +47,9 @@ describe('PostSlug', () => { query: jest.fn().mockResolvedValue({ data: { PostEmotionsCountByEmotion: {} } }), }, $scrollTo: jest.fn(), - $refs: { - editor: { - insertReply: jest.fn(), - }, - commentForm: { - reply: jest.fn(), - }, - }, } stubs = { - HcEditor: { render: () => {}, methods: { insertReply: () => null } }, + HcEditor: { render: () => {}, methods: { insertReply: jest.fn(() => null) } }, ContentViewer: true, } jest.useFakeTimers() @@ -82,7 +74,6 @@ describe('PostSlug', () => { }, ready: true, }) - spy = jest.spyOn(wrapper.vm, 'reply') }) describe('mount', () => { @@ -126,7 +117,10 @@ describe('PostSlug', () => { id: 'commentAuthorId', slug: 'ogerly', }) - expect(spy).toHaveBeenCalledTimes(1) + expect(stubs.HcEditor.methods.insertReply).toHaveBeenCalledWith({ + id: 'commentAuthorId', + slug: 'ogerly', + }) }) }) }) From b48b93dd0d2dc03fc2342fe3c8c7fbb2a8e5fbc5 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Mon, 27 Jan 2020 15:07:32 +0100 Subject: [PATCH 13/17] Set up cypress test for direct reply to comment --- backend/src/models/Post.js | 10 ++++++++++ backend/src/seed/factories/posts.js | 11 +++++++++++ cypress/integration/common/post.js | 11 +++++++++++ cypress/integration/post/Comment.feature | 13 +++++++++---- cypress/support/commands.js | 1 - 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js index fd1e5b2ac..70b0d8793 100644 --- a/backend/src/models/Post.js +++ b/backend/src/models/Post.js @@ -41,4 +41,14 @@ export default { language: { type: 'string', allow: [null] }, imageBlurred: { type: 'boolean', default: false }, imageAspectRatio: { type: 'float', default: 1.0 }, + comments: { + type: 'relationship', + relationship: 'COMMENTS', + target: 'Comment', + direction: 'in', + properties: { + createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() }, + updatedAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() }, + }, + }, } diff --git a/backend/src/seed/factories/posts.js b/backend/src/seed/factories/posts.js index 55f4f95fb..e93941c88 100644 --- a/backend/src/seed/factories/posts.js +++ b/backend/src/seed/factories/posts.js @@ -52,7 +52,18 @@ export default function create() { author = author || (await factoryInstance.create('User')) const post = await neodeInstance.create('Post', args) + + let { comment, commentContent } = args + delete args.comment + delete args.commentContent + if (comment && commentContent) throw new Error('You provided both comment and commentContent') + if (commentContent) comment = await neodeInstance.find('Comment', commentContent) + comment = + comment || + (await factoryInstance.create('Comment', { content: commentContent, post, author })) + await post.relateTo(author, 'author') + await post.relateTo(comment, 'comments') await Promise.all(categories.map(c => c.relateTo(post, 'post'))) await Promise.all(tags.map(t => t.relateTo(post, 'post'))) return post diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index 4d1856bcc..02c50ab64 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -17,6 +17,11 @@ Then("I click on the {string} button", text => { .click(); }); +Then("I click on the reply button", () => { + cy.get(".reply-button") + .click(); +}); + Then("my comment should be successfully created", () => { cy.get(".iziToast-message").contains("Comment Submitted"); }); @@ -44,3 +49,9 @@ Then("I should see an abreviated version of my comment", () => { Then("the editor should be cleared", () => { cy.get(".ProseMirror p").should("have.class", "is-empty"); }); + +Then("it should create a mention in the CommentForm", () => { + cy.get(".ProseMirror a") + .should('have.class', 'mention') + .should('contain', '@peter-pan') +}) \ No newline at end of file diff --git a/cypress/integration/post/Comment.feature b/cypress/integration/post/Comment.feature index 50284d6f5..66cf7a6d7 100644 --- a/cypress/integration/post/Comment.feature +++ b/cypress/integration/post/Comment.feature @@ -4,10 +4,10 @@ Feature: Post Comment To be able to express my thoughts and emotions about these, discuss, and add give further information. Background: - Given we have the following posts in our database: - | id | title | slug | - | bWBjpkTKZp | 101 Essays that will change the way you think | 101-essays | - And I have a user account + Given I have a user account + And we have the following posts in our database: + | id | title | slug | authorId | commentContent | + | bWBjpkTKZp | 101 Essays that will change the way you think | 101-essays | id-of-peter-pan | @peter-pan reply to me | And I am logged in Scenario: Comment creation @@ -36,3 +36,8 @@ Feature: Post Comment Then my comment should be successfully created And I should see an abreviated version of my comment And the editor should be cleared + + Scenario: Direct reply to Comment + Given I visit "post/bWBjpkTKZp/101-essays" + And I click on the reply button + Then it should create a mention in the CommentForm diff --git a/cypress/support/commands.js b/cypress/support/commands.js index c9a2e213a..16ac43a19 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -15,7 +15,6 @@ /* globals Cypress cy */ import "cypress-file-upload"; import helpers from "./helpers"; -import users from "../fixtures/users.json"; import { GraphQLClient, request } from 'graphql-request' import { gql } from '../../backend/src/helpers/jest' import config from '../../backend/src/config' From d6a5b7ce6577aebbbe2cbfa593e9fbb0b44977d6 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Mon, 27 Jan 2020 17:32:09 +0100 Subject: [PATCH 14/17] Update post factories with guard clause --- backend/src/seed/factories/posts.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/src/seed/factories/posts.js b/backend/src/seed/factories/posts.js index e93941c88..a6ef700ad 100644 --- a/backend/src/seed/factories/posts.js +++ b/backend/src/seed/factories/posts.js @@ -53,17 +53,18 @@ export default function create() { const post = await neodeInstance.create('Post', args) - let { comment, commentContent } = args - delete args.comment + const { commentContent } = args + let comment delete args.commentContent - if (comment && commentContent) throw new Error('You provided both comment and commentContent') - if (commentContent) comment = await neodeInstance.find('Comment', commentContent) - comment = - comment || - (await factoryInstance.create('Comment', { content: commentContent, post, author })) + if (commentContent) + comment = await factoryInstance.create('Comment', { + contentExcerpt: commentContent, + post, + author, + }) await post.relateTo(author, 'author') - await post.relateTo(comment, 'comments') + if (comment) await post.relateTo(comment, 'comments') await Promise.all(categories.map(c => c.relateTo(post, 'post'))) await Promise.all(tags.map(t => t.relateTo(post, 'post'))) return post From 35395d15a204ea8948adc9a54fae0fa0b9cfde21 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Mon, 27 Jan 2020 20:37:54 +0100 Subject: [PATCH 15/17] Add missing . for chain method --- cypress/integration/common/post.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index 2a1dbad54..064c84cb5 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -53,7 +53,7 @@ Then("the editor should be cleared", () => { Then("it should create a mention in the CommentForm", () => { cy.get(".ProseMirror a") .should('have.class', 'mention') - should('contain', '@peter-pan') + .should('contain', '@peter-pan') }) When("I open the content menu of post {string}", (title)=> { From c8c71a52c67e7be517dc31150dd17e9c0a7f615a Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Fri, 31 Jan 2020 13:09:37 +0100 Subject: [PATCH 16/17] Follow @Tirokk PR review suggestions - Favor lowercase for words in a sentence after the first - Use exclamation marks for successful actions that use a toastr - place events at the end of the list on components - place class above events - it would be nice to come to a consensus based on best practices, like I had a doubt and places the class definition below the props, is that what others do? --- webapp/components/Comment/Comment.vue | 6 +++--- webapp/components/CommentList/CommentList.vue | 4 ++-- webapp/locales/de.json | 2 +- webapp/locales/en.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 0f37dae5d..5c47a3656 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -57,11 +57,11 @@
diff --git a/webapp/components/CommentList/CommentList.vue b/webapp/components/CommentList/CommentList.vue index 9a72e0073..ef6e3b096 100644 --- a/webapp/components/CommentList/CommentList.vue +++ b/webapp/components/CommentList/CommentList.vue @@ -7,16 +7,16 @@
diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 0c11c8d13..d552d51ba 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -279,7 +279,7 @@ }, "comment": { "submit": "Kommentiere", - "submitted": "Kommentar Gesendet", + "submitted": "Kommentar gesendet!", "updated": "Änderungen gespeichert", "reply": "Antworten" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 7804bcbfc..d15614ecc 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -444,8 +444,8 @@ }, "comment": { "submit": "Comment", - "submitted": "Comment Submitted", - "updated": "Changes Saved", + "submitted": "Comment submitted!", + "updated": "Changes saved!", "reply": "Reply" }, "edited": "edited" From ce42b2b8e9be29648611262dac0903b748e14c48 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Fri, 31 Jan 2020 14:45:27 +0100 Subject: [PATCH 17/17] Update cypress test casing --- cypress/integration/common/post.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index 064c84cb5..39407ef4f 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -23,7 +23,7 @@ Then("I click on the reply button", () => { }); Then("my comment should be successfully created", () => { - cy.get(".iziToast-message").contains("Comment Submitted"); + cy.get(".iziToast-message").contains("Comment submitted!"); }); Then("I should see my comment", () => {