-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Change results number to displayed number Signed-off-by: Mingkun Ma <[email protected]> * Add babelrc config Signed-off-by: Mingkun Ma <[email protected]> * Add unit test for search bar Signed-off-by: Mingkun Ma <[email protected]> * Add unit test constants Signed-off-by: Mingkun Ma <[email protected]> * Add unit test for result component Signed-off-by: Mingkun Ma <[email protected]> * Add unit test for result grid Signed-off-by: Mingkun Ma <[email protected]> * Add unit test for common components Signed-off-by: Mingkun Ma <[email protected]> Signed-off-by: Mingkun Ma <[email protected]> Co-authored-by: Mingkun Ma <[email protected]> (cherry picked from commit 909eef1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1f9ac3b
commit 4edae8a
Showing
15 changed files
with
15,757 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4,640 changes: 4,640 additions & 0 deletions
4,640
public/components/common/__test__/__snapshots__/flyout.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
261 changes: 261 additions & 0 deletions
261
public/components/common/__test__/__snapshots__/header.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Header component Renders header component 1`] = ` | ||
<Header> | ||
<EuiPanel | ||
borderRadius="none" | ||
grow={false} | ||
hasBorder={false} | ||
hasShadow={false} | ||
style={ | ||
Object { | ||
"borderBottom": "1px solid #D3DAE6", | ||
} | ||
} | ||
> | ||
<div | ||
className="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--plain euiPanel--noShadow euiPanel--noBorder euiPanel--flexGrowZero" | ||
style={ | ||
Object { | ||
"borderBottom": "1px solid #D3DAE6", | ||
} | ||
} | ||
> | ||
<EuiPageHeader | ||
pageTitle="Compare search results" | ||
> | ||
<header | ||
className="euiPageHeader euiPageHeader--responsive euiPageHeader--center" | ||
> | ||
<EuiPageHeaderContent | ||
pageTitle="Compare search results" | ||
responsive={true} | ||
> | ||
<div | ||
className="euiPageHeaderContent" | ||
> | ||
<EuiFlexGroup | ||
alignItems="flexStart" | ||
className="euiPageHeaderContent__top" | ||
gutterSize="l" | ||
responsive={true} | ||
> | ||
<div | ||
className="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsFlexStart euiFlexGroup--directionRow euiFlexGroup--responsive euiPageHeaderContent__top" | ||
> | ||
<EuiFlexItem> | ||
<div | ||
className="euiFlexItem" | ||
> | ||
<EuiTitle | ||
size="l" | ||
> | ||
<h1 | ||
className="euiTitle euiTitle--large" | ||
> | ||
Compare search results | ||
</h1> | ||
</EuiTitle> | ||
</div> | ||
</EuiFlexItem> | ||
</div> | ||
</EuiFlexGroup> | ||
<div | ||
className="euiPageHeaderContent__bottom" | ||
> | ||
<EuiSpacer> | ||
<div | ||
className="euiSpacer euiSpacer--l" | ||
/> | ||
</EuiSpacer> | ||
<EuiCallOut | ||
iconType="iInCircle" | ||
title="Experimental Feature" | ||
> | ||
<div | ||
className="euiCallOut euiCallOut--primary" | ||
> | ||
<div | ||
className="euiCallOutHeader" | ||
> | ||
<EuiIcon | ||
aria-hidden="true" | ||
className="euiCallOutHeader__icon" | ||
color="inherit" | ||
size="m" | ||
type="iInCircle" | ||
> | ||
<EuiIconEmpty | ||
aria-hidden={true} | ||
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
role="img" | ||
style={null} | ||
> | ||
<svg | ||
aria-hidden={true} | ||
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
height={16} | ||
role="img" | ||
style={null} | ||
viewBox="0 0 16 16" | ||
width={16} | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</EuiIconEmpty> | ||
</EuiIcon> | ||
<span | ||
className="euiCallOutHeader__title" | ||
> | ||
Experimental Feature | ||
</span> | ||
</div> | ||
<EuiText | ||
color="default" | ||
size="s" | ||
> | ||
<div | ||
className="euiText euiText--small" | ||
> | ||
<EuiTextColor | ||
color="default" | ||
component="div" | ||
> | ||
<div | ||
className="euiTextColor euiTextColor--default" | ||
> | ||
<EuiText> | ||
<div | ||
className="euiText euiText--medium" | ||
> | ||
<p> | ||
Compare results using the same search text with different queries. For more information, see the | ||
<EuiLink | ||
href="https://opensearch.org/docs/latest/search-plugins/search-relevance" | ||
target="_blank" | ||
> | ||
<a | ||
className="euiLink euiLink--primary" | ||
href="https://opensearch.org/docs/latest/search-plugins/search-relevance" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
Compare Search Results Documentation | ||
<EuiIcon | ||
aria-label="External link" | ||
className="euiLink__externalIcon" | ||
size="s" | ||
type="popout" | ||
> | ||
<EuiIconEmpty | ||
aria-hidden={true} | ||
aria-label="External link" | ||
className="euiIcon euiIcon--small euiIcon-isLoading euiLink__externalIcon" | ||
focusable="false" | ||
role="img" | ||
style={null} | ||
> | ||
<svg | ||
aria-hidden={true} | ||
aria-label="External link" | ||
className="euiIcon euiIcon--small euiIcon-isLoading euiLink__externalIcon" | ||
focusable="false" | ||
height={16} | ||
role="img" | ||
style={null} | ||
viewBox="0 0 16 16" | ||
width={16} | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</EuiIconEmpty> | ||
</EuiIcon> | ||
<EuiScreenReaderOnly> | ||
<span | ||
className="euiScreenReaderOnly" | ||
> | ||
<EuiI18n | ||
default="(opens in a new tab or window)" | ||
token="euiLink.newTarget.screenReaderOnlyText" | ||
> | ||
(opens in a new tab or window) | ||
</EuiI18n> | ||
</span> | ||
</EuiScreenReaderOnly> | ||
</a> | ||
</EuiLink> | ||
. To leave feedback, visit | ||
<EuiLink | ||
href="https://forum.opensearch.org/t/feedback-experimental-feature-compare-search-results/11331" | ||
target="_blank" | ||
> | ||
<a | ||
className="euiLink euiLink--primary" | ||
href="https://forum.opensearch.org/t/feedback-experimental-feature-compare-search-results/11331" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
forums.opensearch.com | ||
<EuiIcon | ||
aria-label="External link" | ||
className="euiLink__externalIcon" | ||
size="s" | ||
type="popout" | ||
> | ||
<EuiIconEmpty | ||
aria-hidden={true} | ||
aria-label="External link" | ||
className="euiIcon euiIcon--small euiIcon-isLoading euiLink__externalIcon" | ||
focusable="false" | ||
role="img" | ||
style={null} | ||
> | ||
<svg | ||
aria-hidden={true} | ||
aria-label="External link" | ||
className="euiIcon euiIcon--small euiIcon-isLoading euiLink__externalIcon" | ||
focusable="false" | ||
height={16} | ||
role="img" | ||
style={null} | ||
viewBox="0 0 16 16" | ||
width={16} | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</EuiIconEmpty> | ||
</EuiIcon> | ||
<EuiScreenReaderOnly> | ||
<span | ||
className="euiScreenReaderOnly" | ||
> | ||
<EuiI18n | ||
default="(opens in a new tab or window)" | ||
token="euiLink.newTarget.screenReaderOnlyText" | ||
> | ||
(opens in a new tab or window) | ||
</EuiI18n> | ||
</span> | ||
</EuiScreenReaderOnly> | ||
</a> | ||
</EuiLink> | ||
. | ||
</p> | ||
</div> | ||
</EuiText> | ||
</div> | ||
</EuiTextColor> | ||
</div> | ||
</EuiText> | ||
</div> | ||
</EuiCallOut> | ||
</div> | ||
</div> | ||
</EuiPageHeaderContent> | ||
</header> | ||
</EuiPageHeader> | ||
</div> | ||
</EuiPanel> | ||
</Header> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import { Flyout } from '../flyout'; | ||
import { SearchRelevanceContextProvider } from '../../../contexts'; | ||
|
||
describe('Flyout component', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders flyout component', async () => { | ||
const wrapper = mount( | ||
<SearchRelevanceContextProvider> | ||
<Flyout /> | ||
</SearchRelevanceContextProvider> | ||
); | ||
|
||
wrapper.update(); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import { Header } from '../header'; | ||
|
||
describe('Header component', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders header component', async () => { | ||
const wrapper = mount(<Header />); | ||
|
||
wrapper.update(); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.