[bugfix] Actionsheet: lazy-render not work (#2840)

This commit is contained in:
neverland 2019-02-25 19:33:48 +08:00 committed by GitHub
parent 6fff26caa1
commit 2b9c30f906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View File

@ -91,6 +91,7 @@ function Actionsheet(
value={props.value}
position="bottom"
overlay={props.overlay}
lazyRender={props.lazyRender}
closeOnClickOverlay={props.closeOnClickOverlay}
onInput={(value: boolean) => {
emit(ctx, 'input', value);

View File

@ -7,3 +7,11 @@ exports[`callback events 1`] = `
<div class="van-actionsheet__cancel">Cancel</div>
</div>
`;
exports[`disable lazy-render 1`] = `
<div class="van-popup van-popup--bottom van-actionsheet" style="display: none;" name="van-popup-slide-bottom">
<div class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">Option</span></div>
<div class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">Option</span></div>
<div class="van-actionsheet__cancel">Cancel</div>
</div>
`;

View File

@ -37,3 +37,18 @@ test('callback events', () => {
expect(onSelect.mock.calls[0][1]).toBeFalsy();
expect(wrapper).toMatchSnapshot();
});
test('disable lazy-render', () => {
const wrapper = mount(Actionsheet, {
propsData: {
lazyRender: false,
actions: [
{ name: 'Option' },
{ name: 'Option' }
],
cancelText: 'Cancel'
}
});
expect(wrapper).toMatchSnapshot();
});