fix: fixed error with no expected value in `expandColumnTitle` slot (#7265)
* fix: fixed error report with no expected value in `expandColumnTitle` slot * fix: optimize optional chain * fix: use default render * refactor: use `customRenderSlot` replace `renderSlot` * style: code format * perf: optimize useColumns code * fix: fix path * feat: add customRenderSlot unit testpull/7302/head
parent
c717473568
commit
d870f3f8e0
@ -0,0 +1,11 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { customRenderSlot } from '../vnode';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RenderSlot',
|
||||
setup(_props, { slots }) {
|
||||
return () => {
|
||||
return customRenderSlot(slots, 'default', {}, () => ['default value']);
|
||||
};
|
||||
},
|
||||
});
|
@ -0,0 +1,26 @@
|
||||
import RenderSlot from '../__mocks__/RenderSlot';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
describe('render slot content', () => {
|
||||
it('renders slot content', () => {
|
||||
const wrapper = mount(RenderSlot, {
|
||||
slots: {
|
||||
default: () => 'This is slot content',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toContain('This is slot content');
|
||||
});
|
||||
|
||||
it('render default value when slot is fragment', async () => {
|
||||
const wrapper = mount(RenderSlot, {
|
||||
slots: {
|
||||
default: () => <></>,
|
||||
},
|
||||
});
|
||||
|
||||
await nextTick();
|
||||
expect(wrapper.html()).toContain('default value');
|
||||
});
|
||||
});
|
Loading…
Reference in new issue