Project

General

Profile

« Previous | Next » 

Revision 89b8fc37

Added by Amir Fefer over 4 years ago

Fixes #28488 - consume jest config from env

View differences:

webpack/assets/javascripts/react_app/components/common/forms/CommonForm.test.js
import toJson from 'enzyme-to-json';
import { shallow } from 'enzyme';
import { shallow } from '@theforeman/test';
import React from 'react';
import { FieldLevelHelp } from 'patternfly-react';
......
it('should display a label field', () => {
const wrapper = shallow(<CommonForm label="my label" />);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('should accept a required field', () => {
const wrapper = shallow(<CommonForm label="my label" required />);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('should display validation errors if touched', () => {
const wrapper = shallow(
<CommonForm label="my label" touched error="is required!" />
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('should not display validation errors if not touched', () => {
const wrapper = shallow(
<CommonForm label="my label" error="is required!" />
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('should not display validation errors if there are none', () => {
const wrapper = shallow(<CommonForm label="my label" />);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('should accept customized input class', () => {
const wrapper = shallow(
......
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});

Also available in: Unified diff