Skip to content

Commit

Permalink
Benefits Finder project page (#1067)
Browse files Browse the repository at this point in the history
* create Benefits Finder page, article page, rewrites

* create BF project page and articles queries

* create simple unit and integration test and mockdata

* add default top margin to h3 in FragmentRender

* add ContextualAlert to BF page

* change homepage card order

* update BN mock data

* place ContextualAlert beneath heading

* update h3 to h2 to fix a11y heading order
  • Loading branch information
will0684 authored Jul 10, 2024
1 parent 5d611b4 commit 7066985
Show file tree
Hide file tree
Showing 15 changed files with 2,577 additions and 256 deletions.
807 changes: 807 additions & 0 deletions __mocks__/benefits-finder.mockdata.js

Large diffs are not rendered by default.

353 changes: 217 additions & 136 deletions __mocks__/mockStore.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions __tests__/pages/benefits-finder.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { render } from "@testing-library/react";
import BenefitsFinderOverview from "../../pages/projects/benefits-finder/index";
import {
dictionaryData,
experimentsData,
benefitsNavigatorUpdatesData,
} from "../../__mocks__/mockStore";
import { benefitsFinderMock } from "../../__mocks__/benefits-finder.mockdata.js";

describe("Benefits Finder", () => {
it("renders without crashing", () => {
render(
<BenefitsFinderOverview
pageData={benefitsFinderMock.data.sclabsPageV1ByPath}
updatesData={benefitsNavigatorUpdatesData}
dictionary={dictionaryData.data.dictionaryV1List}
allProjects={experimentsData.data.scLabsPagev1List.items}
/>
);
});
});
8 changes: 5 additions & 3 deletions components/molecules/ContextualAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ export function ContextualAlert(props) {
className={`overflow-auto border-l-6 ${alert_color} pl-[24px] py-[17px] leading-8`}
>
{asHtml ? (
<h3
className="leading-heading3 ml-1"
<h2
className="mt-0 text-h3 leading-heading3 ml-1"
dangerouslySetInnerHTML={{ __html: message_heading }}
/>
) : (
<h3 className="leading-heading3 ml-1">{message_heading}</h3>
<h2 className="mt-0 text-h3 leading-heading3 ml-1">
{message_heading}
</h2>
)}
{asHtml ? (
<div
Expand Down
2 changes: 1 addition & 1 deletion components/text_node_renderer/nodes/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Header(props) {
<h2 className={props.index === 0 ? "mt-0" : ""}>{props.children}</h2>
);
case "h3":
return <h3>{props.children}</h3>;
return <h3 className="mt-12">{props.children}</h3>;
case "h4":
return <h4>{props.children}</h4>;
case "h5":
Expand Down
16 changes: 16 additions & 0 deletions cypress/e2e/benefits-finder.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
describe("Home Page", () => {
beforeEach(() => {
cy.visit("/en/projects/benefits-finder");
cy.injectAxe();
});

it("has no a11y violations", () => {
cy.checkA11y();
});

it("loads page",()=>{
cy.url().should('equal',Cypress.config().baseUrl+'/en/projects/benefits-finder')
cy.get('button.info').click()
cy.get('h2.modal-title').should('have.text','Beta')
})
});
2 changes: 1 addition & 1 deletion cypress/e2e/benefits-navigator.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("Home Page", () => {
cy.get('h2.modal-title').should('have.text','Alpha')
})

it("navigates to a project page", () => {
it("navigates to an article page", () => {
cy.get("a[href*=difficulties-community]").click();
cy.url().should(
"equal",
Expand Down
Loading

0 comments on commit 7066985

Please sign in to comment.