Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh Chaudhary committed Aug 2, 2024
1 parent 2e22663 commit 0b2e1ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/core/public/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ function runCommand(data, keepalive, callback) {
//a11y-engine iframe rules error merging logic
const errors = a11yEngine.getErrors();
if (Object.keys(errors).length !== 0) {
if (results[results.length - 1].errorsObj) {
if (results[results.length - 1].a11yEngineErrors) {
const error = results.pop();
delete error.errorsObj;
delete error.a11yEngineErrors;
const mergedErrors = mergeErrors(error, errors);
results.push({ ...mergedErrors, errorsObj: true });
results.push({ ...mergedErrors, a11yEngineErrors: true });
} else {
results.push({ ...errors, errorsObj: true });
results.push({ ...errors, a11yEngineErrors: true });
}
}
a11yEngine.clearErrors();
Expand Down
4 changes: 2 additions & 2 deletions lib/core/public/run-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export default function runRules(context, options, resolve, reject) {
// after should only run once, so ensure we are in the top level window
if (context.initiator) {
// Return a11y-engine errors when at top level window
if (results[results.length - 1].errorsObj) {
if (results[results.length - 1].a11yEngineErrors) {
const error = results.pop();
delete error.errorsObj;
delete error.a11yEngineErrors;
a11yEngine.mergeErrors(error);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/core/utils/merge-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ function mergeResults(frameResults, options) {
}

const frameSpec = getFrameSpec(frameResult);
if (results[results.length - 1].errorsObj) {
if (results[results.length - 1].a11yEngineErrors) {
const error = results.pop();
delete error.errorsObj;
delete error.a11yEngineErrors;
mergedErrors = mergeErrors(mergedErrors, error, frameSpec);
}

Expand Down Expand Up @@ -118,7 +118,7 @@ function mergeResults(frameResults, options) {
if (Object.keys(mergedErrors).length === 0) {
return mergedResult;
}
return [...mergedResult, { ...mergedErrors, errorsObj: true }];
return [...mergedResult, { ...mergedErrors, a11yEngineErrors: true }];
}

function nodeIndexSort(nodeIndexesA = [], nodeIndexesB = []) {
Expand Down

0 comments on commit 0b2e1ff

Please sign in to comment.