Spanish survey support (#1589)

* Spanish site improvements

* surveybutton localization

* Basic ES support. Localization done, too.

* Update test snapshots.

Co-authored-by: Jorge Escobar <jorge.e.escobar@omb.eop.gov>
This commit is contained in:
TomNUSDS 2022-04-27 07:38:59 -07:00 committed by GitHub
commit 5b5d6051a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 167 additions and 123 deletions

View file

@ -2,7 +2,7 @@ import * as React from 'react';
import {render} from '@testing-library/react';
import {LocalizedComponent} from '../../test/testHelpers';
import SurveyButton from './SurveyButton';
import {onClickHandler} from './SurveyButton';
describe('rendering of the SurveyButton', () => {
const {asFragment} = render(
<LocalizedComponent>
@ -14,8 +14,3 @@ describe('rendering of the SurveyButton', () => {
expect(asFragment()).toMatchSnapshot();
});
});
describe('test clickHandler', () => {
it('clickHandler should fire successfully', () => {
onClickHandler();
});
});

View file

@ -9,26 +9,24 @@ import J40MainGridContainer from '../J40MainGridContainer';
// @ts-ignore
import launchIcon from '/node_modules/uswds/dist/img/usa-icons/launch.svg';
export const onClickHandler = () => {
Object.assign(document.createElement('a'), {target: '_blank', href: 'https://www.surveymonkey.com/r/cejst-survey'}).click();
};
const SurveyButton = () => {
const intl = useIntl();
const href = intl.formatMessage(CONTACT_COPY.PAGE_INTRO.SURVEY_URL);
return (
<J40MainGridContainer className={styles.surveyButtonContainer}>
<Button
type='button'
className={styles.surveyButton}
onClick={() => onClickHandler()}>
{intl.formatMessage(CONTACT_COPY.PAGE_INTRO.SURVEY_TEXT)}
<img
className={styles.launchIcon}
src={launchIcon}
alt={'launch icon'}
/>
</Button>
<a href={href}>
<Button
type="button"
className={styles.surveyButton}>
{intl.formatMessage(CONTACT_COPY.PAGE_INTRO.SURVEY_TEXT)}
<img
className={styles.launchIcon}
src={launchIcon}
alt={'launch icon'}
/>
</Button>
</a>
</J40MainGridContainer>
);
};

View file

@ -6,17 +6,21 @@ exports[`rendering of the SurveyButton checks if component renders 1`] = `
class="grid-container-desktop-lg"
data-testid="gridContainer"
>
<button
class="usa-button"
data-testid="button"
type="button"
<a
href="https://www.surveymonkey.com/r/cejst-survey"
>
Help improve the site & data
<img
alt="launch icon"
src="test-file-stub"
/>
</button>
<button
class="usa-button"
data-testid="button"
type="button"
>
Help improve the site & data
<img
alt="launch icon"
src="test-file-stub"
/>
</button>
</a>
</div>
</DocumentFragment>
`;