Skip to content

rewrite form test #821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/main/src/components/Form/Form.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '@shared/tests';
import { createPassThroughPropsTest } from '@shared/tests/utils';
import { mount } from 'enzyme';
import { Form } from '@ui5/webcomponents-react/lib/Form';
import { FormGroup } from '@ui5/webcomponents-react/lib/FormGroup';
import { FormItem } from '@ui5/webcomponents-react/lib/FormItem';
Expand Down Expand Up @@ -36,26 +36,26 @@ const component = (
describe('Create a Form', () => {
test('size rate S; should create Label and Element with 100% width and display: block for top FormItem div', () => {
window = Object.assign(window, { innerWidth: SIZE_S });
const wrapper = mount(component);
expect(wrapper.render()).toMatchSnapshot();
const { asFragment } = render(component);
expect(asFragment()).toMatchSnapshot();
});

test('size rate M; should create Label and Element with 16% and 83% width respectively and display: flex for top FormItem div', () => {
window = Object.assign(window, { innerWidth: SIZE_M });
const wrapper = mount(component);
expect(wrapper.render()).toMatchSnapshot();
const { asFragment } = render(component);
expect(asFragment()).toMatchSnapshot();
});

test('size rate L; should create Label and Element with 33% and 66% width respectively and display: flex for top FormItem div', () => {
window = Object.assign(window, { innerWidth: SIZE_L });
const wrapper = mount(component);
expect(wrapper.render()).toMatchSnapshot();
const { asFragment } = render(component);
expect(asFragment()).toMatchSnapshot();
});

test('size rate XL; should create Label and Element with 33% and 66% width respectively and display: flex for top FormItem div', () => {
window = Object.assign(window, { innerWidth: SIZE_XL });
const wrapper = mount(component);
expect(wrapper.render()).toMatchSnapshot();
const { asFragment } = render(component);
expect(asFragment()).toMatchSnapshot();
});

test("should use a single FormGroup's title as a Form title if one is not set", () => {
Expand All @@ -71,8 +71,8 @@ describe('Create a Form', () => {
</FormGroup>
</Form>
);
const wrapper = mount(ungroupedChildren);
expect(wrapper.render()).toMatchSnapshot();
const { asFragment } = render(ungroupedChildren);
expect(asFragment()).toMatchSnapshot();
});

createPassThroughPropsTest(Form, {
Expand Down
Loading