Skip to content

Commit

Permalink
Added related nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
lpelypenko committed Dec 24, 2020
1 parent 916fe0f commit c8e8b4f
Show file tree
Hide file tree
Showing 11 changed files with 809 additions and 2 deletions.
56 changes: 56 additions & 0 deletions artifacts/accessibilityReport.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions artifacts/tcInapplicablePresent.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions artifacts/tcIncludingCustomSummary.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions artifacts/tcPassesAndViolations.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions artifacts/tsAllOptionalParametersPresent.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions artifacts/urlIsNotPassed.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/util/AxeReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface NodeResult {
targetNodes: string;
fixSummaries: FixSummary[];
index: number;
relatedNodesAny: string[]
}

interface Details {
Expand Down
20 changes: 18 additions & 2 deletions src/util/prepareReportData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,32 @@ export function prepareReportData({
description,
help,
helpUrl,
nodes: nodes.map(({ target, html, failureSummary }, nodeIndex) => {
nodes: nodes.map(({ target, html, failureSummary, any }, nodeIndex) => {
const targetNodes = target.join('\n');
const defaultHighlight = {
highlight: 'Recommendation with the fix was not provided by axe result',
};
const fixSummaries: FixSummary[] = failureSummary
? prepareFixSummary(failureSummary, defaultHighlight)
: [defaultHighlight];
const relatedNodesAny: string[] = [];
any.forEach((checkResult) => {
if (checkResult.relatedNodes && checkResult.relatedNodes.length > 0) {
checkResult.relatedNodes.forEach((node) => {
if (node.target.length > 0) {
relatedNodesAny.push(node.target.join('\n'));
}
});
}
});

return { targetNodes, html, fixSummaries, index: nodeIndex + 1 };
return {
targetNodes,
html,
fixSummaries,
relatedNodesAny,
index: nodeIndex + 1,
};
}),
};
}
Expand Down
6 changes: 6 additions & 0 deletions src/util/template/pageTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ <h6 class="card-subtitle mb-2 text-muted violationCardTitleItem">
</ul>
</div>
{{/fixSummaries}}
{{#relatedNodesAny.length}}
<p><strong>Related node(s):</strong></p>
{{/relatedNodesAny.length}}
{{#relatedNodesAny}}
<pre><code class="css">{{.}}</code></pre>
{{/relatedNodesAny}}
</td>
</tr>
{{/nodes}}
Expand Down
56 changes: 56 additions & 0 deletions temp/tcPassesViolationsIncomplete.html

Large diffs are not rendered by default.

392 changes: 392 additions & 0 deletions test/__snapshots__/index.test.ts.snap

Large diffs are not rendered by default.

0 comments on commit c8e8b4f

Please sign in to comment.