2023-04-28 13:58:46 +00:00
|
|
|
import { mount } from '@vue/test-utils';
|
2022-09-06 12:03:37 +00:00
|
|
|
import Menubar from './Menubar.vue';
|
|
|
|
|
|
|
|
describe('Menubar.vue', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = mount(Menubar, {
|
|
|
|
global: {
|
|
|
|
stubs: {
|
|
|
|
'router-link': true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
model: [
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'File',
|
|
|
|
icon: 'pi pi-fw pi-file',
|
|
|
|
items: [
|
2022-09-06 12:03:37 +00:00
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'New',
|
|
|
|
icon: 'pi pi-fw pi-plus',
|
|
|
|
items: [
|
2022-09-06 12:03:37 +00:00
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'Bookmark',
|
|
|
|
icon: 'pi pi-fw pi-bookmark'
|
2022-09-06 12:03:37 +00:00
|
|
|
},
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'Video',
|
|
|
|
icon: 'pi pi-fw pi-video'
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-fw pi-trash'
|
2022-09-06 12:03:37 +00:00
|
|
|
},
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
separator: true
|
2022-09-06 12:03:37 +00:00
|
|
|
},
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'Export',
|
|
|
|
icon: 'pi pi-fw pi-external-link'
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2022-09-14 11:26:01 +00:00
|
|
|
label: 'Quit',
|
|
|
|
icon: 'pi pi-fw pi-power-off'
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
slots: {
|
|
|
|
start: 'Start Slot',
|
|
|
|
end: 'End Slot'
|
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
});
|
2022-09-06 12:03:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should exist', () => {
|
|
|
|
expect(wrapper.find('.p-menubar.p-component').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-menubar-root-list').exists()).toBe(true);
|
|
|
|
expect(wrapper.findAll('ul.p-submenu-list').length).toBe(2);
|
|
|
|
expect(wrapper.findAll('ul.p-submenu-list')[0].findAll('li.p-menuitem')[0].find('.p-menuitem-text').text()).toBe('New');
|
|
|
|
expect(wrapper.findAll('li.p-menuitem').length).toBe(7);
|
2022-12-08 11:04:25 +00:00
|
|
|
expect(wrapper.findAll('li.p-menuitem-separator').length).toBe(1);
|
2022-09-06 12:03:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should slot visible', () => {
|
|
|
|
expect(wrapper.find('.p-menubar-start').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-menubar-end').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-menubar-end').text()).toBe('End Slot');
|
|
|
|
});
|
2022-09-14 11:26:01 +00:00
|
|
|
});
|