| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import SubmitBar from '..';
- import { mount } from '../../../test/utils';
- test('submit', () => {
- const submit = jest.fn();
- const wrapper = mount(SubmitBar, {
- context: {
- props: {
- price: 1
- },
- on: { submit }
- }
- });
- const button = wrapper.find('.van-button');
- button.trigger('click');
- expect(submit).toHaveBeenCalled();
- });
- test('disable submit', () => {
- const submit = jest.fn();
- const wrapper = mount(SubmitBar, {
- context: {
- props: {
- price: 1,
- disabled: true
- },
- on: { submit }
- }
- });
- expect(wrapper).toMatchSnapshot();
- // disabled
- const button = wrapper.find('.van-button');
- button.trigger('click');
- expect(submit).toHaveBeenCalledTimes(0);
- });
- test('decimal length', () => {
- const wrapper = mount(SubmitBar, {
- context: {
- props: {
- price: 111,
- decimalLength: 1
- }
- }
- });
- expect(wrapper).toMatchSnapshot();
- });
|