Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit dc5a43a

Browse files
committed
Test for Object.create(null) parsing added. Special thanks to Julian Mayorga who provided the test case!
1 parent a0fd098 commit dc5a43a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/ng/parseSpec.js

+26
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,32 @@ describe('parser', function() {
14601460
expect(watcherCalls).toBe(1);
14611461
}));
14621462

1463+
it("should always reevaluate filters with non-primitive input created with Object.create(null)",
1464+
inject(function($parse) {
1465+
var filterCalls = 0;
1466+
$filterProvider.register('foo', valueFn(function(input) {
1467+
filterCalls++;
1468+
return input;
1469+
}));
1470+
1471+
var parsed = $parse('obj | foo');
1472+
var obj = scope.obj = Object.create(null);
1473+
1474+
var watcherCalls = 0;
1475+
scope.$watch(parsed, function(input) {
1476+
expect(input).toBe(obj);
1477+
watcherCalls++;
1478+
});
1479+
1480+
scope.$digest();
1481+
expect(filterCalls).toBe(2);
1482+
expect(watcherCalls).toBe(1);
1483+
1484+
scope.$digest();
1485+
expect(filterCalls).toBe(3);
1486+
expect(watcherCalls).toBe(1);
1487+
}));
1488+
14631489
it("should not reevaluate filters with non-primitive input that does support valueOf()",
14641490
inject(function($parse) {
14651491
var filterCalls = 0;

0 commit comments

Comments
 (0)