@patternfly/react-core 4.202.11 → 4.202.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/esm/components/LoginPage/LoginFooterItem.d.ts.map +1 -1
- package/dist/esm/components/LoginPage/LoginFooterItem.js +1 -3
- package/dist/esm/components/LoginPage/LoginFooterItem.js.map +1 -1
- package/dist/esm/components/TextInput/TextInput.d.ts +1 -0
- package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/esm/components/TextInput/TextInput.js +2 -1
- package/dist/esm/components/TextInput/TextInput.js.map +1 -1
- package/dist/js/components/LoginPage/LoginFooterItem.d.ts.map +1 -1
- package/dist/js/components/LoginPage/LoginFooterItem.js +1 -3
- package/dist/js/components/LoginPage/LoginFooterItem.js.map +1 -1
- package/dist/js/components/TextInput/TextInput.d.ts +1 -0
- package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/js/components/TextInput/TextInput.js +2 -1
- package/dist/js/components/TextInput/TextInput.js.map +1 -1
- package/dist/styles/assets/pficon/pficon.scss +6 -0
- package/dist/styles/assets/pficon/pficon.woff +0 -0
- package/dist/styles/assets/pficon/pficon.woff2 +0 -0
- package/dist/styles/base-no-reset.css +5 -0
- package/dist/styles/base.css +5 -0
- package/dist/umd/react-core.css +2 -1
- package/dist/umd/react-core.js +3 -4
- package/dist/umd/react-core.min.css +2 -1
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +46 -42
- package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +5 -130
- package/src/components/Form/__tests__/FormGroup.test.tsx +82 -57
- package/src/components/Form/__tests__/FormHelperText.test.tsx +42 -28
- package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +51 -250
- package/src/components/Form/__tests__/__snapshots__/FormHelperText.test.tsx.snap +4 -44
- package/src/components/FormSelect/__tests__/FormSelect.test.tsx +131 -122
- package/src/components/FormSelect/__tests__/__snapshots__/FormSelect.test.tsx.snap +9 -301
- package/src/components/InputGroup/__tests__/InputGroup.test.tsx +17 -41
- package/src/components/InputGroup/__tests__/InputGroupText.test.tsx +17 -0
- package/src/components/Label/__tests__/Label.test.tsx +127 -68
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +26 -828
- package/src/components/LabelGroup/__tests__/LabelGroup.test.tsx +24 -20
- package/src/components/LabelGroup/__tests__/__snapshots__/LabelGroup.test.tsx.snap +10 -12
- package/src/components/LoginPage/LoginFooterItem.tsx +0 -2
- package/src/components/LoginPage/__tests__/LoginFooterItem.test.tsx +23 -24
- package/src/components/LoginPage/__tests__/LoginForm.test.tsx +40 -33
- package/src/components/LoginPage/__tests__/LoginMainBody.test.tsx +10 -16
- package/src/components/LoginPage/__tests__/LoginMainFooter.test.tsx +11 -17
- package/src/components/LoginPage/__tests__/LoginMainFooterBandItem.test.tsx +23 -24
- package/src/components/LoginPage/__tests__/LoginMainFooterLinksItem.test.tsx +20 -24
- package/src/components/LoginPage/__tests__/LoginMainHeader.test.tsx +14 -20
- package/src/components/LoginPage/__tests__/__snapshots__/LoginFooterItem.test.tsx.snap +3 -13
- package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +3 -415
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainBody.test.tsx.snap +2 -8
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooter.test.tsx.snap +2 -8
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooterBandItem.test.tsx.snap +3 -17
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainFooterLinksItem.test.tsx.snap +3 -31
- package/src/components/LoginPage/__tests__/__snapshots__/LoginMainHeader.test.tsx.snap +3 -12
- package/src/components/TextInput/TextInput.tsx +4 -1
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
|
|
4
6
|
import { Label } from '../../Label';
|
|
5
7
|
import { LabelGroup } from '../index';
|
|
6
8
|
|
|
7
9
|
describe('LabelGroup', () => {
|
|
8
10
|
test('label group default', () => {
|
|
9
|
-
const
|
|
11
|
+
const { asFragment } = render(
|
|
10
12
|
<LabelGroup>
|
|
11
13
|
<Label>1.1</Label>
|
|
12
14
|
</LabelGroup>
|
|
13
15
|
);
|
|
14
|
-
|
|
15
|
-
expect(view.container).toMatchSnapshot();
|
|
16
|
+
expect(asFragment()).toMatchSnapshot();
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
test('label group with category', () => {
|
|
19
|
-
const
|
|
20
|
+
const { asFragment } = render(
|
|
20
21
|
<LabelGroup categoryName="category">
|
|
21
22
|
<Label>1.1</Label>
|
|
22
23
|
</LabelGroup>
|
|
23
24
|
);
|
|
24
|
-
expect(
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
test('label group with closable category', () => {
|
|
28
|
-
const
|
|
29
|
+
const { asFragment } = render(
|
|
29
30
|
<LabelGroup categoryName="category" isClosable>
|
|
30
31
|
<Label>1.1</Label>
|
|
31
32
|
</LabelGroup>
|
|
32
33
|
);
|
|
33
|
-
expect(
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
test('label group expanded', () => {
|
|
37
|
-
|
|
38
|
+
render(
|
|
38
39
|
<LabelGroup>
|
|
39
40
|
<Label>1</Label>
|
|
40
41
|
<Label>2</Label>
|
|
@@ -42,28 +43,31 @@ describe('LabelGroup', () => {
|
|
|
42
43
|
<Label>4</Label>
|
|
43
44
|
</LabelGroup>
|
|
44
45
|
);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const showMoreButton = screen.getByRole('button');
|
|
47
|
+
|
|
48
|
+
expect(showMoreButton.textContent).toBe('1 more');
|
|
49
|
+
|
|
50
|
+
userEvent.click(showMoreButton);
|
|
51
|
+
expect(showMoreButton.textContent).toBe('Show Less');
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
test('label group will not render if no children passed', () => {
|
|
52
|
-
|
|
53
|
-
expect(
|
|
55
|
+
render(<LabelGroup data-testid="label-group-test-id" />);
|
|
56
|
+
expect(screen.queryByTestId('label-group-test-id')).toBeNull();
|
|
54
57
|
});
|
|
55
58
|
|
|
59
|
+
// TODO, fix test - no tooltip shows up with this categoryName.zzw
|
|
56
60
|
test('label group with category and tooltip', () => {
|
|
57
|
-
const
|
|
61
|
+
const { asFragment } = render(
|
|
58
62
|
<LabelGroup categoryName="A very long category name">
|
|
59
63
|
<Label>1.1</Label>
|
|
60
64
|
</LabelGroup>
|
|
61
65
|
);
|
|
62
|
-
expect(
|
|
66
|
+
expect(asFragment()).toMatchSnapshot();
|
|
63
67
|
});
|
|
64
68
|
|
|
65
69
|
test('label group compact', () => {
|
|
66
|
-
const
|
|
70
|
+
const { asFragment } = render(
|
|
67
71
|
<LabelGroup isCompact>
|
|
68
72
|
<Label isCompact>1</Label>
|
|
69
73
|
<Label isCompact>2</Label>
|
|
@@ -71,6 +75,6 @@ describe('LabelGroup', () => {
|
|
|
71
75
|
<Label isCompact>4</Label>
|
|
72
76
|
</LabelGroup>
|
|
73
77
|
);
|
|
74
|
-
expect(
|
|
78
|
+
expect(asFragment()).toMatchSnapshot();
|
|
75
79
|
});
|
|
76
80
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`LabelGroup label group compact 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="pf-c-label-group"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="pf-c-label-group__main"
|
|
10
10
|
>
|
|
11
|
-
|
|
12
11
|
<ul
|
|
13
12
|
aria-label="Label group category"
|
|
14
13
|
class="pf-c-label-group__list"
|
|
@@ -69,18 +68,17 @@ exports[`LabelGroup label group compact 1`] = `
|
|
|
69
68
|
</ul>
|
|
70
69
|
</div>
|
|
71
70
|
</div>
|
|
72
|
-
</
|
|
71
|
+
</DocumentFragment>
|
|
73
72
|
`;
|
|
74
73
|
|
|
75
74
|
exports[`LabelGroup label group default 1`] = `
|
|
76
|
-
<
|
|
75
|
+
<DocumentFragment>
|
|
77
76
|
<div
|
|
78
77
|
class="pf-c-label-group"
|
|
79
78
|
>
|
|
80
79
|
<div
|
|
81
80
|
class="pf-c-label-group__main"
|
|
82
81
|
>
|
|
83
|
-
|
|
84
82
|
<ul
|
|
85
83
|
aria-label="Label group category"
|
|
86
84
|
class="pf-c-label-group__list"
|
|
@@ -102,11 +100,11 @@ exports[`LabelGroup label group default 1`] = `
|
|
|
102
100
|
</ul>
|
|
103
101
|
</div>
|
|
104
102
|
</div>
|
|
105
|
-
</
|
|
103
|
+
</DocumentFragment>
|
|
106
104
|
`;
|
|
107
105
|
|
|
108
106
|
exports[`LabelGroup label group with category 1`] = `
|
|
109
|
-
<
|
|
107
|
+
<DocumentFragment>
|
|
110
108
|
<div
|
|
111
109
|
class="pf-c-label-group pf-m-category"
|
|
112
110
|
>
|
|
@@ -141,11 +139,11 @@ exports[`LabelGroup label group with category 1`] = `
|
|
|
141
139
|
</ul>
|
|
142
140
|
</div>
|
|
143
141
|
</div>
|
|
144
|
-
</
|
|
142
|
+
</DocumentFragment>
|
|
145
143
|
`;
|
|
146
144
|
|
|
147
145
|
exports[`LabelGroup label group with category and tooltip 1`] = `
|
|
148
|
-
<
|
|
146
|
+
<DocumentFragment>
|
|
149
147
|
<div
|
|
150
148
|
class="pf-c-label-group pf-m-category"
|
|
151
149
|
>
|
|
@@ -180,11 +178,11 @@ exports[`LabelGroup label group with category and tooltip 1`] = `
|
|
|
180
178
|
</ul>
|
|
181
179
|
</div>
|
|
182
180
|
</div>
|
|
183
|
-
</
|
|
181
|
+
</DocumentFragment>
|
|
184
182
|
`;
|
|
185
183
|
|
|
186
184
|
exports[`LabelGroup label group with closable category 1`] = `
|
|
187
|
-
<
|
|
185
|
+
<DocumentFragment>
|
|
188
186
|
<div
|
|
189
187
|
class="pf-c-label-group pf-m-category"
|
|
190
188
|
>
|
|
@@ -248,5 +246,5 @@ exports[`LabelGroup label group with closable category 1`] = `
|
|
|
248
246
|
</button>
|
|
249
247
|
</div>
|
|
250
248
|
</div>
|
|
251
|
-
</
|
|
249
|
+
</DocumentFragment>
|
|
252
250
|
`;
|
|
@@ -12,8 +12,6 @@ export interface LoginFooterItemProps extends React.HTMLProps<HTMLAnchorElement>
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const LoginFooterItem: React.FunctionComponent<LoginFooterItemProps> = ({
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
-
className = '',
|
|
17
15
|
children = null,
|
|
18
16
|
href = '#',
|
|
19
17
|
target = '_blank',
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
4
5
|
|
|
5
6
|
import { LoginFooterItem } from '../LoginFooterItem';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
describe('LoginFooterItem', () => {
|
|
9
|
+
test('renders with PatternFly Core styles', () => {
|
|
10
|
+
const { asFragment } = render(<LoginFooterItem target="_self" href="#" />);
|
|
11
|
+
expect(asFragment()).toMatchSnapshot();
|
|
12
|
+
});
|
|
11
13
|
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
14
|
+
test('className is added to the root element', () => {
|
|
15
|
+
render(<LoginFooterItem className="extra-class" />);
|
|
16
|
+
expect(screen.getByRole('link')).toHaveClass('extra-class');
|
|
17
|
+
});
|
|
16
18
|
|
|
17
|
-
test('
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
test('with custom node', () => {
|
|
20
|
+
const CustomNode = () => <div>My custom node</div>;
|
|
21
|
+
|
|
22
|
+
render(
|
|
23
|
+
<LoginFooterItem>
|
|
24
|
+
<CustomNode />
|
|
25
|
+
</LoginFooterItem>
|
|
26
|
+
);
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const view = render(
|
|
26
|
-
<LoginFooterItem>
|
|
27
|
-
<CustomNode />
|
|
28
|
-
</LoginFooterItem>
|
|
29
|
-
);
|
|
30
|
-
expect(view.container).toMatchSnapshot();
|
|
28
|
+
expect(screen.getByText('My custom node')).toBeInTheDocument();
|
|
29
|
+
});
|
|
31
30
|
});
|
|
@@ -1,41 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
5
3
|
import { LoginForm } from '../LoginForm';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
describe('LoginForm', () => {
|
|
7
|
+
test('should render Login form', () => {
|
|
8
|
+
render(<LoginForm data-testid="form-test-id" />);
|
|
9
|
+
expect(screen.getByTestId('form-test-id').outerHTML).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
11
|
|
|
12
|
-
test('should call onChangeUsername callback', () => {
|
|
13
|
-
|
|
14
|
-
const view = shallow(<LoginForm onChangeUsername={mockFn} rememberMeLabel="Login Form" />);
|
|
15
|
-
view.find('#pf-login-username-id').simulate('change');
|
|
16
|
-
expect(mockFn).toHaveBeenCalled();
|
|
17
|
-
});
|
|
12
|
+
test('should call onChangeUsername callback', () => {
|
|
13
|
+
const mockFn = jest.fn();
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
const mockFn = jest.fn();
|
|
21
|
-
const view = shallow(<LoginForm onChangePassword={mockFn} rememberMeLabel="Login Form" />);
|
|
22
|
-
view.find('#pf-login-password-id').simulate('change');
|
|
23
|
-
expect(mockFn).toHaveBeenCalled();
|
|
24
|
-
});
|
|
15
|
+
render(<LoginForm onChangeUsername={mockFn} rememberMeLabel="Remember me" />);
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
view.find('#pf-login-remember-me-id').simulate('change');
|
|
30
|
-
expect(mockFn).toHaveBeenCalled();
|
|
31
|
-
});
|
|
17
|
+
userEvent.type(screen.getByText('Username'), 'updatedUserName');
|
|
18
|
+
expect(mockFn).toHaveBeenCalled();
|
|
19
|
+
});
|
|
32
20
|
|
|
33
|
-
test('
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
21
|
+
test('should call onChangePassword callback', () => {
|
|
22
|
+
const mockFn = jest.fn();
|
|
23
|
+
|
|
24
|
+
render(<LoginForm onChangePassword={mockFn} rememberMeLabel="Remember me" />);
|
|
25
|
+
|
|
26
|
+
userEvent.type(screen.getByText('Password'), 'updatedPassword');
|
|
27
|
+
expect(mockFn).toHaveBeenCalled();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('should call onChangeRememberMe callback', () => {
|
|
31
|
+
const mockFn = jest.fn();
|
|
32
|
+
|
|
33
|
+
render(<LoginForm onChangeRememberMe={mockFn} rememberMeLabel="Remember me" />);
|
|
34
|
+
|
|
35
|
+
userEvent.click(screen.getByLabelText('Remember me'));
|
|
36
|
+
expect(mockFn).toHaveBeenCalled();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('LoginForm with rememberMeLabel', () => {
|
|
40
|
+
render(<LoginForm rememberMeLabel="Remember me" data-testid="form-test-id" />);
|
|
41
|
+
expect(screen.getByTestId('form-test-id').outerHTML).toMatchSnapshot();
|
|
42
|
+
});
|
|
37
43
|
|
|
38
|
-
test('LoginForm with show password', () => {
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
test('LoginForm with show password', () => {
|
|
45
|
+
render(<LoginForm isShowPasswordEnabled data-testid="form-test-id" />);
|
|
46
|
+
expect(screen.getByTestId('form-test-id').outerHTML).toMatchSnapshot();
|
|
47
|
+
});
|
|
41
48
|
});
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
5
3
|
import { LoginMainBody } from '../LoginMainBody';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
const view = shallow(<LoginMainBody className="extra-class" />);
|
|
14
|
-
expect(view.prop('className')).toMatchSnapshot();
|
|
15
|
-
});
|
|
5
|
+
describe('LoginMainBody', () => {
|
|
6
|
+
test('renders with PatternFly Core styles', () => {
|
|
7
|
+
render(<LoginMainBody data-testid="test-id" />);
|
|
8
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
9
|
+
});
|
|
16
10
|
|
|
17
|
-
test('
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
test('className is added to the root element', () => {
|
|
12
|
+
render(<LoginMainBody className="extra-class" data-testid="test-id" />);
|
|
13
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
14
|
+
});
|
|
21
15
|
});
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
5
3
|
import { LoginMainFooter } from '../LoginMainFooter';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
const view = shallow(<LoginMainFooter className="extra-class" />);
|
|
14
|
-
expect(view.prop('className')).toMatchSnapshot();
|
|
15
|
-
});
|
|
5
|
+
describe('LoginMainFooter', () => {
|
|
6
|
+
test('renders with PatternFly Core styles', () => {
|
|
7
|
+
render(<LoginMainFooter data-testid="test-id" />);
|
|
8
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
9
|
+
});
|
|
16
10
|
|
|
17
|
-
test('
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
test('className is added to the root element', () => {
|
|
12
|
+
render(<LoginMainFooter className="extra-class" data-testid="test-id" />);
|
|
13
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
14
|
+
});
|
|
21
15
|
});
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
4
5
|
|
|
5
6
|
import { LoginMainFooterBandItem } from '../LoginMainFooterBandItem';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
describe('LoginMainFooterBandItem', () => {
|
|
9
|
+
test('renders with PatternFly Core styles', () => {
|
|
10
|
+
const { asFragment } = render(<LoginMainFooterBandItem />);
|
|
11
|
+
expect(asFragment()).toMatchSnapshot();
|
|
12
|
+
});
|
|
11
13
|
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
14
|
+
test('className is added to the root element', () => {
|
|
15
|
+
render(<LoginMainFooterBandItem className="extra-class">test</LoginMainFooterBandItem>);
|
|
16
|
+
expect(screen.getByText('test')).toHaveClass('extra-class');
|
|
17
|
+
});
|
|
16
18
|
|
|
17
|
-
test('
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
test('with custom node', () => {
|
|
20
|
+
const CustomNode = () => <div>My custom node</div>;
|
|
21
|
+
|
|
22
|
+
render(
|
|
23
|
+
<LoginMainFooterBandItem>
|
|
24
|
+
<CustomNode />
|
|
25
|
+
</LoginMainFooterBandItem>
|
|
26
|
+
);
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const view = render(
|
|
26
|
-
<LoginMainFooterBandItem>
|
|
27
|
-
<CustomNode />
|
|
28
|
-
</LoginMainFooterBandItem>
|
|
29
|
-
);
|
|
30
|
-
expect(view.container).toMatchSnapshot();
|
|
28
|
+
expect(screen.getByText('My custom node')).toBeInTheDocument();
|
|
29
|
+
});
|
|
31
30
|
});
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
5
3
|
import { LoginMainFooterLinksItem } from '../LoginMainFooterLinksItem';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
describe('LoginMainFooterLinksItem', () => {
|
|
6
|
+
test('renders with PatternFly Core styles', () => {
|
|
7
|
+
render(<LoginMainFooterLinksItem href="#" target="" />);
|
|
8
|
+
expect(screen.getByRole('listitem').outerHTML).toMatchSnapshot();
|
|
9
|
+
});
|
|
11
10
|
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
11
|
+
test('className is added to the root element', () => {
|
|
12
|
+
render(<LoginMainFooterLinksItem className="extra-class" />);
|
|
13
|
+
expect(screen.getByRole('listitem').outerHTML).toMatchSnapshot();
|
|
14
|
+
});
|
|
16
15
|
|
|
17
|
-
test('
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
test('with custom node', () => {
|
|
17
|
+
const CustomNode = () => <div>My custom node</div>;
|
|
18
|
+
|
|
19
|
+
render(
|
|
20
|
+
<LoginMainFooterLinksItem>
|
|
21
|
+
<CustomNode />
|
|
22
|
+
</LoginMainFooterLinksItem>
|
|
23
|
+
);
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const view = render(
|
|
26
|
-
<LoginMainFooterLinksItem>
|
|
27
|
-
<CustomNode />
|
|
28
|
-
</LoginMainFooterLinksItem>
|
|
29
|
-
);
|
|
30
|
-
expect(view.container).toMatchSnapshot();
|
|
25
|
+
expect(screen.getByRole('listitem').outerHTML).toMatchSnapshot();
|
|
26
|
+
});
|
|
31
27
|
});
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { shallow } from 'enzyme';
|
|
4
|
-
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
5
3
|
import { LoginMainHeader } from '../LoginMainHeader';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
describe('LoginMainHeader', () => {
|
|
6
|
+
test('renders with PatternFly Core styles', () => {
|
|
7
|
+
render(<LoginMainHeader data-testid="test-id" />);
|
|
8
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
9
|
+
});
|
|
11
10
|
|
|
12
|
-
test('className is added to the root element', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('extra props are spread to the root element', () => {
|
|
18
|
-
const testId = 'login-header';
|
|
19
|
-
const view = shallow(<LoginMainHeader data-testid={testId} />);
|
|
20
|
-
expect(view.prop('data-testid')).toBe(testId);
|
|
21
|
-
});
|
|
11
|
+
test('className is added to the root element', () => {
|
|
12
|
+
render(<LoginMainHeader className="extra-class" data-testid="test-id" />);
|
|
13
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
14
|
+
});
|
|
22
15
|
|
|
23
|
-
test('title and subtitle are rendered correctly', () => {
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
test('title and subtitle are rendered correctly', () => {
|
|
17
|
+
render(<LoginMainHeader title="Log in to your account" subtitle="Use LDAP credentials" data-testid="test-id" />);
|
|
18
|
+
expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
|
|
19
|
+
});
|
|
26
20
|
});
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`LoginFooterItem
|
|
4
|
-
<
|
|
5
|
-
<div>
|
|
6
|
-
My custom node
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`className is added to the root element 1`] = `undefined`;
|
|
12
|
-
|
|
13
|
-
exports[`renders with PatternFly Core styles 1`] = `
|
|
14
|
-
<div>
|
|
3
|
+
exports[`LoginFooterItem renders with PatternFly Core styles 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
15
5
|
<a
|
|
16
6
|
href="#"
|
|
17
7
|
target="_self"
|
|
18
8
|
/>
|
|
19
|
-
</
|
|
9
|
+
</DocumentFragment>
|
|
20
10
|
`;
|