diff --git a/packages/vant/src/popup/Popup.tsx b/packages/vant/src/popup/Popup.tsx index a8235a6be..ec73d92e8 100644 --- a/packages/vant/src/popup/Popup.tsx +++ b/packages/vant/src/popup/Popup.tsx @@ -48,6 +48,7 @@ const popupProps = extend({}, popupSharedProps, { iconPrefix: String, closeOnPopstate: Boolean, closeIconPosition: makeStringProp('top-right'), + safeAreaInsetTop: Boolean, safeAreaInsetBottom: Boolean, }); @@ -177,7 +178,7 @@ export default defineComponent({ const onKeydown = (event: KeyboardEvent) => emit('keydown', event); const renderPopup = lazyRender(() => { - const { round, position, safeAreaInsetBottom } = props; + const { round, position, safeAreaInsetTop, safeAreaInsetBottom } = props; return (
{ await wrapper.setProps({ show: false }); expect(beforeClose).toHaveBeenCalledTimes(0); }); + +test('should have safe-area-inset-top class when using safe-area-inset-top prop', () => { + const wrapper = mount(Popup, { + props: { + show: true, + safeAreaInsetTop: true, + }, + }); + + expect(wrapper.find('.van-popup').classes()).toContain('van-safe-area-top'); +}); + +test('should have safe-area-inset-bottom class when using safe-area-inset-bottom prop', () => { + const wrapper = mount(Popup, { + props: { + show: true, + safeAreaInsetBottom: true, + }, + }); + + expect(wrapper.find('.van-popup').classes()).toContain( + 'van-safe-area-bottom' + ); +});