@@ -1274,26 +1274,6 @@ describe('parser', function() {
1274
1274
expect ( log . empty ( ) ) . toEqual ( [ ] ) ;
1275
1275
} ) ) ;
1276
1276
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
-
1297
1277
it ( 'should only become stable when all the elements of an array have defined values' , inject ( function ( $parse , $rootScope , log ) {
1298
1278
var fn = $parse ( '::[foo,bar]' ) ;
1299
1279
$rootScope . $watch ( fn , function ( value ) { log ( value ) ; } , true ) ;
@@ -1324,7 +1304,9 @@ describe('parser', function() {
1324
1304
} ) ;
1325
1305
} ) ;
1326
1306
1307
+
1327
1308
describe ( 'watched $parse expressions' , function ( ) {
1309
+
1328
1310
it ( 'should respect short-circuiting AND if it could have side effects' , function ( ) {
1329
1311
var bCalled = 0 ;
1330
1312
scope . b = function ( ) { bCalled ++ ; }
@@ -1340,6 +1322,7 @@ describe('parser', function() {
1340
1322
scope . $digest ( ) ;
1341
1323
expect ( bCalled ) . toBe ( 2 ) ;
1342
1324
} ) ;
1325
+
1343
1326
it ( 'should respect short-circuiting OR if it could have side effects' , function ( ) {
1344
1327
var bCalled = false ;
1345
1328
scope . b = function ( ) { bCalled = true ; }
@@ -1353,6 +1336,7 @@ describe('parser', function() {
1353
1336
scope . $digest ( ) ;
1354
1337
expect ( bCalled ) . toBe ( false ) ;
1355
1338
} ) ;
1339
+
1356
1340
it ( 'should respect the branching ternary operator if it could have side effects' , function ( ) {
1357
1341
var bCalled = false ;
1358
1342
scope . b = function ( ) { bCalled = true ; }
@@ -1365,6 +1349,7 @@ describe('parser', function() {
1365
1349
scope . $digest ( ) ;
1366
1350
expect ( bCalled ) . toBe ( true ) ;
1367
1351
} ) ;
1352
+
1368
1353
it ( 'should not invoke filters unless the input/arguments change' , function ( ) {
1369
1354
var filterCalled = false ;
1370
1355
$filterProvider . register ( 'foo' , valueFn ( function ( input ) {
@@ -1385,6 +1370,7 @@ describe('parser', function() {
1385
1370
scope . $digest ( ) ;
1386
1371
expect ( filterCalled ) . toBe ( true ) ;
1387
1372
} ) ;
1373
+
1388
1374
it ( 'should invoke filters if they are marked as having externalInput' , function ( ) {
1389
1375
var filterCalled = false ;
1390
1376
$filterProvider . register ( 'foo' , valueFn ( extend ( function ( input ) {
@@ -1401,6 +1387,7 @@ describe('parser', function() {
1401
1387
scope . $digest ( ) ;
1402
1388
expect ( filterCalled ) . toBe ( true ) ;
1403
1389
} ) ;
1390
+
1404
1391
it ( 'should not invoke interceptorFns unless the input changes' , inject ( function ( $parse ) {
1405
1392
var called = false ;
1406
1393
function interceptor ( v ) {
@@ -1420,6 +1407,7 @@ describe('parser', function() {
1420
1407
scope . $digest ( ) ;
1421
1408
expect ( called ) . toBe ( true ) ;
1422
1409
} ) ) ;
1410
+
1423
1411
it ( 'should invoke interceptorFns if the yare marked as having externalInput' , inject ( function ( $parse ) {
1424
1412
var called = false ;
1425
1413
function interceptor ( ) {
@@ -1441,7 +1429,8 @@ describe('parser', function() {
1441
1429
scope . $digest ( ) ;
1442
1430
expect ( called ) . toBe ( true ) ;
1443
1431
} ) ) ;
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 ) {
1445
1434
var filterCalls = 0 ;
1446
1435
$filterProvider . register ( 'foo' , valueFn ( function ( input ) {
1447
1436
filterCalls ++ ;
@@ -1450,7 +1439,7 @@ describe('parser', function() {
1450
1439
1451
1440
var parsed = $parse ( '{x: 1} | foo:1' ) ;
1452
1441
1453
- expect ( parsed . constant ) . toBe ( true ) ;
1442
+ expect ( parsed . constant ) . toBe ( true ) ;
1454
1443
1455
1444
var watcherCalls = 0 ;
1456
1445
scope . $watch ( parsed , function ( input ) {
@@ -1466,9 +1455,6 @@ describe('parser', function() {
1466
1455
expect ( filterCalls ) . toBe ( 1 ) ;
1467
1456
expect ( watcherCalls ) . toBe ( 1 ) ;
1468
1457
} ) ) ;
1469
- it ( 'should not treat constants passed to filters with externalInput as constants' , inject ( function ( $parse ) {
1470
-
1471
- } ) ) ;
1472
1458
} ) ;
1473
1459
1474
1460
describe ( 'locals' , function ( ) {
0 commit comments