fix(timeline): fix NTimeline header slot (#706)

Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
XieZongChen 2021-07-28 11:20:41 -05:00 committed by GitHub
parent b019866aa3
commit 3bd2379ef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,7 @@
### Fixes
- Fix `n-message`'s `destroyAll` method doesn't work.
- Fix `n-timeline`'s header slot is invalid when using alone.
## 2.15.9 (2021-07-28)

View File

@ -7,6 +7,7 @@
### Fixes
- 修复 `n-message``destroyAll` 方法不生效
- 修复 `n-timeline` 的 header slot 单独使用无效的问题
## 2.15.9 (2021-07-28)

View File

@ -88,7 +88,7 @@ export default defineComponent({
<div class={`${mergedClsPrefix}-timeline-item-timeline__circle`} />
</div>
<div class={`${mergedClsPrefix}-timeline-item-content`}>
{this.title ? (
{this.title || this.$slots.header ? (
<div class={`${mergedClsPrefix}-timeline-item-content__title`}>
{renderSlot(this.$slots, 'header', undefined, () => [this.title])}
</div>

View File

@ -90,12 +90,16 @@ describe('n-timeline-item', () => {
slots: {
default: () =>
h(NTimelineItem, null, {
default: () => 'test-default',
header: () => 'test-header',
default: () => 'test-default',
footer: () => 'test-footer'
})
}
})
expect(wrapper.find('.n-timeline-item-content__title').exists()).toBe(true)
expect(wrapper.find('.n-timeline-item-content__title').text()).toBe(
'test-header'
)
expect(wrapper.find('.n-timeline-item-content__content').exists()).toBe(
true
)