[Improvement] Rebuild test system (#1051)

This commit is contained in:
neverland
2018-05-12 14:04:32 +08:00
committed by GitHub
parent 360f2f40b1
commit a55eda8891
185 changed files with 4989 additions and 7950 deletions

View File

@@ -0,0 +1,26 @@
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();
});