Skip to content

Commit 67ca706

Browse files
committed
MOBILE-3320 behat: Remove modern JS
1 parent a353b45 commit 67ca706

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/behat/app_behat_runtime.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@
296296
}
297297

298298
const labelledBy = currentNode.getAttribute('aria-labelledby');
299-
if (labelledBy && container.querySelector(`#${labelledBy}`)?.innerText?.includes(text)) {
299+
const labelElement = labelledBy && container.querySelector(`#${labelledBy}`);
300+
if (labelElement && labelElement.innerText && labelElement.innerText.includes(text)) {
300301
elements.push(currentNode);
301302

302303
continue;
@@ -361,7 +362,7 @@
361362
* @return {HTMLElement} Parent element.
362363
*/
363364
var getParentElement = function(element) {
364-
return element.parentElement ?? element.getRootNode()?.host ?? null;
365+
return element.parentElement || (element.getRootNode() && element.getRootNode().host) || null;
365366
};
366367

367368
/**
@@ -438,7 +439,7 @@
438439
// may not work without doing this.
439440
const parentElement = getParentElement(element);
440441

441-
if (parentElement?.matches('ion-button, ion-back-button')) {
442+
if (parentElement && parentElement.matches('ion-button, ion-back-button')) {
442443
element = parentElement;
443444
}
444445

0 commit comments

Comments
 (0)