Skip to content

Commit

Permalink
Public Components Snapshot Tests (opensearch-project#218) (opensearch…
Browse files Browse the repository at this point in the history
…-project#234)

Signed-off-by: Sinisa Andric <[email protected]>

Signed-off-by: Sinisa Andric <[email protected]>
(cherry picked from commit 9136293)

Co-authored-by: Sinisa Andric <[email protected]>
Signed-off-by: AWSHurneyt <[email protected]>
  • Loading branch information
2 people authored and AWSHurneyt committed Oct 12, 2023
1 parent 1336d43 commit d14a67e
Show file tree
Hide file tree
Showing 6 changed files with 452 additions and 0 deletions.
22 changes: 22 additions & 0 deletions public/components/DeleteModal/DeleteModal.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { render } from '@testing-library/react';
import DeleteModal from './DeleteModal';

describe('<DeleteModal /> spec', () => {
it('renders the component', () => {
const tree = render(
<DeleteModal
closeDeleteModal={() => jest.fn()}
ids={'some ids'}
onClickDelete={() => jest.fn()}
type={'some type'}
/>
);
expect(tree).toMatchSnapshot();
});
});
184 changes: 184 additions & 0 deletions public/components/DeleteModal/__snapshots__/DeleteModal.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<DeleteModal /> spec renders the component 1`] = `
Object {
"asFragment": [Function],
"baseElement": <body
class="euiBody-hasOverlayMask"
>
<div
aria-hidden="true"
data-aria-hidden="true"
/>
<div
aria-hidden="true"
class="euiOverlayMask euiOverlayMask--aboveHeader"
data-aria-hidden="true"
/>
<div
class="euiOverlayMask euiOverlayMask--aboveHeader"
>
<div
aria-hidden="true"
data-aria-hidden="true"
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
<div
data-focus-lock-disabled="false"
>
<div
class="euiModal euiModal--maxWidth-default euiModal--confirmation"
tabindex="0"
>
<button
aria-label="Closes this modal window"
class="euiButtonIcon euiButtonIcon--text euiButtonIcon--empty euiButtonIcon--xSmall euiModal__closeIcon"
type="button"
>
EuiIconMock
</button>
<div
class="euiModal__flex"
>
<div
class="euiModalHeader"
>
<div
class="euiModalHeader__title"
data-test-subj="confirmModalTitleText"
>
Delete some type
</div>
</div>
<div
class="euiModalBody"
>
<div
class="euiModalBody__overflow"
>
<div
class="euiText euiText--medium"
data-test-subj="confirmModalBodyText"
>
<div
class="euiForm"
>
<p>
Delete "
<strong>
some ids
</strong>
" permanently?
</p>
<div
class="euiSpacer euiSpacer--s"
/>
</div>
</div>
</div>
</div>
<div
class="euiModalFooter"
>
<button
class="euiButtonEmpty euiButtonEmpty--primary"
data-test-subj="confirmModalCancelButton"
type="button"
>
<span
class="euiButtonContent euiButtonEmpty__content"
>
<span
class="euiButtonEmpty__text"
>
Cancel
</span>
</span>
</button>
<button
class="euiButton euiButton--danger euiButton--fill"
data-test-subj="confirmModalConfirmButton"
type="button"
>
<span
class="euiButtonContent euiButton__content"
>
<span
class="euiButton__text"
>
Delete some type
</span>
</span>
</button>
</div>
</div>
</div>
</div>
<div
aria-hidden="true"
data-aria-hidden="true"
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
</div>
</body>,
"container": <div
aria-hidden="true"
data-aria-hidden="true"
/>,
"debug": [Function],
"findAllByAltText": [Function],
"findAllByDisplayValue": [Function],
"findAllByLabelText": [Function],
"findAllByPlaceholderText": [Function],
"findAllByRole": [Function],
"findAllByTestId": [Function],
"findAllByText": [Function],
"findAllByTitle": [Function],
"findByAltText": [Function],
"findByDisplayValue": [Function],
"findByLabelText": [Function],
"findByPlaceholderText": [Function],
"findByRole": [Function],
"findByTestId": [Function],
"findByText": [Function],
"findByTitle": [Function],
"getAllByAltText": [Function],
"getAllByDisplayValue": [Function],
"getAllByLabelText": [Function],
"getAllByPlaceholderText": [Function],
"getAllByRole": [Function],
"getAllByTestId": [Function],
"getAllByText": [Function],
"getAllByTitle": [Function],
"getByAltText": [Function],
"getByDisplayValue": [Function],
"getByLabelText": [Function],
"getByPlaceholderText": [Function],
"getByRole": [Function],
"getByTestId": [Function],
"getByText": [Function],
"getByTitle": [Function],
"queryAllByAltText": [Function],
"queryAllByDisplayValue": [Function],
"queryAllByLabelText": [Function],
"queryAllByPlaceholderText": [Function],
"queryAllByRole": [Function],
"queryAllByTestId": [Function],
"queryAllByText": [Function],
"queryAllByTitle": [Function],
"queryByAltText": [Function],
"queryByDisplayValue": [Function],
"queryByLabelText": [Function],
"queryByPlaceholderText": [Function],
"queryByRole": [Function],
"queryByTestId": [Function],
"queryByText": [Function],
"queryByTitle": [Function],
"rerender": [Function],
"unmount": [Function],
}
`;
15 changes: 15 additions & 0 deletions public/components/FormFieldHeader/FormFieldHeader.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { render } from '@testing-library/react';
import { FormFieldHeader } from './FormFieldHeader';

describe('<FormFieldHeader /> spec', () => {
it('renders the component', () => {
const tree = render(<FormFieldHeader headerTitle={'some title'} />);
expect(tree).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<FormFieldHeader /> spec renders the component 1`] = `
Object {
"asFragment": [Function],
"baseElement": <body>
<div>
<div
class="euiText euiText--small"
>
<strong>
some title
</strong>
</div>
</div>
</body>,
"container": <div>
<div
class="euiText euiText--small"
>
<strong>
some title
</strong>
</div>
</div>,
"debug": [Function],
"findAllByAltText": [Function],
"findAllByDisplayValue": [Function],
"findAllByLabelText": [Function],
"findAllByPlaceholderText": [Function],
"findAllByRole": [Function],
"findAllByTestId": [Function],
"findAllByText": [Function],
"findAllByTitle": [Function],
"findByAltText": [Function],
"findByDisplayValue": [Function],
"findByLabelText": [Function],
"findByPlaceholderText": [Function],
"findByRole": [Function],
"findByTestId": [Function],
"findByText": [Function],
"findByTitle": [Function],
"getAllByAltText": [Function],
"getAllByDisplayValue": [Function],
"getAllByLabelText": [Function],
"getAllByPlaceholderText": [Function],
"getAllByRole": [Function],
"getAllByTestId": [Function],
"getAllByText": [Function],
"getAllByTitle": [Function],
"getByAltText": [Function],
"getByDisplayValue": [Function],
"getByLabelText": [Function],
"getByPlaceholderText": [Function],
"getByRole": [Function],
"getByTestId": [Function],
"getByText": [Function],
"getByTitle": [Function],
"queryAllByAltText": [Function],
"queryAllByDisplayValue": [Function],
"queryAllByLabelText": [Function],
"queryAllByPlaceholderText": [Function],
"queryAllByRole": [Function],
"queryAllByTestId": [Function],
"queryAllByText": [Function],
"queryAllByTitle": [Function],
"queryByAltText": [Function],
"queryByDisplayValue": [Function],
"queryByLabelText": [Function],
"queryByPlaceholderText": [Function],
"queryByRole": [Function],
"queryByTestId": [Function],
"queryByText": [Function],
"queryByTitle": [Function],
"rerender": [Function],
"unmount": [Function],
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { render } from '@testing-library/react';
import { NotificationsCallOut } from './NotificationsCallOut';

describe('<NotificationsCallOut /> spec', () => {
it('renders the component', () => {
const tree = render(<NotificationsCallOut />);
expect(tree).toMatchSnapshot();
});
});
Loading

0 comments on commit d14a67e

Please sign in to comment.