Skip to content

Commit 318fa5f

Browse files
rvsiaHyperkid123
authored andcommitted
Update PF4 test to lates major
1 parent 34e892b commit 318fa5f

File tree

11 files changed

+2727
-3293
lines changed

11 files changed

+2727
-3293
lines changed

packages/pf4-component-mapper/src/tests/__snapshots__/form-fields.test.js.snap

Lines changed: 1445 additions & 1528 deletions
Large diffs are not rendered by default.

packages/pf4-component-mapper/src/tests/__snapshots__/form-template-common.test.js.snap

Lines changed: 129 additions & 369 deletions
Large diffs are not rendered by default.

packages/pf4-component-mapper/src/tests/dual-list-select.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { act } from 'react-dom/test-utils';
33
import FormRenderer, { componentTypes } from '@data-driven-forms/react-form-renderer';
44
import { mount } from 'enzyme';
55

6-
import { FormGroup, TextInput } from '@patternfly/react-core';
7-
import { DataToolbar } from '@patternfly/react-core/dist/js/experimental';
6+
import { FormGroup, TextInput, Toolbar } from '@patternfly/react-core';
87
import {
98
SearchIcon,
109
PficonSortCommonAscIcon,
@@ -68,7 +67,7 @@ describe('DualListSelect', () => {
6867
const wrapper = mount(<FormRenderer {...initialProps} />);
6968

7069
expect(wrapper.find(FormGroup)).toHaveLength(1);
71-
expect(wrapper.find(DataToolbar)).toHaveLength(2);
70+
expect(wrapper.find(Toolbar)).toHaveLength(2);
7271
expect(wrapper.find(TextInput)).toHaveLength(2);
7372
expect(wrapper.find(SearchIcon)).toHaveLength(2);
7473
expect(wrapper.find(PficonSortCommonDescIcon)).toHaveLength(2);

packages/pf4-component-mapper/src/tests/field-array.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import FormRenderer, { componentTypes, validatorTypes } from '@data-driven-forms
44
import { mount } from 'enzyme';
55

66
import { componentMapper, FormTemplate } from '../index';
7+
import { FormHelperText } from '@patternfly/react-core';
78

89
describe('<FieldArray/>', () => {
910
let initialProps;
@@ -351,7 +352,7 @@ describe('<FieldArray/>', () => {
351352
wrapper = mount(<FormRenderer {...initialProps} />);
352353
});
353354

354-
expect(wrapper.find('FormHelperText')).toHaveLength(0);
355+
expect(wrapper.find(FormHelperText)).toHaveLength(0);
355356

356357
await act(async () => {
357358
wrapper
@@ -369,7 +370,7 @@ describe('<FieldArray/>', () => {
369370
expect(onSubmit).not.toHaveBeenCalled();
370371
onSubmit.mockClear();
371372

372-
expect(wrapper.find('FormHelperText').text()).toEqual('Must have at least 3 items.');
373+
expect(wrapper.find(FormHelperText).text()).toEqual('Must have at least 3 items.');
373374
});
374375

375376
it('should render array field correctly with props', async () => {

packages/pf4-component-mapper/src/tests/sub-form.test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { mount } from 'enzyme';
44
import FormRenderer, { componentTypes } from '@data-driven-forms/react-form-renderer';
55
import FormTemplate from '../files/form-template';
66
import componentMapper from '../files/component-mapper';
7+
import { Title, Text } from '@patternfly/react-core';
78

89
describe('SubForm component', () => {
910
let initialProps;
@@ -35,8 +36,8 @@ describe('SubForm component', () => {
3536
};
3637
const wrapper = mount(<FormRenderer {...initialProps} schema={schema} />);
3738

38-
expect(wrapper.find('Title').text()).toEqual('some title');
39-
expect(wrapper.find('Text').text()).toEqual('some description');
39+
expect(wrapper.find(Title).text()).toEqual('some title');
40+
expect(wrapper.find(Text).text()).toEqual('some description');
4041
expect(wrapper.find('input')).toHaveLength(1);
4142
});
4243

@@ -58,8 +59,8 @@ describe('SubForm component', () => {
5859
};
5960
const wrapper = mount(<FormRenderer {...initialProps} schema={schema} />);
6061

61-
expect(wrapper.find('Title').text()).toEqual('some title');
62-
expect(wrapper.find('Text')).toHaveLength(0);
62+
expect(wrapper.find(Title).text()).toEqual('some title');
63+
expect(wrapper.find(Text)).toHaveLength(0);
6364
expect(wrapper.find('input')).toHaveLength(1);
6465
});
6566

@@ -81,8 +82,8 @@ describe('SubForm component', () => {
8182
};
8283
const wrapper = mount(<FormRenderer {...initialProps} schema={schema} />);
8384

84-
expect(wrapper.find('Title')).toHaveLength(0);
85-
expect(wrapper.find('Text').text()).toEqual('some description');
85+
expect(wrapper.find(Title)).toHaveLength(0);
86+
expect(wrapper.find(Text).text()).toEqual('some description');
8687
expect(wrapper.find('input')).toHaveLength(1);
8788
});
8889
});

packages/pf4-component-mapper/src/tests/tabs.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Tabs component', () => {
5151

5252
expect(wrapper.find(PF4Tabs).props().activeKey).toEqual(0);
5353

54-
const secondTabButton = wrapper.find('.pf-c-tabs__button').last();
54+
const secondTabButton = wrapper.find('.pf-c-tabs__link').last();
5555
secondTabButton.simulate('click');
5656

5757
expect(wrapper.find(PF4Tabs).props().activeKey).toEqual(1);

0 commit comments

Comments
 (0)