diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.spec.js b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.spec.js index aba5abc34..42deac9cb 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.spec.js +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.spec.js @@ -67,9 +67,9 @@ describe('ContributionMessagesFormular', () => { await wrapper.find('form').trigger('submit') }) - it('emitted "get-list-contribution-messages" with data', async () => { + it('emitted "get-list-contribution-messages" with false', async () => { expect(wrapper.emitted('get-list-contribution-messages')).toEqual( - expect.arrayContaining([expect.arrayContaining([42])]), + expect.arrayContaining([expect.arrayContaining([false])]), ) }) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue index 1a5928cc3..c601de4f5 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -51,7 +51,7 @@ export default { }, }) .then((result) => { - this.$emit('get-list-contribution-messages', this.contributionId) + this.$emit('get-list-contribution-messages', false) this.$emit('update-state', this.contributionId) this.form.text = '' this.toastSuccess(this.$t('message.reply')) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.spec.js b/frontend/src/components/ContributionMessages/ContributionMessagesList.spec.js index 7798532b7..c5c26a2c0 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.spec.js +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.spec.js @@ -40,16 +40,6 @@ describe('ContributionMessagesList', () => { expect(wrapper.findComponent({ name: 'ContributionMessagesFormular' }).exists()).toBe(true) }) - describe('get List Contribution Messages', () => { - beforeEach(() => { - wrapper.vm.getListContributionMessages() - }) - - it('emits getListContributionMessages', async () => { - expect(wrapper.vm.$emit('get-list-contribution-messages')).toBeTruthy() - }) - }) - describe('update State', () => { beforeEach(() => { wrapper.vm.updateState() diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index 4b7045a40..e9262c073 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -9,7 +9,7 @@ @@ -50,9 +50,6 @@ export default { }, }, methods: { - getListContributionMessages() { - this.$emit('get-list-contribution-messages', this.contributionId) - }, updateState(id) { this.$emit('update-state', id) }, diff --git a/frontend/src/components/Contributions/ContributionListItem.spec.js b/frontend/src/components/Contributions/ContributionListItem.spec.js index f477d1c2c..66e3bcef9 100644 --- a/frontend/src/components/Contributions/ContributionListItem.spec.js +++ b/frontend/src/components/Contributions/ContributionListItem.spec.js @@ -9,6 +9,7 @@ describe('ContributionListItem', () => { const mocks = { $t: jest.fn((t) => t), $d: jest.fn((d) => d), + $apollo: { query: jest.fn().mockResolvedValue() }, } const propsData = { @@ -143,5 +144,16 @@ describe('ContributionListItem', () => { }) }) }) + + describe('getListContributionMessages', () => { + beforeEach(() => { + wrapper + .findComponent({ name: 'ContributionMessagesList' }) + .vm.$emit('get-list-contribution-messages') + }) + it('emits closeAllOpenCollapse', () => { + expect(wrapper.emitted('closeAllOpenCollapse')).toBeTruthy() + }) + }) }) }) diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 22f7e791c..53de8c461 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -55,7 +55,7 @@ v-b-toggle="collapsId" icon="chat-dots" class="h2 mr-5" - @click="$emit('closeAllOpenCollapse'), getListContributionMessages" + @click="getListContributionMessages" > @@ -65,7 +65,7 @@ v-if="state === 'IN_PROGRESS'" v-b-toggle="collapsId" variant="warning" - @click="$emit('closeAllOpenCollapse'), getListContributionMessages" + @click="getListContributionMessages" > {{ $t('contribution.alert.answerQuestion') }} @@ -179,8 +179,10 @@ export default { if (value) this.$emit('delete-contribution', item) }) }, - getListContributionMessages() { - // console.log('getListContributionMessages', this.contributionId) + getListContributionMessages(closeCollapse = true) { + if (closeCollapse) { + this.$emit('closeAllOpenCollapse') + } this.$apollo .query({ query: listContributionMessages,