Browse Source
* 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
Carl Chen
10 months ago
committed by
GitHub
6 changed files with 74 additions and 8 deletions
@ -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