From 04887dd535e35152b8df2d44ef360ea51ee343da Mon Sep 17 00:00:00 2001 From: Damir Bogdanov <89067770+damirbogdanov@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:14:04 +1000 Subject: [PATCH] fix: correct popover opening with new slot syntax and no title/content --- src/components/popover/Popover.js | 2 +- src/components/popover/Popover.spec.js | 27 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/components/popover/Popover.js b/src/components/popover/Popover.js index 092113c59..872edca8c 100644 --- a/src/components/popover/Popover.js +++ b/src/components/popover/Popover.js @@ -60,7 +60,7 @@ export default { }, methods: { isNotEmpty() { - return this.title || this.content || this.$slots.popover + return this.title || this.content || this.$scopedSlots.popover }, }, } diff --git a/src/components/popover/Popover.spec.js b/src/components/popover/Popover.spec.js index 1c497b84f..5957dd32c 100644 --- a/src/components/popover/Popover.spec.js +++ b/src/components/popover/Popover.spec.js @@ -608,4 +608,31 @@ This is a very very long text. This is a very very long text. This is a very ver await sleep(600) expect(document.querySelectorAll('.popover').length).toEqual(1) }) + + it('should be able to open popover programmatically with vue latest slot syntax and without title and content passed', async () => { + const wrapper = createWrapper( + ` +
+ + Popover + + +
+ `, + { + show: false, + } + ) + const vm = wrapper.vm + await vm.$nextTick() + expect(document.querySelectorAll('.popover').length).toEqual(0) + vm.show = true + await sleep(300) + expect(document.querySelectorAll('.popover').length).toEqual(1) + vm.show = false + await sleep(300) + expect(document.querySelectorAll('.popover').length).toEqual(0) + }) })