2022-09-06 12:03:37 +00:00
|
|
|
import { mount } from '@vue/test-utils';
|
2022-12-08 14:13:16 +00:00
|
|
|
import SplitterPanel from '../splitterpanel/SplitterPanel.vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
import Splitter from './Splitter.vue';
|
|
|
|
|
|
|
|
describe('Splitter.vue', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = mount(Splitter, {
|
|
|
|
global: {
|
|
|
|
components: {
|
|
|
|
SplitterPanel
|
|
|
|
}
|
|
|
|
},
|
|
|
|
slots: {
|
|
|
|
default: `
|
|
|
|
<SplitterPanel class="flex align-items-center justify-content-center">
|
|
|
|
Panel 1
|
|
|
|
</SplitterPanel>
|
|
|
|
<SplitterPanel class="flex align-items-center justify-content-center">
|
|
|
|
Panel 2
|
|
|
|
</SplitterPanel>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should exist', () => {
|
|
|
|
expect(wrapper.find('.p-splitter.p-component').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-splitter').classes()).toContain('p-splitter-horizontal');
|
2024-05-21 07:15:51 +00:00
|
|
|
expect(wrapper.findAll('.p-splitterpanel').length).toBe(2);
|
2022-09-06 12:03:37 +00:00
|
|
|
expect(wrapper.find('.p-splitter-gutter-handle').exists()).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should mousedown', async () => {
|
|
|
|
const gutter = wrapper.find('.p-splitter-gutter-handle').element;
|
2024-05-21 07:15:51 +00:00
|
|
|
const siblings = wrapper.findAll('.p-splitterpanel');
|
2022-09-14 11:26:01 +00:00
|
|
|
|
|
|
|
await wrapper.vm.onGutterMouseDown({ currentTarget: { gutter, previousElementSibling: siblings[0].element, nextElementSibling: siblings[1].element }, pageX: 123 }, 0);
|
|
|
|
|
2023-08-31 09:46:08 +00:00
|
|
|
expect(wrapper.find('.p-splitter').classes()).toContain('p-splitter-horizontal');
|
2022-09-06 12:03:37 +00:00
|
|
|
});
|
2022-09-14 11:26:01 +00:00
|
|
|
});
|