Skip to content

Commit

Permalink
10339: Update data test ids for accordion
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Rogers committed Sep 17, 2024
1 parent c5092f2 commit 150f0d4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Dashboard - Petitioner Accessibility', () => {

it('should be free of a11y issues when viewing payment options', () => {
loginAsPetitioner();
cy.get('.payment-options').click();
cy.get('[data-testid="other-options"]').click();
cy.get('a.usa-link--external').should('exist');

checkA11y();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ describe('File a petition: Intro', () => {
cy.get('[data-testid="deadline-to-file"]').contains(
'If you received a notice in the mail from the IRS',
);
cy.get('[data-testid="accordion-item-title"]').contains(
cy.get('[data-testid="are-you-filing-jointly-with-a-spouse"]').contains(
'Are you filing jointly with a spouse?',
);

cy.get('[data-testid="accordion-item-title"]').eq(0).click();
cy.get('[data-testid="are-you-filing-jointly-with-a-spouse"]')
.eq(0)
.click();
cy.get('[data-testid="filing-jointly-accordion-item"]').contains(
"To file a joint Petition with your spouse, you must have the spouse's consent",
);
Expand Down Expand Up @@ -118,9 +120,9 @@ describe('File a petition: Intro', () => {
cy.get('[data-testid="deadline-to-file"]').contains(
'If the petitioner received a notice in the mail from the IRS',
);
cy.get('[data-testid="accordion-item-title"]')
.contains('Is the petitioner filing jointly with a spouse?')
.should('not.exist');
cy.get('[data-testid="are-you-filing-jointly-with-a-spouse"]').should(
'not.exist',
);
});
});
});
Expand Down
10 changes: 0 additions & 10 deletions web-client/src/styles/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,6 @@ p {
margin-top: 10px;
}

.payment-options {
.usa-accordion__button {
padding: 3px;
font-family: $font-source-sans;
font-size: 17px;
font-weight: normal;
}
}

.other-filing-option {
.usa-accordion__button {
padding: 3px;
Expand All @@ -364,7 +355,6 @@ p {
padding-top: 20px;
border-top: 1px solid #dfe1e2;
margin-bottom: 15px;

}

.usa-alert__text:only-child {
Expand Down
6 changes: 6 additions & 0 deletions web-client/src/ustc-ui/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import classNames from 'classnames';
export const Accordion = ({
children,
className,
dataTestId,
...props
}: {
children: ReactNode;
dataTestId?: string;
className?: string;
} & HTMLAttributes<HTMLDivElement>) => {
return (
Expand All @@ -18,6 +20,7 @@ export const Accordion = ({
'usa-accordion',
'usa-accordion--multiselectable',
)}
data-testid={dataTestId}
{...props}
>
{children}
Expand All @@ -28,10 +31,12 @@ export const Accordion = ({
export const AccordionItem = ({
children,
contentClassName,
dataTestId,
headerClassName,
initiallyOpen = false,
title,
}: {
dataTestId?: string;
initiallyOpen?: boolean;
headerClassName?: string;
contentClassName?: string;
Expand All @@ -52,6 +57,7 @@ export const AccordionItem = ({
'accordion-title',
headerClassName,
)}
data-testid={dataTestId}
onClick={() => {
setIsOpen(!isOpen);
}}
Expand Down
15 changes: 11 additions & 4 deletions web-client/src/views/BeforeStartingCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const BeforeStartingCase = connect(
{isPetitioner ? 'your' : 'the'} case may be dismissed.
</div>
</div>
<CaseInfoAccordion isPetitioner={isPetitioner} />
<BeforeStartingCaseAccordion isPetitioner={isPetitioner} />
<Button
className="before-case-button"
data-testid="go-to-step-1"
Expand Down Expand Up @@ -252,12 +252,19 @@ export const BeforeStartingCase = connect(

BeforeStartingCase.displayName = 'BeforeStartingCase';

function CaseInfoAccordion({ isPetitioner }: { isPetitioner: boolean }) {
function BeforeStartingCaseAccordion({
isPetitioner,
}: {
isPetitioner: boolean;
}) {
return (
<div className="grid-row grid-gap">
<Accordion>
<Accordion dataTestId="before-starting-case-accordion">
{isPetitioner && (
<AccordionItem title="Are you filing jointly with a spouse?">
<AccordionItem
dataTestId="are-you-filing-jointly-with-a-spouse"
title="Are you filing jointly with a spouse?"
>
<div data-testid="filing-jointly-accordion-item">
{
"To file a joint Petition with your spouse, you must have the spouse's consent. If you do not have your spouse's consent, select “Myself” as the person who is filing."
Expand Down
1 change: 1 addition & 0 deletions web-client/src/views/Dashboards/FilingFeeOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const FilingFeeOptions = function () {
<Accordion>
<AccordionItem
contentClassName="bg-gray padding-x-0"
dataTestId="other-options"
headerClassName="padding-0"
title="Other options"
>
Expand Down

0 comments on commit 150f0d4

Please sign in to comment.