vant/packages/submit-bar/test/index.spec.js
2018-06-27 11:56:14 +08:00

24 lines
504 B
JavaScript

import SubmitBar from '../';
import { mount } from '../../../test/utils';
test('submit', () => {
const wrapper = mount(SubmitBar, {
propsData: {
price: 0.01,
disabled: true
}
});
expect(wrapper).toMatchSnapshot();
// disabled
const button = wrapper.find('.van-button');
button.trigger('click');
expect(wrapper.emitted('submit')).toBeFalsy();
// submit
wrapper.vm.disabled = false;
button.trigger('click');
expect(wrapper.emitted('submit')).toBeTruthy();
});