mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #3802 - Improve folder structure for nuxt configurations
This commit is contained in:
parent
851950270b
commit
f5fe822afb
563 changed files with 1703 additions and 1095 deletions
101
components/lib/inplace/Inplace.spec.js
Normal file
101
components/lib/inplace/Inplace.spec.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
import { config, mount } from '@vue/test-utils';
|
||||
import InputText from 'primevue/inputtext';
|
||||
import Inplace from './Inplace.vue';
|
||||
|
||||
config.global.mocks = {
|
||||
$primevue: {
|
||||
config: {
|
||||
locale: {
|
||||
aria: {
|
||||
close: 'Close'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
describe('Inplace.vue', () => {
|
||||
it('should exist', () => {
|
||||
const wrapper = mount(Inplace);
|
||||
|
||||
expect(wrapper.find('.p-inplace.p-component').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should slots display', () => {
|
||||
const wrapper = mount(Inplace, {
|
||||
global: {
|
||||
components: {
|
||||
InputText
|
||||
}
|
||||
},
|
||||
slots: {
|
||||
display: `
|
||||
<span class="pi pi-search" style="vertical-align: middle"></span>
|
||||
<span style="margin-left:.5rem; vertical-align: middle">View Picture</span>
|
||||
`,
|
||||
content: `<img src="/images/nature/nature1.jpg" />`
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-inplace-display').exists()).toBe(true);
|
||||
|
||||
wrapper.vm.open({});
|
||||
|
||||
expect(wrapper.emitted()['update:active'][0]).toEqual([true]);
|
||||
|
||||
wrapper.vm.close({});
|
||||
|
||||
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('.pi.pi-times').exists()).toBe(true);
|
||||
|
||||
await wrapper.vm.close({});
|
||||
|
||||
expect(wrapper.find('.pi.pi-times').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);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue