@@ -628,17 +628,22 @@ describe('input', function() {
628628 } ) ;
629629
630630
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 + '" />' ) ;
633637
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 ) ) ;
636640
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+ ) ;
642647
643648
644649 it ( 'should label parse errors as `month`' , function ( ) {
@@ -865,17 +870,22 @@ describe('input', function() {
865870 } ) ;
866871
867872
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 + '" />' ) ;
870879
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 ) ) ;
873882
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+ ) ;
879889
880890
881891 it ( 'should label parse errors as `week`' , function ( ) {
@@ -1066,17 +1076,22 @@ describe('input', function() {
10661076 } ) ;
10671077
10681078
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 + '" />' ) ;
10711085
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 ) ) ;
10741088
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+ ) ;
10801095
10811096
10821097 it ( 'should fallback to default timezone in case an unknown timezone was passed' , function ( ) {
@@ -1390,17 +1405,22 @@ describe('input', function() {
13901405 } ) ;
13911406
13921407
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 + '" />' ) ;
13951414
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 ) ) ;
13981417
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+ ) ;
14041424
14051425
14061426 it ( 'should allow to specify the milliseconds' , function ( ) {
@@ -1697,17 +1717,22 @@ describe('input', function() {
16971717 } ) ;
16981718
16991719
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 + '" />' ) ;
17021726
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 ) ) ;
17051729
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+ ) ;
17111736
17121737
17131738 it ( 'should label parse errors as `date`' , function ( ) {
0 commit comments