mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-10-03 03:23:17 -07:00
Latest content changes
This commit is contained in:
parent
53aa46f543
commit
0e84cbac3a
35 changed files with 303 additions and 352 deletions
|
@ -1,8 +1,9 @@
|
|||
import React from 'react';
|
||||
import {Grid} from '@trussworks/react-uswds';
|
||||
import React from 'react';
|
||||
|
||||
import LinkTypeWrapper from '../LinkTypeWrapper';
|
||||
import {hyphenizeString} from '../../../cypress/integration/common/helpers';
|
||||
import LinkTypeWrapper from '../LinkTypeWrapper';
|
||||
import {TagVariant} from '../LinkTypeWrapper/LinkTypeWrapper';
|
||||
|
||||
// the "body" section is the child object to allow for html versus just text
|
||||
interface AboutCardProps {
|
||||
|
@ -10,6 +11,8 @@ interface AboutCardProps {
|
|||
header: string;
|
||||
size: 'small' | 'large';
|
||||
linkText?: string | JSX.Element;
|
||||
linkTag?: string;
|
||||
linkTagVariant?: TagVariant;
|
||||
url?: string;
|
||||
openUrlNewTab?: boolean;
|
||||
className?: string;
|
||||
|
@ -64,6 +67,8 @@ const AboutCard = (props: React.PropsWithChildren<AboutCardProps>) => {
|
|||
internal={props.internal}
|
||||
url={props.url ? props.url : ''}
|
||||
openUrlNewTab={props.openUrlNewTab}
|
||||
tag={props.linkTag}
|
||||
tagVariant={props.linkTagVariant}
|
||||
// className={'j40-aboutcard-link'}
|
||||
/>}
|
||||
</div>
|
||||
|
|
|
@ -49,6 +49,15 @@ $sidePanelLabelFontColor: #171716;
|
|||
@include u-padding-right(2);
|
||||
@include u-padding-top(2);
|
||||
|
||||
p {
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
+ p {
|
||||
@include u-margin-top(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.showCategoriesExceed {
|
||||
|
|
|
@ -47,12 +47,14 @@ const DatasetCard = ({datasetCardProps}: IDatasetCardProps) => {
|
|||
<ul className={styles.datasetCardList}>
|
||||
|
||||
{/* Dataset Used in */}
|
||||
<li className={styles.datasetCardListItem}>
|
||||
<span className={styles.datasetCardLabels}>
|
||||
{intl.formatMessage(METHODOLOGY_COPY.DATASET_CARD_LABELS.USED_IN)}
|
||||
</span>
|
||||
{datasetCardProps.usedIn}
|
||||
</li>
|
||||
{datasetCardProps.usedIn !== METHODOLOGY_COPY.CATEGORIES.OMIT && (
|
||||
<li className={styles.datasetCardListItem}>
|
||||
<span className={styles.datasetCardLabels}>
|
||||
{intl.formatMessage(METHODOLOGY_COPY.DATASET_CARD_LABELS.USED_IN)}
|
||||
</span>
|
||||
{datasetCardProps.usedIn}
|
||||
</li>
|
||||
)}
|
||||
|
||||
{/* Dataset Responsible Party */}
|
||||
<li className={styles.datasetCardListItem}>
|
||||
|
|
|
@ -29,12 +29,6 @@ exports[`rendering of indicator dataset card checks if component renders 1`] = `
|
|||
</p>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<span>
|
||||
Used in:
|
||||
</span>
|
||||
All categories
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
Responsible party:
|
||||
|
|
|
@ -105,12 +105,6 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
|
|||
</p>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<span>
|
||||
Used in:
|
||||
</span>
|
||||
All categories
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
Responsible party:
|
||||
|
|
|
@ -14,6 +14,7 @@ import SurveyButton from '../SurveyButton';
|
|||
// @ts-ignore
|
||||
import {GITHUB_LINK, GITHUB_LINK_ES} from '../../constants';
|
||||
import {PAGES_ENDPOINTS} from '../../data/constants';
|
||||
import * as ABOUT_COPY from '../../data/copy/about';
|
||||
import * as COMMON_COPY from '../../data/copy/common';
|
||||
import whitehouseIcon from '../../images/eop-seal.svg';
|
||||
|
||||
|
@ -73,6 +74,7 @@ const J40Footer = () => {
|
|||
className={'footer-link-first-child'}
|
||||
key={'contactlink'}
|
||||
dataCy={hyphenizeString(COMMON_COPY.FOOTER.GITHUB_LINK_TEXT.defaultMessage)}
|
||||
tag={intl.formatMessage(ABOUT_COPY.GET_INVOLVED.JOIN_OSC_LINK_TAG)}
|
||||
/>,
|
||||
],
|
||||
];
|
||||
|
|
|
@ -138,6 +138,13 @@ exports[`J40Footer renders correctly 1`] = `
|
|||
>
|
||||
Check out the code on GitHub
|
||||
</a>
|
||||
|
||||
<span
|
||||
class="usa-tag "
|
||||
data-testid="tag"
|
||||
>
|
||||
New Location
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
@use '../../styles/design-system.scss' as *;
|
||||
|
||||
.tag {
|
||||
font-weight: bolder;
|
||||
line-height: 2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.primary {
|
||||
@include u-bg('primary-dark');
|
||||
@include u-text('white');
|
||||
}
|
||||
|
||||
.secondary {
|
||||
@include u-bg('gray-cool-10');
|
||||
@include u-text('ink');
|
||||
}
|
||||
|
||||
.accent {
|
||||
@include u-bg('yellow-20v');
|
||||
@include u-text('blue-70v');
|
||||
}
|
4
client/src/components/LinkTypeWrapper/LinkTypeWrapper.module.scss.d.ts
vendored
Normal file
4
client/src/components/LinkTypeWrapper/LinkTypeWrapper.module.scss.d.ts
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
export const tag: string;
|
||||
export const primary: string;
|
||||
export const secondary: string;
|
||||
export const accent: string;
|
|
@ -1,16 +1,22 @@
|
|||
import React from 'react';
|
||||
import {Tag, Link as TrussLink} from '@trussworks/react-uswds';
|
||||
import {Link, useIntl} from 'gatsby-plugin-intl';
|
||||
import {Link as TrussLink} from '@trussworks/react-uswds';
|
||||
import React from 'react';
|
||||
|
||||
import {IDefineMessage} from '../../data/copy/common';
|
||||
import * as styles from './LinkTypeWrapper.module.scss';
|
||||
|
||||
export type TagVariant = 'primary' | 'secondary' | 'accent';
|
||||
|
||||
export interface ILinkTypeWrapper {
|
||||
[x: string]: any;
|
||||
linkText?: string | JSX.Element;
|
||||
internal?: boolean;
|
||||
url: string | IDefineMessage;
|
||||
openUrlNewTab?: boolean;
|
||||
className?: string;
|
||||
dataCy?: string;
|
||||
tag?: string;
|
||||
tagVariant?: TagVariant;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line valid-jsdoc
|
||||
|
@ -32,41 +38,52 @@ export interface ILinkTypeWrapper {
|
|||
*/
|
||||
const LinkTypeWrapper = (props:ILinkTypeWrapper) => {
|
||||
const intl = useIntl();
|
||||
let {url} = props;
|
||||
const {url} = props;
|
||||
const formattedUrl = url && typeof url !== 'string' ? intl.formatMessage(url) : url;
|
||||
|
||||
if (url && typeof url !== `string`) {
|
||||
url = intl.formatMessage(url);
|
||||
}
|
||||
|
||||
if (props.internal) {
|
||||
return (
|
||||
<Link
|
||||
to={`${url}`}
|
||||
className={props.className ? `usa-link ${props.className}` : `usa-link`}
|
||||
const link = props.internal ? (
|
||||
<Link
|
||||
to={`${formattedUrl}`}
|
||||
className={props.className ? `usa-link ${props.className}` : `usa-link`}
|
||||
>
|
||||
{props.linkText}
|
||||
</Link>
|
||||
) : (
|
||||
props.openUrlNewTab ? (
|
||||
<TrussLink
|
||||
variant={'external'}
|
||||
className={props.className}
|
||||
href={`${formattedUrl}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
data-cy={props.dataCy ? props.dataCy : ''}
|
||||
>
|
||||
{props.linkText}
|
||||
</Link>
|
||||
);
|
||||
} else {
|
||||
return props.openUrlNewTab ?
|
||||
<TrussLink
|
||||
variant={'external'}
|
||||
className={props.className}
|
||||
href={`${url}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
data-cy={props.dataCy ? props.dataCy : ''}
|
||||
>
|
||||
{props.linkText}
|
||||
</TrussLink> :
|
||||
<a
|
||||
className={props.className}
|
||||
href={url}
|
||||
data-cy={props.dataCy? props.dataCy : ''}
|
||||
>
|
||||
{props.linkText}
|
||||
</a>;
|
||||
}
|
||||
</TrussLink>
|
||||
) : (
|
||||
<a
|
||||
className={props.className}
|
||||
href={formattedUrl}
|
||||
data-cy={props.dataCy ? props.dataCy : ''}
|
||||
>
|
||||
{props.linkText}
|
||||
</a>
|
||||
)
|
||||
);
|
||||
|
||||
const tag = props.tag ? (
|
||||
<Tag className={[styles.tag, styles[props.tagVariant || 'accent']].join(' ')}>
|
||||
{props.tag}
|
||||
</Tag>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{link}
|
||||
{props.tag && '\u2003'}
|
||||
{tag}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default LinkTypeWrapper;
|
||||
|
|
|
@ -1,18 +1,36 @@
|
|||
import {act, render} from '@testing-library/react';
|
||||
import * as React from 'react';
|
||||
import {render} from '@testing-library/react';
|
||||
import {LocalizedComponent} from '../../test/testHelpers';
|
||||
import MapSearch from './MapSearch';
|
||||
|
||||
describe('rendering of the MapSearch', () => {
|
||||
const mockGoToPlace = jest.fn((x) => x);
|
||||
|
||||
const {asFragment} = render(
|
||||
<LocalizedComponent>
|
||||
<MapSearch goToPlace={mockGoToPlace}/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
// mock fetch as it doesn't exist in test environment
|
||||
beforeEach(() => {
|
||||
global.fetch = jest.fn(() =>
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
json: () => Promise.resolve([]),
|
||||
}),
|
||||
) as jest.Mock;
|
||||
});
|
||||
|
||||
it('checks if component renders', () => {
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
// clean up the mock
|
||||
afterEach(() => {
|
||||
(global.fetch as jest.Mock).mockClear();
|
||||
delete (global as any).fetch;
|
||||
});
|
||||
|
||||
it('checks if component renders', async () => {
|
||||
const renderResult = render(
|
||||
<LocalizedComponent>
|
||||
<MapSearch goToPlace={mockGoToPlace}/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
await act(async () => {
|
||||
// Wait for useEffect and fetch to complete
|
||||
});
|
||||
expect(renderResult.asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
@use '../../styles/design-system.scss' as *;
|
||||
|
||||
.prioCopyPara2{
|
||||
@include u-padding-top(2);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import {render, screen} from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import {LocalizedComponent} from '../../test/testHelpers';
|
||||
import PrioritizationCopy from './PrioritizationCopy';
|
||||
|
||||
|
@ -13,6 +13,8 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK: null,
|
||||
tribalCountUS: null,
|
||||
percentTractTribal: null,
|
||||
isIslandLowIncome: false,
|
||||
isGrandfathered: false,
|
||||
// eslint-disable-next-line max-len
|
||||
para1: `This tract is not considered disadvantaged. It does not meet any burden thresholds `,
|
||||
},
|
||||
|
@ -24,6 +26,8 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK: null,
|
||||
tribalCountUS: null,
|
||||
percentTractTribal: null,
|
||||
isIslandLowIncome: false,
|
||||
isGrandfathered: false,
|
||||
// eslint-disable-next-line max-len
|
||||
para1: `This tract is not considered disadvantaged. It meets 1 burden threshold`,
|
||||
},
|
||||
|
@ -35,6 +39,8 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK: null,
|
||||
tribalCountUS: null,
|
||||
percentTractTribal: null,
|
||||
isIslandLowIncome: false,
|
||||
isGrandfathered: false,
|
||||
// eslint-disable-next-line max-len
|
||||
para1: `This tract is not considered disadvantaged. It meets more than 1 burden threshold `,
|
||||
},
|
||||
|
@ -46,6 +52,8 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK: null,
|
||||
tribalCountUS: null,
|
||||
percentTractTribal: null,
|
||||
isIslandLowIncome: false,
|
||||
isGrandfathered: false,
|
||||
// eslint-disable-next-line max-len
|
||||
para1: `This tract is considered disadvantaged because it meets 1 burden threshold `,
|
||||
},
|
||||
|
@ -57,212 +65,11 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK: null,
|
||||
tribalCountUS: null,
|
||||
percentTractTribal: null,
|
||||
isIslandLowIncome: false,
|
||||
isGrandfathered: false,
|
||||
// eslint-disable-next-line max-len
|
||||
para1: `This tract is considered disadvantaged because it meets more than 1 burden threshold `,
|
||||
},
|
||||
|
||||
// {
|
||||
// isDonut: false, percentTribal: 0,
|
||||
// totalCategories: 0, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The less than 1% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: 0,
|
||||
// totalCategories: 0, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The less than 1% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The less than 1% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The less than 1% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The less than 1% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 0, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 0, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 0, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 1, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 1, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: false, percentTribal: .31,
|
||||
// totalCategories: 1, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `The 31% of this tract that are Federally-Recognized Tribal lands are considered disadvantaged.`,
|
||||
// },
|
||||
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 0, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 0, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 0, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 1, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 1, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: null,
|
||||
// totalCategories: 1, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// },
|
||||
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 0, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 0, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 0, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: 0,
|
||||
// totalCategories: 1, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The less than 1% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 0, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 0, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 0, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 1, totalIndicators: 0,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 1, totalIndicators: 1,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
// {
|
||||
// isDonut: true, percentTribal: .29,
|
||||
// totalCategories: 2, totalIndicators: 2,
|
||||
// eslint-disable-next-line max-len
|
||||
// para1: `This tract is considered disadvantaged because it is surrounded by tracts that are disadvantaged AND meets an adjusted low income threshold.`,
|
||||
// eslint-disable-next-line max-len
|
||||
// para2: `The 29% of this tract that are Federally-Recognized Tribal lands are also considered disadvantaged.`,
|
||||
// },
|
||||
];
|
||||
|
||||
testCases.forEach((testCase) => {
|
||||
|
@ -278,15 +85,14 @@ describe('rendering of PrioritizationCopy Component -', () => {
|
|||
tribalCountAK={testCase.tribalCountAK}
|
||||
tribalCountUS={null}
|
||||
percentTractTribal={testCase.percentTractTribal}
|
||||
|
||||
isIslandLowIncome={testCase.isIslandLowIncome}
|
||||
isGrandfathered={testCase.isGrandfathered}
|
||||
/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
|
||||
screen.getByText((content, element) => {
|
||||
return element?.tagName.toLowerCase() === 'div' && content.startsWith(testCase.para1);
|
||||
});
|
||||
screen.getByText((content) => content.startsWith(testCase.para1));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import React from 'react';
|
||||
|
||||
// import * as styles from './PrioritizationCopy.module.scss';
|
||||
|
||||
import * as EXPLORE_COPY from '../../data/copy/explore';
|
||||
|
||||
interface IPrioritizationCopy {
|
||||
|
@ -45,7 +43,7 @@ const PrioritizationCopy =
|
|||
tribalCountUS,
|
||||
percentTractTribal,
|
||||
}:IPrioritizationCopy) => {
|
||||
let prioCopyRendered;
|
||||
let prioCopyRendered = null;
|
||||
|
||||
if (isGrandfathered) {
|
||||
prioCopyRendered = EXPLORE_COPY.PRIORITIZATION_COPY.PRIO_GRANDFATHERED_LI;
|
||||
|
@ -130,21 +128,14 @@ const PrioritizationCopy =
|
|||
// if 2
|
||||
} else if (totalCategoriesPrioritized > 0) {
|
||||
if (totalBurdensPrioritized === 0) {
|
||||
prioCopyRendered = <></>;
|
||||
} else if (totalBurdensPrioritized === 1) {
|
||||
prioCopyRendered = EXPLORE_COPY.getPrioNBurdenCopy(`1`);
|
||||
} else if (totalBurdensPrioritized > 1) {
|
||||
prioCopyRendered = EXPLORE_COPY.getPrioNBurdenCopy(`more than 1`);
|
||||
}
|
||||
} else {
|
||||
prioCopyRendered = <></>;
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{prioCopyRendered}
|
||||
</div>
|
||||
);
|
||||
return prioCopyRendered && <p>{prioCopyRendered}</p>;
|
||||
};
|
||||
|
||||
export default PrioritizationCopy;
|
||||
|
|
|
@ -2,60 +2,60 @@
|
|||
|
||||
exports[`rendering of PrioritizationCopy Component - checks if component renders This tract is considered disadvantaged because it meets 1 burden threshold when totCats = 2, totBurds = 1, isAdj = false, isAdjLI = false, tribal % = null, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<p>
|
||||
This tract is considered disadvantaged because it meets 1 burden threshold
|
||||
<strong>
|
||||
AND
|
||||
</strong>
|
||||
the associated socioeconomic threshold.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`rendering of PrioritizationCopy Component - checks if component renders This tract is considered disadvantaged because it meets more than 1 burden threshold when totCats = 2, totBurds = 5, isAdj = false, isAdjLI = false, tribal % = null, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<p>
|
||||
This tract is considered disadvantaged because it meets more than 1 burden threshold
|
||||
<strong>
|
||||
AND
|
||||
</strong>
|
||||
the associated socioeconomic threshold.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`rendering of PrioritizationCopy Component - checks if component renders This tract is not considered disadvantaged. It does not meet any burden thresholds when totCats = 0, totBurds = 0, isAdj = false, isAdjLI = false, tribal % = null, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<p>
|
||||
This tract is not considered disadvantaged. It does not meet any burden thresholds
|
||||
<strong>
|
||||
OR
|
||||
</strong>
|
||||
at least one associated socioeconomic threshold.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`rendering of PrioritizationCopy Component - checks if component renders This tract is not considered disadvantaged. It meets 1 burden threshold when totCats = 0, totBurds = 1, isAdj = false, isAdjLI = false, tribal % = null, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<p>
|
||||
This tract is not considered disadvantaged. It meets 1 burden threshold
|
||||
<strong>
|
||||
BUT
|
||||
</strong>
|
||||
no associated socioeconomic thresholds.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`rendering of PrioritizationCopy Component - checks if component renders This tract is not considered disadvantaged. It meets more than 1 burden threshold when totCats = 0, totBurds = 5, isAdj = false, isAdjLI = false, tribal % = null, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<p>
|
||||
This tract is not considered disadvantaged. It meets more than 1 burden threshold
|
||||
<strong>
|
||||
BUT
|
||||
</strong>
|
||||
no associated socioeconomic thresholds.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
@use '../../styles/design-system.scss' as *;
|
||||
|
||||
.prioritizationCopy2Container{
|
||||
@include u-padding-top(2);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import {render, screen} from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import {LocalizedComponent} from '../../test/testHelpers';
|
||||
import PrioritizationCopy2 from './PrioritizationCopy2';
|
||||
|
||||
|
@ -48,9 +48,7 @@ describe('rendering of PrioritizationCopy2 Component', () => {
|
|||
);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
|
||||
screen.getByText((content, element) => {
|
||||
return element?.tagName.toLowerCase() === 'div' && content.startsWith(testCase.para1);
|
||||
});
|
||||
screen.getByText((content) => content.startsWith(testCase.para1));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import React from 'react';
|
||||
|
||||
import * as styles from './PrioritizationCopy2.module.scss';
|
||||
|
||||
import * as EXPLORE_COPY from '../../data/copy/explore';
|
||||
|
||||
interface IPrioritizationCopy2 {
|
||||
|
@ -40,8 +38,7 @@ const PrioritizationCopy2 =
|
|||
tribalCountUS,
|
||||
percentTractTribal,
|
||||
}:IPrioritizationCopy2) => {
|
||||
let prioCopy2Rendered = <></>;
|
||||
|
||||
let prioCopy2Rendered = null;
|
||||
|
||||
// if 1
|
||||
if (
|
||||
|
@ -165,13 +162,9 @@ const PrioritizationCopy2 =
|
|||
(tribalCountAK !== null && tribalCountAK >= 1)
|
||||
) {
|
||||
prioCopy2Rendered = EXPLORE_COPY.getPrioANVCopy(tribalCountAK, false);
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={prioCopy2Rendered !== <></> ? '' : styles.prioritizationCopy2Container}>
|
||||
{prioCopy2Rendered}
|
||||
</div>
|
||||
);
|
||||
return prioCopy2Rendered && <p>{prioCopy2Rendered}</p>;
|
||||
};
|
||||
|
||||
export default PrioritizationCopy2;
|
||||
|
|
|
@ -2,20 +2,16 @@
|
|||
|
||||
exports[`rendering of PrioritizationCopy2 Component checks if component renders The lands of Federally Recognized Tribes that cover 2% of this tract are also considered disadvantaged. when totCats = 0, totBurds = 0, isAdj = true, isAdjLI = true, tribal % = 2, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class=""
|
||||
>
|
||||
<p>
|
||||
The lands of Federally Recognized Tribes that cover 2% of this tract are also considered disadvantaged.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
||||
exports[`rendering of PrioritizationCopy2 Component checks if component renders The lands of Federally Recognized Tribes that cover 4% of this tract are also considered disadvantaged. when totCats = 0, totBurds = 1, isAdj = true, isAdjLI = true, tribal % = 4, 1`] = `
|
||||
<DocumentFragment>
|
||||
<div
|
||||
class=""
|
||||
>
|
||||
<p>
|
||||
The lands of Federally Recognized Tribes that cover 4% of this tract are also considered disadvantaged.
|
||||
</div>
|
||||
</p>
|
||||
</DocumentFragment>
|
||||
`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue