From bdef02129e1d28b24503800ce2653417d480f14e Mon Sep 17 00:00:00 2001 From: Kevin Phillips Date: Fri, 1 Jun 2018 15:05:22 -0500 Subject: [PATCH] not including notContext scopes in correct paths (fixes #166) --- can-view-scope.js | 10 ++++++---- test/scope-test.js | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/can-view-scope.js b/can-view-scope.js index 717de1d..09710f7 100644 --- a/can-view-scope.js +++ b/can-view-scope.js @@ -446,11 +446,13 @@ assign(Scope.prototype, { // `notContext` and `special` contexts can't be read using `../` var canBeRead = !scope._meta.special && !scope._meta.notContext; - if (canBeRead && typeof scope._context === "object" && canReflect.hasKey(scope._context, normalizedKey)) { - paths[cur + normalizedKey] = scope._context; - } + if (canBeRead) { + if (typeof scope._context === "object" && canReflect.hasKey(scope._context, normalizedKey)) { + paths[cur + normalizedKey] = scope._context; + } - cur += "../"; + cur += "../"; + } // walk entire scope tree return false; diff --git a/test/scope-test.js b/test/scope-test.js index 6cc0568..3ca9eae 100644 --- a/test/scope-test.js +++ b/test/scope-test.js @@ -1305,8 +1305,8 @@ QUnit.test("scope.getPathsForKey", function() { "scope.vm.name": vm, "scope.top.name": top, "name": nonVm, - "../../../name": vm, - "../../../../../name": top + "../../name": vm, + "../../../name": top }); });