Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap user-facing strings for internalization #334

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
4,652 changes: 18 additions & 4,634 deletions public/components/common/__test__/__snapshots__/flyout.test.tsx.snap

Large diffs are not rendered by default.

103 changes: 30 additions & 73 deletions public/components/common/__test__/__snapshots__/header.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,88 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Header component Renders header component 1`] = `
<Header>
<I18nProvider>
<EuiPanel
borderRadius="none"
color="transparent"
grow={false}
hasBorder={false}
hasShadow={false}
>
<div
className="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--transparent euiPanel--noShadow euiPanel--noBorder euiPanel--flexGrowZero"
>
<EuiTitle>
<h1
className="euiTitle euiTitle--medium"
>
Compare search results
</h1>
</EuiTitle>
<EuiText>
<div
className="euiText euiText--medium"
>
<p>
Compare results using the same search text with different queries.

<EuiLink
href="https://opensearch.org/docs/latest/search-plugins/search-relevance"
target="_blank"
>
<a
className="euiLink euiLink--primary"
<EuiTitle>
<h1>
<FormattedMessage
defaultMessage="Compare search results"
id="searchRelevance.header.title"
values={Object {}}
/>
</h1>
</EuiTitle>
<EuiText>
<p>
<FormattedMessage
defaultMessage="Compare results using the same search text with different queries. {learnMoreLink}"
id="searchRelevance.header.description"
values={
Object {
"learnMoreLink": <EuiLink
href="https://opensearch.org/docs/latest/search-plugins/search-relevance"
rel="noopener noreferrer"
target="_blank"
>
Learn more
<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>
<FormattedMessage
defaultMessage="Learn more"
id="searchRelevance.header.description.learnMoreLinkLabel"
values={Object {}}
/>
</EuiLink>,
}
}
/>
</p>
</EuiText>
</EuiPanel>
</Header>
</I18nProvider>
`;
4 changes: 2 additions & 2 deletions public/components/common/__test__/flyout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { configure, mount } from 'enzyme';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
Expand All @@ -14,7 +14,7 @@ describe('Flyout component', () => {
configure({ adapter: new Adapter() });

it('Renders flyout component', async () => {
const wrapper = mount(
const wrapper = shallow(
<SearchRelevanceContextProvider>
<Flyout />
</SearchRelevanceContextProvider>
Expand Down
4 changes: 2 additions & 2 deletions public/components/common/__test__/header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { configure, mount } from 'enzyme';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { waitFor } from '@testing-library/react';
Expand All @@ -13,7 +13,7 @@ describe('Header component', () => {
configure({ adapter: new Adapter() });

it('Renders header component', async () => {
const wrapper = mount(<Header />);
const wrapper = shallow(<Header />);

wrapper.update();

Expand Down
Loading
Loading