Skip to content

Commit 0d9ae93

Browse files
committed
Scope test fixes
1 parent 9291750 commit 0d9ae93

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/scope/scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,8 @@ export class Scope {
800800
keySet.push(prop.value.name);
801801
listener.property.push(key);
802802
} else {
803-
key =
804-
get.decoratedNode.body[0].expression.toWatch[0].property.name;
803+
const target = get.decoratedNode.body[0].expression.toWatch[0];
804+
key = target.property ? target.property.name : target.name;
805805
listener.property.push(key);
806806
}
807807
}

src/core/scope/scope.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,23 +2056,23 @@ describe("Scope", () => {
20562056
expect(scope.a).toEqual(1);
20572057

20582058
scope.$eval((self) => {
2059-
self.b = 2;
2059+
self.$proxy.b = 2;
20602060
});
20612061
expect(scope.b).toEqual(2);
20622062
});
20632063

20642064
it("executes $eval'ed function and returns result", function () {
20652065
scope.aValue = 42;
20662066
const result = scope.$eval(function (scope) {
2067-
return scope.aValue;
2067+
return scope.$proxy.aValue;
20682068
});
20692069
expect(result).toBe(42);
20702070
});
20712071

20722072
it("passes the second $eval argument straight through", function () {
20732073
scope.aValue = 42;
20742074
const result = scope.$eval(function (scope, arg) {
2075-
return scope.aValue + arg;
2075+
return scope.$proxy.aValue + arg;
20762076
}, 2);
20772077
expect(result).toBe(44);
20782078
});
@@ -2082,7 +2082,7 @@ describe("Scope", () => {
20822082

20832083
scope.$eval(
20842084
(scope, locals) => {
2085-
scope.c = locals.b + 4;
2085+
scope.$proxy.c = locals.b + 4;
20862086
},
20872087
{ b: 3 },
20882088
);

0 commit comments

Comments
 (0)