lulouis-vant
Version:
Lightweight Mobile UI Components built on Vue
24 lines (19 loc) • 526 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();
});