Skip to content

Commit 9136293

Browse files
authored
Public Components Snapshot Tests (opensearch-project#218)
Signed-off-by: Sinisa Andric <[email protected]> Signed-off-by: Sinisa Andric <[email protected]>
1 parent 9444e27 commit 9136293

File tree

6 files changed

+452
-0
lines changed

6 files changed

+452
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import React from 'react';
7+
import { render } from '@testing-library/react';
8+
import DeleteModal from './DeleteModal';
9+
10+
describe('<DeleteModal /> spec', () => {
11+
it('renders the component', () => {
12+
const tree = render(
13+
<DeleteModal
14+
closeDeleteModal={() => jest.fn()}
15+
ids={'some ids'}
16+
onClickDelete={() => jest.fn()}
17+
type={'some type'}
18+
/>
19+
);
20+
expect(tree).toMatchSnapshot();
21+
});
22+
});
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<DeleteModal /> spec renders the component 1`] = `
4+
Object {
5+
"asFragment": [Function],
6+
"baseElement": <body
7+
class="euiBody-hasOverlayMask"
8+
>
9+
<div
10+
aria-hidden="true"
11+
data-aria-hidden="true"
12+
/>
13+
<div
14+
aria-hidden="true"
15+
class="euiOverlayMask euiOverlayMask--aboveHeader"
16+
data-aria-hidden="true"
17+
/>
18+
<div
19+
class="euiOverlayMask euiOverlayMask--aboveHeader"
20+
>
21+
<div
22+
aria-hidden="true"
23+
data-aria-hidden="true"
24+
data-focus-guard="true"
25+
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
26+
tabindex="0"
27+
/>
28+
<div
29+
data-focus-lock-disabled="false"
30+
>
31+
<div
32+
class="euiModal euiModal--maxWidth-default euiModal--confirmation"
33+
tabindex="0"
34+
>
35+
<button
36+
aria-label="Closes this modal window"
37+
class="euiButtonIcon euiButtonIcon--text euiButtonIcon--empty euiButtonIcon--xSmall euiModal__closeIcon"
38+
type="button"
39+
>
40+
EuiIconMock
41+
</button>
42+
<div
43+
class="euiModal__flex"
44+
>
45+
<div
46+
class="euiModalHeader"
47+
>
48+
<div
49+
class="euiModalHeader__title"
50+
data-test-subj="confirmModalTitleText"
51+
>
52+
Delete some type
53+
</div>
54+
</div>
55+
<div
56+
class="euiModalBody"
57+
>
58+
<div
59+
class="euiModalBody__overflow"
60+
>
61+
<div
62+
class="euiText euiText--medium"
63+
data-test-subj="confirmModalBodyText"
64+
>
65+
<div
66+
class="euiForm"
67+
>
68+
<p>
69+
Delete "
70+
<strong>
71+
some ids
72+
</strong>
73+
" permanently?
74+
</p>
75+
<div
76+
class="euiSpacer euiSpacer--s"
77+
/>
78+
</div>
79+
</div>
80+
</div>
81+
</div>
82+
<div
83+
class="euiModalFooter"
84+
>
85+
<button
86+
class="euiButtonEmpty euiButtonEmpty--primary"
87+
data-test-subj="confirmModalCancelButton"
88+
type="button"
89+
>
90+
<span
91+
class="euiButtonContent euiButtonEmpty__content"
92+
>
93+
<span
94+
class="euiButtonEmpty__text"
95+
>
96+
Cancel
97+
</span>
98+
</span>
99+
</button>
100+
<button
101+
class="euiButton euiButton--danger euiButton--fill"
102+
data-test-subj="confirmModalConfirmButton"
103+
type="button"
104+
>
105+
<span
106+
class="euiButtonContent euiButton__content"
107+
>
108+
<span
109+
class="euiButton__text"
110+
>
111+
Delete some type
112+
</span>
113+
</span>
114+
</button>
115+
</div>
116+
</div>
117+
</div>
118+
</div>
119+
<div
120+
aria-hidden="true"
121+
data-aria-hidden="true"
122+
data-focus-guard="true"
123+
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
124+
tabindex="0"
125+
/>
126+
</div>
127+
</body>,
128+
"container": <div
129+
aria-hidden="true"
130+
data-aria-hidden="true"
131+
/>,
132+
"debug": [Function],
133+
"findAllByAltText": [Function],
134+
"findAllByDisplayValue": [Function],
135+
"findAllByLabelText": [Function],
136+
"findAllByPlaceholderText": [Function],
137+
"findAllByRole": [Function],
138+
"findAllByTestId": [Function],
139+
"findAllByText": [Function],
140+
"findAllByTitle": [Function],
141+
"findByAltText": [Function],
142+
"findByDisplayValue": [Function],
143+
"findByLabelText": [Function],
144+
"findByPlaceholderText": [Function],
145+
"findByRole": [Function],
146+
"findByTestId": [Function],
147+
"findByText": [Function],
148+
"findByTitle": [Function],
149+
"getAllByAltText": [Function],
150+
"getAllByDisplayValue": [Function],
151+
"getAllByLabelText": [Function],
152+
"getAllByPlaceholderText": [Function],
153+
"getAllByRole": [Function],
154+
"getAllByTestId": [Function],
155+
"getAllByText": [Function],
156+
"getAllByTitle": [Function],
157+
"getByAltText": [Function],
158+
"getByDisplayValue": [Function],
159+
"getByLabelText": [Function],
160+
"getByPlaceholderText": [Function],
161+
"getByRole": [Function],
162+
"getByTestId": [Function],
163+
"getByText": [Function],
164+
"getByTitle": [Function],
165+
"queryAllByAltText": [Function],
166+
"queryAllByDisplayValue": [Function],
167+
"queryAllByLabelText": [Function],
168+
"queryAllByPlaceholderText": [Function],
169+
"queryAllByRole": [Function],
170+
"queryAllByTestId": [Function],
171+
"queryAllByText": [Function],
172+
"queryAllByTitle": [Function],
173+
"queryByAltText": [Function],
174+
"queryByDisplayValue": [Function],
175+
"queryByLabelText": [Function],
176+
"queryByPlaceholderText": [Function],
177+
"queryByRole": [Function],
178+
"queryByTestId": [Function],
179+
"queryByText": [Function],
180+
"queryByTitle": [Function],
181+
"rerender": [Function],
182+
"unmount": [Function],
183+
}
184+
`;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import React from 'react';
7+
import { render } from '@testing-library/react';
8+
import { FormFieldHeader } from './FormFieldHeader';
9+
10+
describe('<FormFieldHeader /> spec', () => {
11+
it('renders the component', () => {
12+
const tree = render(<FormFieldHeader headerTitle={'some title'} />);
13+
expect(tree).toMatchSnapshot();
14+
});
15+
});
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<FormFieldHeader /> spec renders the component 1`] = `
4+
Object {
5+
"asFragment": [Function],
6+
"baseElement": <body>
7+
<div>
8+
<div
9+
class="euiText euiText--small"
10+
>
11+
<strong>
12+
some title
13+
</strong>
14+
</div>
15+
</div>
16+
</body>,
17+
"container": <div>
18+
<div
19+
class="euiText euiText--small"
20+
>
21+
<strong>
22+
some title
23+
</strong>
24+
</div>
25+
</div>,
26+
"debug": [Function],
27+
"findAllByAltText": [Function],
28+
"findAllByDisplayValue": [Function],
29+
"findAllByLabelText": [Function],
30+
"findAllByPlaceholderText": [Function],
31+
"findAllByRole": [Function],
32+
"findAllByTestId": [Function],
33+
"findAllByText": [Function],
34+
"findAllByTitle": [Function],
35+
"findByAltText": [Function],
36+
"findByDisplayValue": [Function],
37+
"findByLabelText": [Function],
38+
"findByPlaceholderText": [Function],
39+
"findByRole": [Function],
40+
"findByTestId": [Function],
41+
"findByText": [Function],
42+
"findByTitle": [Function],
43+
"getAllByAltText": [Function],
44+
"getAllByDisplayValue": [Function],
45+
"getAllByLabelText": [Function],
46+
"getAllByPlaceholderText": [Function],
47+
"getAllByRole": [Function],
48+
"getAllByTestId": [Function],
49+
"getAllByText": [Function],
50+
"getAllByTitle": [Function],
51+
"getByAltText": [Function],
52+
"getByDisplayValue": [Function],
53+
"getByLabelText": [Function],
54+
"getByPlaceholderText": [Function],
55+
"getByRole": [Function],
56+
"getByTestId": [Function],
57+
"getByText": [Function],
58+
"getByTitle": [Function],
59+
"queryAllByAltText": [Function],
60+
"queryAllByDisplayValue": [Function],
61+
"queryAllByLabelText": [Function],
62+
"queryAllByPlaceholderText": [Function],
63+
"queryAllByRole": [Function],
64+
"queryAllByTestId": [Function],
65+
"queryAllByText": [Function],
66+
"queryAllByTitle": [Function],
67+
"queryByAltText": [Function],
68+
"queryByDisplayValue": [Function],
69+
"queryByLabelText": [Function],
70+
"queryByPlaceholderText": [Function],
71+
"queryByRole": [Function],
72+
"queryByTestId": [Function],
73+
"queryByText": [Function],
74+
"queryByTitle": [Function],
75+
"rerender": [Function],
76+
"unmount": [Function],
77+
}
78+
`;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import React from 'react';
7+
import { render } from '@testing-library/react';
8+
import { NotificationsCallOut } from './NotificationsCallOut';
9+
10+
describe('<NotificationsCallOut /> spec', () => {
11+
it('renders the component', () => {
12+
const tree = render(<NotificationsCallOut />);
13+
expect(tree).toMatchSnapshot();
14+
});
15+
});

0 commit comments

Comments
 (0)