[improvement] Picker: add test case

This commit is contained in:
陈嘉涵 2019-06-09 09:55:33 +08:00
parent 3a4b434b4c
commit a72ce3d115
2 changed files with 26 additions and 0 deletions

View File

@ -41,3 +41,18 @@ exports[`render title slot 1`] = `
<!---->
</div>
`;
exports[`toolbar-position prop 1`] = `
<div class="van-picker">
<!---->
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker__mask" style="background-size: 100% 88px;"></div>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div>
<div class="van-hairline--top-bottom van-picker__toolbar">
<div role="button" tabindex="0" class="van-picker__cancel">取消</div>
<div role="button" tabindex="0" class="van-picker__confirm">确认</div>
</div>
</div>
`;

View File

@ -181,3 +181,14 @@ test('click column\'s item', () => {
wrapper.findAll('.van-picker-column__item').at(3).trigger('click');
expect(wrapper.emitted('change')[0][1]).toEqual(columns[1]);
});
test('toolbar-position prop', () => {
const wrapper = mount(Picker, {
propsData: {
showToolbar: true,
toolbarPosition: 'bottom'
}
});
expect(wrapper).toMatchSnapshot();
});