@@ -628,17 +628,22 @@ describe('input', function() {
628
628
} ) ;
629
629
630
630
631
- it ( 'should use any timezone if specified in the options' , function ( ) {
632
- var inputElm = helper . compileInput ( '<input type="month" ng-model="value" ng-model-options="{timezone: \'+0500\'}" />' ) ;
631
+ they ( 'should use any timezone if specified in the options (format: $prop)' ,
632
+ { '+HHmm' : '+0500' , '+HH:mm' : '+05:00' } ,
633
+ function ( tz ) {
634
+ var ngModelOptions = "{timezone: '" + tz + "'}" ;
635
+ var inputElm = helper . compileInput (
636
+ '<input type="month" ng-model="value" ng-model-options="' + ngModelOptions + '" />' ) ;
633
637
634
- helper . changeInputValueTo ( '2013-07' ) ;
635
- expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2013 , 5 , 30 , 19 , 0 , 0 ) ) ;
638
+ helper . changeInputValueTo ( '2013-07' ) ;
639
+ expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2013 , 5 , 30 , 19 , 0 , 0 ) ) ;
636
640
637
- $rootScope . $apply ( function ( ) {
638
- $rootScope . value = new Date ( Date . UTC ( 2014 , 5 , 30 , 19 , 0 , 0 ) ) ;
639
- } ) ;
640
- expect ( inputElm . val ( ) ) . toBe ( '2014-07' ) ;
641
- } ) ;
641
+ $rootScope . $apply ( function ( ) {
642
+ $rootScope . value = new Date ( Date . UTC ( 2014 , 5 , 30 , 19 , 0 , 0 ) ) ;
643
+ } ) ;
644
+ expect ( inputElm . val ( ) ) . toBe ( '2014-07' ) ;
645
+ }
646
+ ) ;
642
647
643
648
644
649
it ( 'should label parse errors as `month`' , function ( ) {
@@ -865,17 +870,22 @@ describe('input', function() {
865
870
} ) ;
866
871
867
872
868
- it ( 'should use any timezone if specified in the options' , function ( ) {
869
- var inputElm = helper . compileInput ( '<input type="week" ng-model="value" ng-model-options="{timezone: \'+0500\'}" />' ) ;
873
+ they ( 'should use any timezone if specified in the options (format: $prop)' ,
874
+ { '+HHmm' : '+0500' , '+HH:mm' : '+05:00' } ,
875
+ function ( tz ) {
876
+ var ngModelOptions = "{timezone: '" + tz + "'}" ;
877
+ var inputElm = helper . compileInput (
878
+ '<input type="week" ng-model="value" ng-model-options="' + ngModelOptions + '" />' ) ;
870
879
871
- helper . changeInputValueTo ( '2013-W03' ) ;
872
- expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2013 , 0 , 16 , 19 , 0 , 0 ) ) ;
880
+ helper . changeInputValueTo ( '2013-W03' ) ;
881
+ expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2013 , 0 , 16 , 19 , 0 , 0 ) ) ;
873
882
874
- $rootScope . $apply ( function ( ) {
875
- $rootScope . value = new Date ( Date . UTC ( 2014 , 0 , 16 , 19 , 0 , 0 ) ) ;
876
- } ) ;
877
- expect ( inputElm . val ( ) ) . toBe ( '2014-W03' ) ;
878
- } ) ;
883
+ $rootScope . $apply ( function ( ) {
884
+ $rootScope . value = new Date ( Date . UTC ( 2014 , 0 , 16 , 19 , 0 , 0 ) ) ;
885
+ } ) ;
886
+ expect ( inputElm . val ( ) ) . toBe ( '2014-W03' ) ;
887
+ }
888
+ ) ;
879
889
880
890
881
891
it ( 'should label parse errors as `week`' , function ( ) {
@@ -1066,17 +1076,22 @@ describe('input', function() {
1066
1076
} ) ;
1067
1077
1068
1078
1069
- it ( 'should use any timezone if specified in the options' , function ( ) {
1070
- var inputElm = helper . compileInput ( '<input type="datetime-local" ng-model="value" ng-model-options="{timezone: \'+0500\'}" />' ) ;
1079
+ they ( 'should use any timezone if specified in the options (format: $prop)' ,
1080
+ { '+HHmm' : '+0500' , '+HH:mm' : '+05:00' } ,
1081
+ function ( tz ) {
1082
+ var ngModelOptions = "{timezone: '" + tz + "'}" ;
1083
+ var inputElm = helper . compileInput (
1084
+ '<input type="datetime-local" ng-model="value" ng-model-options="' + ngModelOptions + '" />' ) ;
1071
1085
1072
- helper . changeInputValueTo ( '2000-01-01T06:02' ) ;
1073
- expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2000 , 0 , 1 , 1 , 2 , 0 ) ) ;
1086
+ helper . changeInputValueTo ( '2000-01-01T06:02' ) ;
1087
+ expect ( + $rootScope . value ) . toBe ( Date . UTC ( 2000 , 0 , 1 , 1 , 2 , 0 ) ) ;
1074
1088
1075
- $rootScope . $apply ( function ( ) {
1076
- $rootScope . value = new Date ( Date . UTC ( 2001 , 0 , 1 , 1 , 2 , 0 ) ) ;
1077
- } ) ;
1078
- expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T06:02:00.000' ) ;
1079
- } ) ;
1089
+ $rootScope . $apply ( function ( ) {
1090
+ $rootScope . value = new Date ( Date . UTC ( 2001 , 0 , 1 , 1 , 2 , 0 ) ) ;
1091
+ } ) ;
1092
+ expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T06:02:00.000' ) ;
1093
+ }
1094
+ ) ;
1080
1095
1081
1096
1082
1097
it ( 'should fallback to default timezone in case an unknown timezone was passed' , function ( ) {
@@ -1390,17 +1405,22 @@ describe('input', function() {
1390
1405
} ) ;
1391
1406
1392
1407
1393
- it ( 'should use any timezone if specified in the options' , function ( ) {
1394
- var inputElm = helper . compileInput ( '<input type="time" ng-model="value" ng-model-options="{timezone: \'+0500\'}" />' ) ;
1408
+ they ( 'should use any timezone if specified in the options (format: $prop)' ,
1409
+ { '+HHmm' : '+0500' , '+HH:mm' : '+05:00' } ,
1410
+ function ( tz ) {
1411
+ var ngModelOptions = "{timezone: '" + tz + "'}" ;
1412
+ var inputElm = helper . compileInput (
1413
+ '<input type="time" ng-model="value" ng-model-options="' + ngModelOptions + '" />' ) ;
1395
1414
1396
- helper . changeInputValueTo ( '23:02:00' ) ;
1397
- expect ( + $rootScope . value ) . toBe ( Date . UTC ( 1970 , 0 , 1 , 18 , 2 , 0 ) ) ;
1415
+ helper . changeInputValueTo ( '23:02:00' ) ;
1416
+ expect ( + $rootScope . value ) . toBe ( Date . UTC ( 1970 , 0 , 1 , 18 , 2 , 0 ) ) ;
1398
1417
1399
- $rootScope . $apply ( function ( ) {
1400
- $rootScope . value = new Date ( Date . UTC ( 1971 , 0 , 1 , 18 , 2 , 0 ) ) ;
1401
- } ) ;
1402
- expect ( inputElm . val ( ) ) . toBe ( '23:02:00.000' ) ;
1403
- } ) ;
1418
+ $rootScope . $apply ( function ( ) {
1419
+ $rootScope . value = new Date ( Date . UTC ( 1971 , 0 , 1 , 18 , 2 , 0 ) ) ;
1420
+ } ) ;
1421
+ expect ( inputElm . val ( ) ) . toBe ( '23:02:00.000' ) ;
1422
+ }
1423
+ ) ;
1404
1424
1405
1425
1406
1426
it ( 'should allow to specify the milliseconds' , function ( ) {
@@ -1697,17 +1717,22 @@ describe('input', function() {
1697
1717
} ) ;
1698
1718
1699
1719
1700
- it ( 'should use any timezone if specified in the options' , function ( ) {
1701
- var inputElm = helper . compileInput ( '<input type="date" ng-model="value" ng-model-options="{timezone: \'+0500\'}" />' ) ;
1720
+ they ( 'should use any timezone if specified in the options (format: $prop)' ,
1721
+ { '+HHmm' : '+0500' , '+HH:mm' : '+05:00' } ,
1722
+ function ( tz ) {
1723
+ var ngModelOptions = "{timezone: '" + tz + "'}" ;
1724
+ var inputElm = helper . compileInput (
1725
+ '<input type="date" ng-model="value" ng-model-options="' + ngModelOptions + '" />' ) ;
1702
1726
1703
- helper . changeInputValueTo ( '2000-01-01' ) ;
1704
- expect ( + $rootScope . value ) . toBe ( Date . UTC ( 1999 , 11 , 31 , 19 , 0 , 0 ) ) ;
1727
+ helper . changeInputValueTo ( '2000-01-01' ) ;
1728
+ expect ( + $rootScope . value ) . toBe ( Date . UTC ( 1999 , 11 , 31 , 19 , 0 , 0 ) ) ;
1705
1729
1706
- $rootScope . $apply ( function ( ) {
1707
- $rootScope . value = new Date ( Date . UTC ( 2000 , 11 , 31 , 19 , 0 , 0 ) ) ;
1708
- } ) ;
1709
- expect ( inputElm . val ( ) ) . toBe ( '2001-01-01' ) ;
1710
- } ) ;
1730
+ $rootScope . $apply ( function ( ) {
1731
+ $rootScope . value = new Date ( Date . UTC ( 2000 , 11 , 31 , 19 , 0 , 0 ) ) ;
1732
+ } ) ;
1733
+ expect ( inputElm . val ( ) ) . toBe ( '2001-01-01' ) ;
1734
+ }
1735
+ ) ;
1711
1736
1712
1737
1713
1738
it ( 'should label parse errors as `date`' , function ( ) {
0 commit comments