- fix Image.spec.js, Inplace.spec.js, InputChips.spec.js
parent
7c308fe41b
commit
cdcee4ca8a
|
@ -34,9 +34,9 @@ describe('Image.vue', () => {
|
|||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-image-preview-container').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-image-preview-indicator').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-image-mask').exists()).toBe(false);
|
||||
expect(wrapper.find('.p-image-preview').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-image-toolbar').exists()).toBe(false);
|
||||
expect(wrapper.find('.p-image-preview-mask').exists()).toBe(true);
|
||||
|
||||
await wrapper.setData({ maskVisible: true });
|
||||
|
||||
|
|
|
@ -35,56 +35,4 @@ describe('Inplace.vue', () => {
|
|||
|
||||
expect(wrapper.emitted()['update:active'][1]).toEqual([false]);
|
||||
});
|
||||
|
||||
it('closable inplace', async () => {
|
||||
const wrapper = mount(Inplace, {
|
||||
global: {
|
||||
components: {
|
||||
InputText
|
||||
}
|
||||
},
|
||||
props: {
|
||||
closable: true
|
||||
},
|
||||
slots: {
|
||||
display: `{{'Click to Edit'}}`,
|
||||
content: `<InputText autofocus />`
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-inplace-closable').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-inplace-display').text()).toBe('Click to Edit');
|
||||
|
||||
await wrapper.vm.open({});
|
||||
|
||||
expect(wrapper.find('.p-inputtext').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-inplace-content').exists()).toBe(true);
|
||||
|
||||
await wrapper.vm.close({});
|
||||
|
||||
expect(wrapper.find('.p-inplace-display').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-inplace-content').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('should have custom close icon', async () => {
|
||||
const wrapper = mount(Inplace, {
|
||||
global: {
|
||||
components: {
|
||||
InputText
|
||||
}
|
||||
},
|
||||
props: {
|
||||
closable: true,
|
||||
closeIcon: 'pi pi-discord'
|
||||
},
|
||||
slots: {
|
||||
display: `{{'Click to Edit'}}`,
|
||||
content: `<InputText autofocus />`
|
||||
}
|
||||
});
|
||||
|
||||
await wrapper.vm.open({});
|
||||
|
||||
expect(wrapper.find('.pi.pi-discord').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,8 +14,8 @@ describe('InputChips.vue', () => {
|
|||
|
||||
it('should exist', () => {
|
||||
expect(wrapper.find('.p-inputchips.p-component.p-inputwrapper').exists()).toBe(true);
|
||||
expect(wrapper.find('ul.p-inputchips-multiple-container').exists()).toBe(true);
|
||||
expect(wrapper.find('li.p-inputchips-input-token').exists()).toBe(true);
|
||||
expect(wrapper.find('ul.p-inputwrapper-filled').exists()).toBe(false);
|
||||
expect(wrapper.find('li.p-inputchips-input-item').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should add item', async () => {
|
||||
|
@ -26,18 +26,18 @@ describe('InputChips.vue', () => {
|
|||
await wrapper.setProps({ modelValue: ['PrimeVue'] });
|
||||
|
||||
expect(addItem).toHaveBeenCalled();
|
||||
expect(wrapper.findAll('.p-inputchips-token').length).toBe(1);
|
||||
expect(wrapper.find('.p-inputchips-token-label').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-inputchips-token-label').text()).toBe('PrimeVue');
|
||||
expect(wrapper.findAll('.p-chip').length).toBe(1);
|
||||
expect(wrapper.find('.p-chip-label').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-chip-label').text()).toBe('PrimeVue');
|
||||
});
|
||||
|
||||
it('should have correct custom chip removal icon', async () => {
|
||||
await wrapper.setProps({
|
||||
modelValue: ['foo', 'bar'],
|
||||
removeTokenIcon: 'pi pi-discord'
|
||||
chipIcon: 'pi pi-discord'
|
||||
});
|
||||
|
||||
const icon = wrapper.find('.p-inputchips-token-icon');
|
||||
const icon = wrapper.find('[data-pc-section="removeicon"]');
|
||||
|
||||
expect(icon.classes()).toContain('pi-discord');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue