@@ -420,6 +420,7 @@ describe('input', function() {
420
420
formElm = jqLite ( '<form name="form"></form>' ) ;
421
421
formElm . append ( inputElm ) ;
422
422
$compile ( formElm ) ( scope ) ;
423
+ scope . $digest ( ) ;
423
424
}
424
425
425
426
beforeEach ( inject ( function ( $injector , _$sniffer_ , _$browser_ ) {
@@ -915,7 +916,6 @@ describe('input', function() {
915
916
compileInput (
916
917
'<input type="text" ng-model="name" name="alias" ' +
917
918
'ng-model-options="{ updateOn: \'blur\' }" />' ) ;
918
- scope . $digest ( ) ;
919
919
920
920
changeInputValueTo ( 'a' ) ;
921
921
expect ( inputElm . val ( ) ) . toBe ( 'a' ) ;
@@ -929,7 +929,6 @@ describe('input', function() {
929
929
compileInput (
930
930
'<input type="text" ng-model="name" name="alias" ' +
931
931
'ng-model-options="{ debounce: 2000 }" />' ) ;
932
- scope . $digest ( ) ;
933
932
934
933
changeInputValueTo ( 'a' ) ;
935
934
expect ( inputElm . val ( ) ) . toBe ( 'a' ) ;
@@ -965,7 +964,6 @@ describe('input', function() {
965
964
it ( 'should report error on assignment error' , function ( ) {
966
965
expect ( function ( ) {
967
966
compileInput ( '<input type="text" ng-model="throw \'\'">' ) ;
968
- scope . $digest ( ) ;
969
967
} ) . toThrowMinErr ( "$parse" , "syntax" , "Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at ['']." ) ;
970
968
} ) ;
971
969
@@ -996,7 +994,6 @@ describe('input', function() {
996
994
997
995
it ( 'should validate in-lined pattern' , function ( ) {
998
996
compileInput ( '<input type="text" ng-model="value" ng-pattern="/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/" />' ) ;
999
- scope . $digest ( ) ;
1000
997
1001
998
changeInputValueTo ( 'x000-00-0000x' ) ;
1002
999
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1017,7 +1014,6 @@ describe('input', function() {
1017
1014
1018
1015
it ( 'should validate in-lined pattern with modifiers' , function ( ) {
1019
1016
compileInput ( '<input type="text" ng-model="value" ng-pattern="/^abc?$/i" />' ) ;
1020
- scope . $digest ( ) ;
1021
1017
1022
1018
changeInputValueTo ( 'aB' ) ;
1023
1019
expect ( inputElm ) . toBeValid ( ) ;
@@ -1028,9 +1024,8 @@ describe('input', function() {
1028
1024
1029
1025
1030
1026
it ( 'should validate pattern from scope' , function ( ) {
1031
- compileInput ( '<input type="text" ng-model="value" ng-pattern="regexp" />' ) ;
1032
1027
scope . regexp = / ^ \d \d \d - \d \d - \d \d \d \d $ / ;
1033
- scope . $digest ( ) ;
1028
+ compileInput ( '<input type="text" ng-model="value" ng-pattern="regexp" />' ) ;
1034
1029
1035
1030
changeInputValueTo ( 'x000-00-0000x' ) ;
1036
1031
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1153,7 +1148,6 @@ describe('input', function() {
1153
1148
it ( 'should come up blank when no value specified' , function ( ) {
1154
1149
compileInput ( '<input type="month" ng-model="test" />' ) ;
1155
1150
1156
- scope . $digest ( ) ;
1157
1151
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1158
1152
1159
1153
scope . $apply ( function ( ) {
@@ -1181,7 +1175,6 @@ describe('input', function() {
1181
1175
describe ( 'min' , function ( ) {
1182
1176
beforeEach ( function ( ) {
1183
1177
compileInput ( '<input type="month" ng-model="value" name="alias" min="2013-01" />' ) ;
1184
- scope . $digest ( ) ;
1185
1178
} ) ;
1186
1179
1187
1180
it ( 'should invalidate' , function ( ) {
@@ -1202,7 +1195,6 @@ describe('input', function() {
1202
1195
describe ( 'max' , function ( ) {
1203
1196
beforeEach ( function ( ) {
1204
1197
compileInput ( '<input type="month" ng-model="value" name="alias" max="2013-01" />' ) ;
1205
- scope . $digest ( ) ;
1206
1198
} ) ;
1207
1199
1208
1200
it ( 'should validate' , function ( ) {
@@ -1279,7 +1271,6 @@ describe('input', function() {
1279
1271
it ( 'should come up blank when no value specified' , function ( ) {
1280
1272
compileInput ( '<input type="week" ng-model="test" />' ) ;
1281
1273
1282
- scope . $digest ( ) ;
1283
1274
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1284
1275
1285
1276
scope . $apply ( function ( ) {
@@ -1306,7 +1297,6 @@ describe('input', function() {
1306
1297
describe ( 'min' , function ( ) {
1307
1298
beforeEach ( function ( ) {
1308
1299
compileInput ( '<input type="week" ng-model="value" name="alias" min="2013-W01" />' ) ;
1309
- scope . $digest ( ) ;
1310
1300
} ) ;
1311
1301
1312
1302
it ( 'should invalidate' , function ( ) {
@@ -1327,7 +1317,6 @@ describe('input', function() {
1327
1317
describe ( 'max' , function ( ) {
1328
1318
beforeEach ( function ( ) {
1329
1319
compileInput ( '<input type="week" ng-model="value" name="alias" max="2013-W01" />' ) ;
1330
- scope . $digest ( ) ;
1331
1320
} ) ;
1332
1321
1333
1322
it ( 'should validate' , function ( ) {
@@ -1403,7 +1392,6 @@ describe('input', function() {
1403
1392
it ( 'should come up blank when no value specified' , function ( ) {
1404
1393
compileInput ( '<input type="datetime-local" ng-model="test" />' ) ;
1405
1394
1406
- scope . $digest ( ) ;
1407
1395
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1408
1396
1409
1397
scope . $apply ( function ( ) {
@@ -1430,7 +1418,6 @@ describe('input', function() {
1430
1418
describe ( 'min' , function ( ) {
1431
1419
beforeEach ( function ( ) {
1432
1420
compileInput ( '<input type="datetime-local" ng-model="value" name="alias" min="2000-01-01T12:30" />' ) ;
1433
- scope . $digest ( ) ;
1434
1421
} ) ;
1435
1422
1436
1423
it ( 'should invalidate' , function ( ) {
@@ -1451,7 +1438,6 @@ describe('input', function() {
1451
1438
describe ( 'max' , function ( ) {
1452
1439
beforeEach ( function ( ) {
1453
1440
compileInput ( '<input type="datetime-local" ng-model="value" name="alias" max="2019-01-01T01:02" />' ) ;
1454
- scope . $digest ( ) ;
1455
1441
} ) ;
1456
1442
1457
1443
it ( 'should invalidate' , function ( ) {
@@ -1472,7 +1458,6 @@ describe('input', function() {
1472
1458
it ( 'should validate even if max value changes on-the-fly' , function ( done ) {
1473
1459
scope . max = '2013-01-01T01:02' ;
1474
1460
compileInput ( '<input type="datetime-local" ng-model="value" name="alias" max="{{max}}" />' ) ;
1475
- scope . $digest ( ) ;
1476
1461
1477
1462
changeInputValueTo ( '2014-01-01T12:34' ) ;
1478
1463
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1487,7 +1472,6 @@ describe('input', function() {
1487
1472
it ( 'should validate even if min value changes on-the-fly' , function ( done ) {
1488
1473
scope . min = '2013-01-01T01:02' ;
1489
1474
compileInput ( '<input type="datetime-local" ng-model="value" name="alias" min="{{min}}" />' ) ;
1490
- scope . $digest ( ) ;
1491
1475
1492
1476
changeInputValueTo ( '2010-01-01T12:34' ) ;
1493
1477
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1557,7 +1541,6 @@ describe('input', function() {
1557
1541
it ( 'should come up blank when no value specified' , function ( ) {
1558
1542
compileInput ( '<input type="time" ng-model="test" />' ) ;
1559
1543
1560
- scope . $digest ( ) ;
1561
1544
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1562
1545
1563
1546
scope . $apply ( function ( ) {
@@ -1584,7 +1567,6 @@ describe('input', function() {
1584
1567
describe ( 'min' , function ( ) {
1585
1568
beforeEach ( function ( ) {
1586
1569
compileInput ( '<input type="time" ng-model="value" name="alias" min="09:30" />' ) ;
1587
- scope . $digest ( ) ;
1588
1570
} ) ;
1589
1571
1590
1572
it ( 'should invalidate' , function ( ) {
@@ -1605,7 +1587,6 @@ describe('input', function() {
1605
1587
describe ( 'max' , function ( ) {
1606
1588
beforeEach ( function ( ) {
1607
1589
compileInput ( '<input type="time" ng-model="value" name="alias" max="22:30" />' ) ;
1608
- scope . $digest ( ) ;
1609
1590
} ) ;
1610
1591
1611
1592
it ( 'should invalidate' , function ( ) {
@@ -1626,7 +1607,6 @@ describe('input', function() {
1626
1607
it ( 'should validate even if max value changes on-the-fly' , function ( done ) {
1627
1608
scope . max = '21:02' ;
1628
1609
compileInput ( '<input type="time" ng-model="value" name="alias" max="{{max}}" />' ) ;
1629
- scope . $digest ( ) ;
1630
1610
1631
1611
changeInputValueTo ( '22:34' ) ;
1632
1612
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1641,7 +1621,6 @@ describe('input', function() {
1641
1621
it ( 'should validate even if min value changes on-the-fly' , function ( done ) {
1642
1622
scope . min = '08:45' ;
1643
1623
compileInput ( '<input type="time" ng-model="value" name="alias" min="{{min}}" />' ) ;
1644
- scope . $digest ( ) ;
1645
1624
1646
1625
changeInputValueTo ( '06:15' ) ;
1647
1626
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1711,7 +1690,6 @@ describe('input', function() {
1711
1690
it ( 'should come up blank when no value specified' , function ( ) {
1712
1691
compileInput ( '<input type="date" ng-model="test" />' ) ;
1713
1692
1714
- scope . $digest ( ) ;
1715
1693
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1716
1694
1717
1695
scope . $apply ( function ( ) {
@@ -1738,7 +1716,6 @@ describe('input', function() {
1738
1716
describe ( 'min' , function ( ) {
1739
1717
beforeEach ( function ( ) {
1740
1718
compileInput ( '<input type="date" ng-model="value" name="alias" min="2000-01-01" />' ) ;
1741
- scope . $digest ( ) ;
1742
1719
} ) ;
1743
1720
1744
1721
it ( 'should invalidate' , function ( ) {
@@ -1759,7 +1736,6 @@ describe('input', function() {
1759
1736
describe ( 'max' , function ( ) {
1760
1737
beforeEach ( function ( ) {
1761
1738
compileInput ( '<input type="date" ng-model="value" name="alias" max="2019-01-01" />' ) ;
1762
- scope . $digest ( ) ;
1763
1739
} ) ;
1764
1740
1765
1741
it ( 'should invalidate' , function ( ) {
@@ -1780,7 +1756,6 @@ describe('input', function() {
1780
1756
it ( 'should validate even if max value changes on-the-fly' , function ( done ) {
1781
1757
scope . max = '2013-01-01' ;
1782
1758
compileInput ( '<input type="date" ng-model="value" name="alias" max="{{max}}" />' ) ;
1783
- scope . $digest ( ) ;
1784
1759
1785
1760
changeInputValueTo ( '2014-01-01' ) ;
1786
1761
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1795,7 +1770,6 @@ describe('input', function() {
1795
1770
it ( 'should validate even if min value changes on-the-fly' , function ( done ) {
1796
1771
scope . min = '2013-01-01' ;
1797
1772
compileInput ( '<input type="date" ng-model="value" name="alias" min="{{min}}" />' ) ;
1798
- scope . $digest ( ) ;
1799
1773
1800
1774
changeInputValueTo ( '2010-01-01' ) ;
1801
1775
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1846,7 +1820,6 @@ describe('input', function() {
1846
1820
it ( 'should come up blank when no value specified' , function ( ) {
1847
1821
compileInput ( '<input type="number" ng-model="age" />' ) ;
1848
1822
1849
- scope . $digest ( ) ;
1850
1823
expect ( inputElm . val ( ) ) . toBe ( '' ) ;
1851
1824
1852
1825
scope . $apply ( function ( ) {
@@ -1875,7 +1848,6 @@ describe('input', function() {
1875
1848
1876
1849
it ( 'should validate' , function ( ) {
1877
1850
compileInput ( '<input type="number" ng-model="value" name="alias" min="10" />' ) ;
1878
- scope . $digest ( ) ;
1879
1851
1880
1852
changeInputValueTo ( '1' ) ;
1881
1853
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1891,7 +1863,6 @@ describe('input', function() {
1891
1863
it ( 'should validate even if min value changes on-the-fly' , function ( done ) {
1892
1864
scope . min = 10 ;
1893
1865
compileInput ( '<input type="number" ng-model="value" name="alias" min="{{min}}" />' ) ;
1894
- scope . $digest ( ) ;
1895
1866
1896
1867
changeInputValueTo ( '5' ) ;
1897
1868
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1909,7 +1880,6 @@ describe('input', function() {
1909
1880
1910
1881
it ( 'should validate' , function ( ) {
1911
1882
compileInput ( '<input type="number" ng-model="value" name="alias" max="10" />' ) ;
1912
- scope . $digest ( ) ;
1913
1883
1914
1884
changeInputValueTo ( '20' ) ;
1915
1885
expect ( inputElm ) . toBeInvalid ( ) ;
@@ -1925,7 +1895,6 @@ describe('input', function() {
1925
1895
it ( 'should validate even if max value changes on-the-fly' , function ( done ) {
1926
1896
scope . max = 10 ;
1927
1897
compileInput ( '<input type="number" ng-model="value" name="alias" max="{{max}}" />' ) ;
1928
- scope . $digest ( ) ;
1929
1898
1930
1899
changeInputValueTo ( '5' ) ;
1931
1900
expect ( inputElm ) . toBeValid ( ) ;
@@ -2352,7 +2321,6 @@ describe('input', function() {
2352
2321
2353
2322
it ( 'should set $invalid when model undefined' , function ( ) {
2354
2323
compileInput ( '<input type="text" ng-model="notDefined" required />' ) ;
2355
- scope . $digest ( ) ;
2356
2324
expect ( inputElm ) . toBeInvalid ( ) ;
2357
2325
} ) ;
2358
2326
@@ -2406,7 +2374,6 @@ describe('input', function() {
2406
2374
compileInput ( '<input type="checkbox" ng-model="foo" ng-change="changeFn()">' ) ;
2407
2375
2408
2376
scope . changeFn = jasmine . createSpy ( 'changeFn' ) ;
2409
- scope . $digest ( ) ;
2410
2377
expect ( scope . changeFn ) . not . toHaveBeenCalled ( ) ;
2411
2378
2412
2379
browserTrigger ( inputElm , 'click' ) ;
@@ -2433,7 +2400,6 @@ describe('input', function() {
2433
2400
compileInput ( '<input type="radio" ng-model="selected" ng-value="true">' +
2434
2401
'<input type="radio" ng-model="selected" ng-value="false">' +
2435
2402
'<input type="radio" ng-model="selected" ng-value="1">' ) ;
2436
- scope . $digest ( ) ;
2437
2403
2438
2404
browserTrigger ( inputElm [ 0 ] , 'click' ) ;
2439
2405
expect ( scope . selected ) . toBe ( true ) ;
0 commit comments