refactor(Popup): create overlay for every popup (#6357)

This commit is contained in:
neverland
2020-05-24 16:24:20 +08:00
committed by GitHub
parent 6a2a0cc5c6
commit c5c2e9690d
5 changed files with 62 additions and 84 deletions

View File

@@ -343,30 +343,3 @@ exports[`title slot 1`] = `
</div>
</div>
`;
exports[`toggle method 1`] = `
<div class="van-dropdown-menu">
<div class="van-dropdown-menu__bar van-dropdown-menu__bar--opened">
<div role="button" tabindex="0" class="van-dropdown-menu__item"><span class="van-dropdown-menu__title van-dropdown-menu__title--active van-dropdown-menu__title--down"><div class="van-ellipsis"></div></span></div>
</div>
<div>
<div class="van-dropdown-item van-dropdown-item--down" style="top: 0px;">
<div class="van-overlay" style="z-index: 2017; animation-duration: 0s; position: absolute;" name="van-fade"></div>
<div class="van-popup van-popup--top van-dropdown-item__content" style="transition-duration: 0s; z-index: 2018;" name="van-popup-slide-top"></div>
</div>
</div>
</div>
`;
exports[`toggle method 2`] = `
<div class="van-dropdown-menu">
<div class="van-dropdown-menu__bar van-dropdown-menu__bar--opened">
<div role="button" tabindex="0" class="van-dropdown-menu__item"><span class="van-dropdown-menu__title"><div class="van-ellipsis"></div></span></div>
</div>
<div>
<div class="van-dropdown-item van-dropdown-item--down" style="top: 0px;">
<div class="van-popup van-popup--top van-dropdown-item__content" style="transition-duration: 0s; z-index: 2018; display: none;" name="van-popup-slide-top"></div>
</div>
</div>
</div>
`;

View File

@@ -224,12 +224,14 @@ test('toggle method', async (done) => {
// show
this.$refs.item.toggle(true, { immediate: true });
await later();
expect(wrapper).toMatchSnapshot();
const content = wrapper.find('.van-dropdown-item__content');
expect(content.element.style.display).toEqual('');
// hide
this.$refs.item.toggle(false, { immediate: true });
await later();
expect(wrapper).toMatchSnapshot();
expect(content.element.style.display).toEqual('none');
done();
},