mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[Improvement] Rebuild test system (#1051)
This commit is contained in:
26
packages/submit-bar/test/index.spec.js
Normal file
26
packages/submit-bar/test/index.spec.js
Normal 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();
|
||||
});
|
Reference in New Issue
Block a user