Use even more optional chaining in the code-base
This commit is contained in:
parent
f528f6f07b
commit
155a302e74
@ -244,7 +244,7 @@ class XfaLayer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child.children && child.children.length > 0) {
|
if (child.children?.length > 0) {
|
||||||
stack.push([child, -1, childHtml]);
|
stack.push([child, -1, childHtml]);
|
||||||
} else if (child.value) {
|
} else if (child.value) {
|
||||||
const node = document.createTextNode(child.value);
|
const node = document.createTextNode(child.value);
|
||||||
|
@ -460,7 +460,7 @@ function checkEq(task, results, browser, masterMode) {
|
|||||||
}
|
}
|
||||||
const pageResult = pageResults[page];
|
const pageResult = pageResults[page];
|
||||||
let testSnapshot = pageResult.snapshot;
|
let testSnapshot = pageResult.snapshot;
|
||||||
if (testSnapshot && testSnapshot.startsWith("data:image/png;base64,")) {
|
if (testSnapshot?.startsWith("data:image/png;base64,")) {
|
||||||
testSnapshot = Buffer.from(testSnapshot.substring(22), "base64");
|
testSnapshot = Buffer.from(testSnapshot.substring(22), "base64");
|
||||||
} else {
|
} else {
|
||||||
console.error("Valid snapshot was not found.");
|
console.error("Valid snapshot was not found.");
|
||||||
@ -759,7 +759,7 @@ function refTestPostHandler(req, res) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var isDone = taskResults.at(-1) && taskResults.at(-1)[lastPageNum - 1];
|
var isDone = taskResults.at(-1)?.[lastPageNum - 1];
|
||||||
if (isDone) {
|
if (isDone) {
|
||||||
checkRefTestResults(browser, id, taskResults);
|
checkRefTestResults(browser, id, taskResults);
|
||||||
session.remaining--;
|
session.remaining--;
|
||||||
|
@ -20,7 +20,7 @@ describe("XFAFactory", function () {
|
|||||||
function searchHtmlNode(root, name, value, byAttributes = false, nth = [0]) {
|
function searchHtmlNode(root, name, value, byAttributes = false, nth = [0]) {
|
||||||
if (
|
if (
|
||||||
(!byAttributes && root[name] === value) ||
|
(!byAttributes && root[name] === value) ||
|
||||||
(byAttributes && root.attributes && root.attributes[name] === value)
|
(byAttributes && root.attributes?.[name] === value)
|
||||||
) {
|
) {
|
||||||
if (nth[0]-- === 0) {
|
if (nth[0]-- === 0) {
|
||||||
return root;
|
return root;
|
||||||
|
Loading…
Reference in New Issue
Block a user