From ae110772cf43b6c2ca38cbee694392f761080465 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Tue, 15 Jan 2019 14:31:44 +0000 Subject: [PATCH] MDL-63977 Behat: Fix bug in 'near' calculation --- app_behat_runtime.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app_behat_runtime.js b/app_behat_runtime.js index 354786e75..b07b53e63 100644 --- a/app_behat_runtime.js +++ b/app_behat_runtime.js @@ -306,8 +306,9 @@ var calculateNearDepth = function(node) { var depth = 0; while (node) { - if (nearAncestors.indexOf(node) !== -1) { - return depth; + var ancestorDepth = nearAncestors.indexOf(node); + if (ancestorDepth !== -1) { + return depth + ancestorDepth; } node = node.parentNode; depth++;