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

Commit 187e0e2

Browse files
committed
fix(parser): Fix short circuit of logical AND and OR operators
Closes #433
1 parent 21b2a5b commit 187e0e2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/ParserSpec.js

+16
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,22 @@ describe('parser', function() {
399399
expect(scope.obj[0].name).toEqual(1);
400400
});
401401

402+
it('should short circuit AND operator', function(){
403+
var scope = angular.scope();
404+
scope.run = function(){
405+
throw "IT SHOULD NOT HAVE RUN";
406+
};
407+
expect(scope.$eval('false && run()')).toBe(false);
408+
});
409+
410+
it('should short circuit OR operator', function(){
411+
var scope = angular.scope();
412+
scope.run = function(){
413+
throw "IT SHOULD NOT HAVE RUN";
414+
};
415+
expect(scope.$eval('true || run()')).toBe(true);
416+
});
417+
402418
describe('formatter', function(){
403419
it('should return no argument function', function() {
404420
var noop = parser('noop').formatter()();

0 commit comments

Comments
 (0)