From 384482a15396250bbfdde133bc43196dedadff3c Mon Sep 17 00:00:00 2001 From: James Scherer Date: Mon, 13 Nov 2023 14:05:22 -0600 Subject: [PATCH] Added a unit test for copied text toast, any copy text can use this function --- frontend/test/views/AnalysisView.spec.js | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/frontend/test/views/AnalysisView.spec.js b/frontend/test/views/AnalysisView.spec.js index 15148171..cd1d19ea 100644 --- a/frontend/test/views/AnalysisView.spec.js +++ b/frontend/test/views/AnalysisView.spec.js @@ -4,6 +4,7 @@ import sinon from 'sinon'; import Analyses from '@/models/analyses.js'; +import GeneBox from '@/components/AnalysisView/GeneBox.vue'; import InputDialog from '@/components/Dialogs/InputDialog.vue'; import NotificationDialog from '@/components/Dialogs/NotificationDialog.vue'; import SupplementalFormList from '@/components/AnalysisView/SupplementalFormList.vue'; @@ -129,6 +130,17 @@ describe('AnalysisView', () => { expect(appContent.exists()).to.be.true; }); + it('should display a toast when a copy text to clipboard button', async () => { + const geneBox = wrapper.getComponent(GeneBox); + + geneBox.vm.$emit('clipboard-copy', 'NM_001017980.3:c.164G>T'); + await wrapper.vm.$nextTick(); + + expect(toast.state.active).to.be.true; + expect(toast.state.type).to.equal('success'); + expect(toast.state.message).to.equal('Copied NM_001017980.3:c.164G>T to clipboard!'); + }); + describe('the header', () => { it('contains a header element', () => { const appHeader = wrapper.find('app-header'); @@ -662,19 +674,6 @@ describe('AnalysisView', () => { expect(toast.state.type).to.equal('success'); expect(toast.state.message).to.equal('Analysis updated successfully.'); }); - - it('should display info toast when canceling analysis changes', async () => { - const wrapper = getMountedComponent(); - await wrapper.setData({edit: true}); - const saveModal = wrapper.findComponent(SaveModal); - - saveModal.vm.$emit('canceledit'); - await wrapper.vm.$nextTick(); - - expect(toast.state.active).to.be.true; - expect(toast.state.type).to.equal('info'); - expect(toast.state.message).to.equal('Edit mode has been disabled and changes have not been saved.'); - }); }); });