feat(Sku): add resetSelectedSku method (#5318)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { mount } from '../../../test';
|
||||
import Sku from '..';
|
||||
import { skuData, initialSku } from '../demo/data';
|
||||
|
||||
test('resetSelectedSku method', () => {
|
||||
skuData.sku.messages = [];
|
||||
|
||||
const wrapper = mount(Sku, {
|
||||
propsData: {
|
||||
value: true,
|
||||
initialSku,
|
||||
sku: skuData.sku,
|
||||
quota: skuData.quota,
|
||||
goods: skuData.goods_info,
|
||||
goodsId: skuData.goods_id,
|
||||
quotaUsed: skuData.quota_used,
|
||||
hideStock: skuData.sku.hide_stock,
|
||||
startSaleNum: skuData.start_sale_num
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.van-button--danger').trigger('click');
|
||||
expect(wrapper.emitted('buy-clicked').length).toEqual(1);
|
||||
|
||||
wrapper.setProps({ initialSku: {} });
|
||||
wrapper.vm.resetSelectedSku();
|
||||
|
||||
wrapper.find('.van-button--danger').trigger('click');
|
||||
expect(wrapper.emitted('buy-clicked').length).toEqual(1);
|
||||
});
|
||||
Reference in New Issue
Block a user