Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Descriptive Headings to Test Instructions and Criteria #379

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions client/components/TestRenderer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ const TestRenderer = ({
});
};

const InstructionsContent = () => {
const InstructionsContent = ({ labelIdRef }) => {
const allInstructions = [
...pageContent.instructions.instructions.instructions,
...pageContent.instructions.instructions.strongInstructions,
Expand All @@ -473,17 +473,25 @@ const TestRenderer = ({
const commandsContent = parseListContent(commands);
const content = parseListContent(allInstructions, commandsContent);

return <NumberedList>{content}</NumberedList>;
return (
<NumberedList aria-labelledby={labelIdRef}>{content}</NumberedList>
);
};

const AssertionsContent = () => {
InstructionsContent.propTypes = { labelIdRef: PropTypes.string };

const AssertionsContent = ({ labelIdRef }) => {
const assertions = [...pageContent.instructions.assertions.assertions];

const content = parseListContent(assertions);

return <NumberedList>{content}</NumberedList>;
return (
<NumberedList aria-labelledby={labelIdRef}>{content}</NumberedList>
);
};

AssertionsContent.propTypes = { labelIdRef: PropTypes.string };

const parseLinebreakOutput = (output = []) => {
return output.map(item => {
if (typeof item === 'string')
Expand Down Expand Up @@ -615,17 +623,17 @@ const TestRenderer = ({
{pageContent.instructions.header.header}
</HeadingText>
<Text>{pageContent.instructions.description}</Text>
<SubHeadingText>
<SubHeadingText id="instruction-list-heading">
{pageContent.instructions.instructions.header}
</SubHeadingText>
<InstructionsContent />
<SubHeadingText>
<InstructionsContent labelIdRef="instruction-list-heading" />
<SubHeadingText id="success-criteria-list-heading">
{pageContent.instructions.assertions.header}
</SubHeadingText>
<Text>
{pageContent.instructions.assertions.description}
</Text>
<AssertionsContent />
<AssertionsContent labelIdRef="success-criteria-list-heading" />
<Button
disabled={
!pageContent.instructions.openTestPage.enabled
Expand Down