mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-16 00:51:40 -07:00
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:
parent
5b4f4af2a7
commit
5b5d6051a8
17 changed files with 167 additions and 123 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue