2020-05-24 23:13:21 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import DesignNotePin from '~/design_management/components/design_note_pin.vue';
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('Design note pin component', () => {
|
2020-05-24 23:13:21 +05:30
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
function createComponent(propsData = {}) {
|
|
|
|
wrapper = shallowMount(DesignNotePin, {
|
|
|
|
propsData: {
|
|
|
|
position: {
|
|
|
|
left: '10px',
|
|
|
|
top: '10px',
|
|
|
|
},
|
|
|
|
...propsData,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should match the snapshot of note without index', () => {
|
|
|
|
createComponent();
|
|
|
|
expect(wrapper.element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should match the snapshot of note with index', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createComponent({ label: 1 });
|
2020-05-24 23:13:21 +05:30
|
|
|
expect(wrapper.element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should match the snapshot of note when repositioning', () => {
|
|
|
|
createComponent({ repositioning: true });
|
|
|
|
expect(wrapper.element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('pinStyle', () => {
|
|
|
|
it('sets cursor to `move` when repositioning = true', () => {
|
|
|
|
createComponent({ repositioning: true });
|
|
|
|
expect(wrapper.vm.pinStyle.cursor).toBe('move');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not set cursor when repositioning = false', () => {
|
|
|
|
createComponent();
|
|
|
|
expect(wrapper.vm.pinStyle.cursor).toBe(undefined);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|