From f986b63a00a5a4488ff38f6daccd4b8999f2960f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BF=E7=94=9F=E7=8B=AE=E5=AD=90?= Date: Sun, 21 May 2023 20:46:24 +0800 Subject: [PATCH] fix(components): [popper] prioritise user's popper-style (#12833) * fix(components): [popper] prioritise users popper-style fix: #12831 * test: fix packages/popper testcase --- packages/components/popper/__tests__/content.test.tsx | 6 +++--- .../components/popper/src/composables/use-content-dom.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/components/popper/__tests__/content.test.tsx b/packages/components/popper/__tests__/content.test.tsx index 266e63fada..6a82f8e015 100644 --- a/packages/components/popper/__tests__/content.test.tsx +++ b/packages/components/popper/__tests__/content.test.tsx @@ -75,14 +75,14 @@ describe('', () => { expect(wrapper.classes()).toEqual(['el-popper', 'is-dark']) expect(wrapper.vm.contentStyle).toHaveLength(3) expect(wrapper.vm.contentStyle[0]).toHaveProperty('zIndex') - expect(wrapper.vm.contentStyle[1]).toEqual({}) - expect(wrapper.vm.contentStyle[2]).toEqual( + expect(wrapper.vm.contentStyle[1]).toEqual( expect.objectContaining({ position: 'absolute', top: '0', left: '0', }) ) + expect(wrapper.vm.contentStyle[2]).toEqual({}) }) it('should be able to be pure and themed', async () => { @@ -108,7 +108,7 @@ describe('', () => { popperStyle: style, }) - expect(wrapper.vm.contentStyle[1]).toEqual(style) + expect(wrapper.vm.contentStyle[2]).toEqual(style) }) it('should be able to emit events', async () => { diff --git a/packages/components/popper/src/composables/use-content-dom.ts b/packages/components/popper/src/composables/use-content-dom.ts index ac290feaef..0022ba07f3 100644 --- a/packages/components/popper/src/composables/use-content-dom.ts +++ b/packages/components/popper/src/composables/use-content-dom.ts @@ -29,8 +29,8 @@ export const usePopperContentDOM = ( const contentStyle = computed(() => { return [ { zIndex: unref(contentZIndex) } as CSSProperties, - props.popperStyle || {}, unref(styles).popper as CSSProperties, + props.popperStyle || {}, ] }) const ariaModal = computed(() =>