Skip to content

Commit

Permalink
fix: fixing code style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
forsti0506 committed Apr 20, 2021
1 parent 702398c commit d6ad6be
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
13 changes: 7 additions & 6 deletions lib/utils/make-sreenshots-with-errors-borderd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ export async function makeScreenshotsWithErrorsBorderd(
if (dom.tagName === 'A') {
dom.setAttribute('style', dom.getAttribute('style').replace('border: 1px solid red;', ''));
} else if (dom.tagName === 'HTML') {
document.body.setAttribute(
'style',
document.body
.getAttribute('style')!
.replace('outline-style: solid; outline-color: red', ''),
);
const bodyStyle = document.body.getAttribute('style');
if (bodyStyle) {
document.body.setAttribute(
'style',
bodyStyle.replace('outline-style: solid; outline-color: red', ''),
);
}
} else {
dom.setAttribute(
'style',
Expand Down
32 changes: 18 additions & 14 deletions lib/utils/mark-all-tabable-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export async function markAllTabableItems(
} else {
element.setAttribute('style', 'outline-style: solid; outline-color: red');
}
}
};
const elementsFromEvaluationParsed: ElementsFromEvaluation = JSON.parse(
elementsFromEvaluationInput,
);
Expand Down Expand Up @@ -160,9 +160,11 @@ export async function markAllTabableItems(
if (elementVisible) {
await doIt(elementRect, tabbingNumber);
if (!standardTags.includes(element.tagName.toUpperCase())) {
document.getElementById('span_id' + tabbingNumber)!.innerHTML =
document.getElementById('span_id' + tabbingNumber)?.innerHTML + 'C';
elementsFromEvaluationParsed.focusableNonStandardElements.push(element.id);
const spanElement = document.getElementById('span_id' + tabbingNumber);
if (spanElement) {
spanElement.innerHTML = spanElement.innerHTML + 'C';
elementsFromEvaluationParsed.focusableNonStandardElements.push(element.id);
}
}
tabbingNumber++;
}
Expand Down Expand Up @@ -216,12 +218,13 @@ export async function markAllTabableItems(
document.querySelectorAll('[style="outline-style: solid; outline-color: red"]'),
);
for (const oldElement of oldElementsWithBorder) {
oldElement.setAttribute(
'style',
oldElement
.getAttribute('style')!
.replace('outline-style: solid; outline-color: red', ''),
);
const oldElementStyle = oldElement.getAttribute('style');
if (oldElementStyle) {
oldElement.setAttribute(
'style',
oldElementStyle.replace('outline-style: solid; outline-color: red', ''),
);
}
}
}
if (elementVisible) {
Expand All @@ -230,10 +233,11 @@ export async function markAllTabableItems(
await doIt(elementRect, tabbingNumber);
elementSelector.visible = true;
if (!standardTags.includes(element.tagName.toUpperCase())) {
console.log(tabbingNumber);
document.getElementById('span_id' + tabbingNumber)!.innerHTML =
document.getElementById('span_id' + tabbingNumber)?.innerHTML + 'C';
// elementsFromEvaluationParsed.focusableNonStandardElements.push(element.id);
const spanElement = document.getElementById('span_id' + tabbingNumber);
if (spanElement) {
spanElement.innerHTML = spanElement.innerHTML + 'C';
elementsFromEvaluationParsed.focusableNonStandardElements.push(element.id);
}
}
tabbingNumber++;
} else if (!elementVisible && !firstVisibleElement) {
Expand Down

0 comments on commit d6ad6be

Please sign in to comment.