Skip to content

Commit

Permalink
Added a unit test for copied text toast, any copy text can use this f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
JmScherer committed Nov 13, 2023
1 parent 1bc17e5 commit 384482a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions frontend/test/views/AnalysisView.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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.');
});
});
});

Expand Down

0 comments on commit 384482a

Please sign in to comment.