Skip to content

Commit

Permalink
update Page Template
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocio De Santiago authored and Rocio De Santiago committed Aug 28, 2024
1 parent 92103f3 commit 5b07464
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 8 additions & 8 deletions services/ui-src/src/components/layout/PageTemplate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ import { PageTemplate } from "components";
import { testA11y } from "utils/testing/commonTests";

const standardPageComponent = (
<PageTemplate data-testid="page-template">
<p>Test text</p>
<PageTemplate type="standard">
<p>Standard Test Text</p>
</PageTemplate>
);

const reportPageComponent = (
<PageTemplate type="standard" data-testid="page-template">
<p>Test text</p>
<PageTemplate type="report">
<p>Report Test Text</p>
</PageTemplate>
);

describe("<PageTemplate />", () => {
describe("standard", () => {
test("Check that PageTemplate (standard) renders", () => {
const { getByTestId } = render(standardPageComponent);
expect(getByTestId("page-template")).toBeVisible();
const { getByText } = render(standardPageComponent);
expect(getByText("Standard Test Text")).toBeVisible();
});

testA11y(standardPageComponent);
});

describe("report", () => {
test("Check that PageTemplate (report) renders", () => {
const { getByTestId } = render(reportPageComponent);
expect(getByTestId("page-template")).toBeVisible();
const { getByText } = render(reportPageComponent);
expect(getByText("Report Test Text")).toBeVisible();
});

testA11y(reportPageComponent);
Expand Down
4 changes: 1 addition & 3 deletions services/ui-src/src/components/layout/PageTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ export const PageTemplate = ({
type = "standard",
children,
sxOverride,
...props
}: Props) => {
return (
<section>
<Box sx={{ ...sx.contentBox, ...sxOverride }} className={type} {...props}>
<Box sx={{ ...sx.contentBox, ...sxOverride }} className={type}>
<Flex sx={sx.contentFlex} className={`contentFlex ${type}`}>
{children}
</Flex>
Expand All @@ -22,7 +21,6 @@ interface Props {
type?: "standard" | "report";
children: React.ReactNode;
sxOverride?: any;
[key: string]: any;
}

const sx = {
Expand Down

0 comments on commit 5b07464

Please sign in to comment.