MOBILE-3320 behat: Remove modern JS

main
Noel De Martin 2021-07-06 18:59:54 +02:00
parent d614cf426d
commit d02da246b5
1 changed files with 4 additions and 3 deletions

View File

@ -296,7 +296,8 @@
} }
const labelledBy = currentNode.getAttribute('aria-labelledby'); const labelledBy = currentNode.getAttribute('aria-labelledby');
if (labelledBy && container.querySelector(`#${labelledBy}`)?.innerText?.includes(text)) { const labelElement = labelledBy && container.querySelector(`#${labelledBy}`);
if (labelElement && labelElement.innerText && labelElement.innerText.includes(text)) {
elements.push(currentNode); elements.push(currentNode);
continue; continue;
@ -361,7 +362,7 @@
* @return {HTMLElement} Parent element. * @return {HTMLElement} Parent element.
*/ */
var getParentElement = function(element) { var getParentElement = function(element) {
return element.parentElement ?? element.getRootNode()?.host ?? null; return element.parentElement || (element.getRootNode() && element.getRootNode().host) || null;
}; };
/** /**
@ -438,7 +439,7 @@
// may not work without doing this. // may not work without doing this.
const parentElement = getParentElement(element); const parentElement = getParentElement(element);
if (parentElement?.matches('ion-button, ion-back-button')) { if (parentElement && parentElement.matches('ion-button, ion-back-button')) {
element = parentElement; element = parentElement;
} }