vant/packages/submit-bar/test/index.spec.js
2018-12-14 14:24:23 +08:00

24 lines
503 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();
});