Skip to content

Commit

Permalink
fix(ActionSheet): safe-area-inset-bottom not work
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Feb 5, 2021
1 parent aeeeae8 commit abefdc8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/action-sheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export default createComponent({
class={bem()}
round={props.round}
position="bottom"
safeAreaInsetBottom={props.safeAreaInsetBottom}
{...{
...pick(props, popupPropKeys),
'onUpdate:show': onUpdateShow,
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/test/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`should render default slot correctly 1`] = `
</div>
</transition-stub>
<transition-stub>
<div class="van-popup van-popup--round van-popup--bottom van-action-sheet">
<div class="van-popup van-popup--round van-popup--bottom van-popup--safe-area-inset-bottom van-action-sheet">
<div class="van-action-sheet__header">
Title
<i class="van-badge__wrapper van-icon van-icon-cross van-action-sheet__close">
Expand Down
19 changes: 19 additions & 0 deletions src/action-sheet/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,22 @@ test('should emit click-overlay event and closed after clicking the overlay', ()
expect(wrapper.emitted('update:show')[0][0]).toEqual(false);
expect(onClickOverlay).toHaveBeenCalledTimes(1);
});

test('should allow to control safe-area with safe-area-inset-bottom prop', async () => {
const wrapper = mount(ActionSheet, {
props: {
show: true,
},
});

expect(wrapper.find('.van-action-sheet').classes()).toContain(
'van-popup--safe-area-inset-bottom'
);

await wrapper.setProps({
safeAreaInsetBottom: false,
});
expect(wrapper.find('.van-action-sheet').classes()).not.toContain(
'van-popup--safe-area-inset-bottom'
);
});
4 changes: 1 addition & 3 deletions src/nav-bar/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ test('should have safe-area-inset-top class when using safe-area-inset-top prop'
},
});

expect(
wrapper.find('.van-nav-bar--safe-area-inset-top').exists()
).toBeTruthy();
expect(wrapper.classes()).toContain('van-nav-bar--safe-area-inset-top');
});

test('should change z-index when using z-index prop', () => {
Expand Down

0 comments on commit abefdc8

Please sign in to comment.