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

Commit 6bc090d

Browse files
committed
WIP: fix tests
1 parent 5db809e commit 6bc090d

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

test/ng/parseSpec.js

+11-25
Original file line numberDiff line numberDiff line change
@@ -1274,26 +1274,6 @@ describe('parser', function() {
12741274
expect(log.empty()).toEqual([]);
12751275
}));
12761276

1277-
it('should calculate the literal every single time', inject(function($parse) {
1278-
var filterCalls = 0;
1279-
$filterProvider.register('foo', valueFn(function(input) {
1280-
filterCalls++;
1281-
return input;
1282-
}));
1283-
1284-
var watcherCalls = 0;
1285-
scope.$watch($parse('{x: 1} | foo'), function(input) {
1286-
expect(input).toEqual({x:1});
1287-
watcherCalls++;
1288-
});
1289-
scope.$digest();
1290-
expect(filterCalls).toBe(1);
1291-
expect(watcherCalls).toBe(1);
1292-
scope.$digest();
1293-
expect(filterCalls).toBe(1);
1294-
expect(watcherCalls).toBe(1);
1295-
}));
1296-
12971277
it('should only become stable when all the elements of an array have defined values', inject(function ($parse, $rootScope, log){
12981278
var fn = $parse('::[foo,bar]');
12991279
$rootScope.$watch(fn, function(value) { log(value); }, true);
@@ -1324,7 +1304,9 @@ describe('parser', function() {
13241304
});
13251305
});
13261306

1307+
13271308
describe('watched $parse expressions', function() {
1309+
13281310
it('should respect short-circuiting AND if it could have side effects', function() {
13291311
var bCalled = 0;
13301312
scope.b = function() { bCalled++; }
@@ -1340,6 +1322,7 @@ describe('parser', function() {
13401322
scope.$digest();
13411323
expect(bCalled).toBe(2);
13421324
});
1325+
13431326
it('should respect short-circuiting OR if it could have side effects', function() {
13441327
var bCalled = false;
13451328
scope.b = function() { bCalled = true; }
@@ -1353,6 +1336,7 @@ describe('parser', function() {
13531336
scope.$digest();
13541337
expect(bCalled).toBe(false);
13551338
});
1339+
13561340
it('should respect the branching ternary operator if it could have side effects', function() {
13571341
var bCalled = false;
13581342
scope.b = function() { bCalled = true; }
@@ -1365,6 +1349,7 @@ describe('parser', function() {
13651349
scope.$digest();
13661350
expect(bCalled).toBe(true);
13671351
});
1352+
13681353
it('should not invoke filters unless the input/arguments change', function() {
13691354
var filterCalled = false;
13701355
$filterProvider.register('foo', valueFn(function(input) {
@@ -1385,6 +1370,7 @@ describe('parser', function() {
13851370
scope.$digest();
13861371
expect(filterCalled).toBe(true);
13871372
});
1373+
13881374
it('should invoke filters if they are marked as having externalInput', function() {
13891375
var filterCalled = false;
13901376
$filterProvider.register('foo', valueFn(extend(function(input) {
@@ -1401,6 +1387,7 @@ describe('parser', function() {
14011387
scope.$digest();
14021388
expect(filterCalled).toBe(true);
14031389
});
1390+
14041391
it('should not invoke interceptorFns unless the input changes', inject(function($parse) {
14051392
var called = false;
14061393
function interceptor(v) {
@@ -1420,6 +1407,7 @@ describe('parser', function() {
14201407
scope.$digest();
14211408
expect(called).toBe(true);
14221409
}));
1410+
14231411
it('should invoke interceptorFns if the yare marked as having externalInput', inject(function($parse) {
14241412
var called = false;
14251413
function interceptor() {
@@ -1441,7 +1429,8 @@ describe('parser', function() {
14411429
scope.$digest();
14421430
expect(called).toBe(true);
14431431
}));
1444-
it('should treat constants inputted to filters as constants', inject(function($parse) {
1432+
1433+
it('should treat filters with constant input as constants', inject(function($parse) {
14451434
var filterCalls = 0;
14461435
$filterProvider.register('foo', valueFn(function(input) {
14471436
filterCalls++;
@@ -1450,7 +1439,7 @@ describe('parser', function() {
14501439

14511440
var parsed = $parse('{x: 1} | foo:1');
14521441

1453-
expect( parsed.constant ).toBe(true);
1442+
expect(parsed.constant).toBe(true);
14541443

14551444
var watcherCalls = 0;
14561445
scope.$watch(parsed, function(input) {
@@ -1466,9 +1455,6 @@ describe('parser', function() {
14661455
expect(filterCalls).toBe(1);
14671456
expect(watcherCalls).toBe(1);
14681457
}));
1469-
it('should not treat constants passed to filters with externalInput as constants', inject(function($parse) {
1470-
1471-
}));
14721458
});
14731459

14741460
describe('locals', function() {

0 commit comments

Comments
 (0)