mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
27 lines
577 B
JavaScript
27 lines
577 B
JavaScript
import SubmitBar from '../';
|
|
import demoTest from '../../../test/demo-test';
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
demoTest(SubmitBar);
|
|
|
|
test('submit', () => {
|
|
const wrapper = mount(SubmitBar, {
|
|
propsData: {
|
|
price: 0.01,
|
|
disabled: true
|
|
}
|
|
});
|
|
|
|
expect(wrapper.html()).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();
|
|
});
|