@@ -2590,13 +2590,13 @@ describe('input', function() {
2590
2590
} ) ;
2591
2591
2592
2592
it ( 'should set the view if the model if a valid Date object.' , function ( ) {
2593
- compileInput ( '<input type="datetime-local" ng-model="tenSecondsToNextYear "/>' ) ;
2593
+ compileInput ( '<input type="datetime-local" ng-model="halfSecondToNextYear "/>' ) ;
2594
2594
2595
2595
scope . $apply ( function ( ) {
2596
- scope . tenSecondsToNextYear = new Date ( 2013 , 11 , 31 , 23 , 59 , 0 ) ;
2596
+ scope . halfSecondToNextYear = new Date ( 2013 , 11 , 31 , 23 , 59 , 59 , 500 ) ;
2597
2597
} ) ;
2598
2598
2599
- expect ( inputElm . val ( ) ) . toBe ( '2013-12-31T23:59:00 ' ) ;
2599
+ expect ( inputElm . val ( ) ) . toBe ( '2013-12-31T23:59:59.500 ' ) ;
2600
2600
} ) ;
2601
2601
2602
2602
it ( 'should set the model undefined if the view is invalid' , function ( ) {
@@ -2606,7 +2606,7 @@ describe('input', function() {
2606
2606
scope . breakMe = new Date ( 2009 , 0 , 6 , 16 , 25 , 0 ) ;
2607
2607
} ) ;
2608
2608
2609
- expect ( inputElm . val ( ) ) . toBe ( '2009-01-06T16:25:00' ) ;
2609
+ expect ( inputElm . val ( ) ) . toBe ( '2009-01-06T16:25:00.000 ' ) ;
2610
2610
2611
2611
try {
2612
2612
//set to text for browsers with datetime-local validation.
@@ -2663,7 +2663,21 @@ describe('input', function() {
2663
2663
scope . $apply ( function ( ) {
2664
2664
scope . value = new Date ( Date . UTC ( 2001 , 0 , 1 , 1 , 2 , 0 ) ) ;
2665
2665
} ) ;
2666
- expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T01:02:00' ) ;
2666
+ expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T01:02:00.000' ) ;
2667
+ } ) ;
2668
+
2669
+ it ( 'should allow to specify the milliseconds' , function ( ) {
2670
+ compileInput ( '<input type="datetime-local" ng-model="value"" />' ) ;
2671
+
2672
+ changeInputValueTo ( '2000-01-01T01:02:03.500' ) ;
2673
+ expect ( + scope . value ) . toBe ( + new Date ( 2000 , 0 , 1 , 1 , 2 , 3 , 500 ) ) ;
2674
+ } ) ;
2675
+
2676
+ it ( 'should allow to specify single digit milliseconds' , function ( ) {
2677
+ compileInput ( '<input type="datetime-local" ng-model="value"" />' ) ;
2678
+
2679
+ changeInputValueTo ( '2000-01-01T01:02:03.4' ) ;
2680
+ expect ( + scope . value ) . toBe ( + new Date ( 2000 , 0 , 1 , 1 , 2 , 3 , 400 ) ) ;
2667
2681
} ) ;
2668
2682
2669
2683
it ( 'should allow to specify the seconds' , function ( ) {
@@ -2675,7 +2689,7 @@ describe('input', function() {
2675
2689
scope . $apply ( function ( ) {
2676
2690
scope . value = new Date ( 2001 , 0 , 1 , 1 , 2 , 3 ) ;
2677
2691
} ) ;
2678
- expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T01:02:03' ) ;
2692
+ expect ( inputElm . val ( ) ) . toBe ( '2001-01-01T01:02:03.000 ' ) ;
2679
2693
} ) ;
2680
2694
2681
2695
it ( 'should allow to skip the seconds' , function ( ) {
@@ -2854,10 +2868,10 @@ describe('input', function() {
2854
2868
compileInput ( '<input type="time" ng-model="threeFortyOnePm"/>' ) ;
2855
2869
2856
2870
scope . $apply ( function ( ) {
2857
- scope . threeFortyOnePm = new Date ( 1970 , 0 , 1 , 15 , 41 , 0 ) ;
2871
+ scope . threeFortyOnePm = new Date ( 1970 , 0 , 1 , 15 , 41 , 0 , 500 ) ;
2858
2872
} ) ;
2859
2873
2860
- expect ( inputElm . val ( ) ) . toBe ( '15:41:00' ) ;
2874
+ expect ( inputElm . val ( ) ) . toBe ( '15:41:00.500 ' ) ;
2861
2875
} ) ;
2862
2876
2863
2877
it ( 'should set the model undefined if the view is invalid' , function ( ) {
@@ -2867,7 +2881,7 @@ describe('input', function() {
2867
2881
scope . breakMe = new Date ( 1970 , 0 , 1 , 16 , 25 , 0 ) ;
2868
2882
} ) ;
2869
2883
2870
- expect ( inputElm . val ( ) ) . toBe ( '16:25:00' ) ;
2884
+ expect ( inputElm . val ( ) ) . toBe ( '16:25:00.000 ' ) ;
2871
2885
2872
2886
try {
2873
2887
//set to text for browsers with time validation.
@@ -2924,7 +2938,21 @@ describe('input', function() {
2924
2938
scope . $apply ( function ( ) {
2925
2939
scope . value = new Date ( Date . UTC ( 1971 , 0 , 1 , 23 , 2 , 0 ) ) ;
2926
2940
} ) ;
2927
- expect ( inputElm . val ( ) ) . toBe ( '23:02:00' ) ;
2941
+ expect ( inputElm . val ( ) ) . toBe ( '23:02:00.000' ) ;
2942
+ } ) ;
2943
+
2944
+ it ( 'should allow to specify the milliseconds' , function ( ) {
2945
+ compileInput ( '<input type="time" ng-model="value"" />' ) ;
2946
+
2947
+ changeInputValueTo ( '01:02:03.500' ) ;
2948
+ expect ( + scope . value ) . toBe ( + new Date ( 1970 , 0 , 1 , 1 , 2 , 3 , 500 ) ) ;
2949
+ } ) ;
2950
+
2951
+ it ( 'should allow to specify single digit milliseconds' , function ( ) {
2952
+ compileInput ( '<input type="time" ng-model="value"" />' ) ;
2953
+
2954
+ changeInputValueTo ( '01:02:03.4' ) ;
2955
+ expect ( + scope . value ) . toBe ( + new Date ( 1970 , 0 , 1 , 1 , 2 , 3 , 400 ) ) ;
2928
2956
} ) ;
2929
2957
2930
2958
it ( 'should allow to specify the seconds' , function ( ) {
@@ -2936,7 +2964,7 @@ describe('input', function() {
2936
2964
scope . $apply ( function ( ) {
2937
2965
scope . value = new Date ( 1970 , 0 , 1 , 1 , 2 , 3 ) ;
2938
2966
} ) ;
2939
- expect ( inputElm . val ( ) ) . toBe ( '01:02:03' ) ;
2967
+ expect ( inputElm . val ( ) ) . toBe ( '01:02:03.000 ' ) ;
2940
2968
} ) ;
2941
2969
2942
2970
it ( 'should allow to skip the seconds' , function ( ) {
@@ -3192,13 +3220,13 @@ describe('input', function() {
3192
3220
scope . val = new Date ( 2013 , 1 , 2 , 3 , 4 , 5 , 6 ) ;
3193
3221
} ) ;
3194
3222
3195
- expect ( timeElm . val ( ) ) . toBe ( '03:04:05' ) ;
3223
+ expect ( timeElm . val ( ) ) . toBe ( '03:04:05.006 ' ) ;
3196
3224
expect ( monthElm . val ( ) ) . toBe ( '2013-02' ) ;
3197
3225
expect ( weekElm . val ( ) ) . toBe ( '2013-W05' ) ;
3198
3226
3199
3227
changeGivenInputTo ( monthElm , '2012-02' ) ;
3200
3228
expect ( monthElm . val ( ) ) . toBe ( '2012-02' ) ;
3201
- expect ( timeElm . val ( ) ) . toBe ( '03:04:05' ) ;
3229
+ expect ( timeElm . val ( ) ) . toBe ( '03:04:05.006 ' ) ;
3202
3230
expect ( weekElm . val ( ) ) . toBe ( '2012-W05' ) ;
3203
3231
3204
3232
changeGivenInputTo ( timeElm , '04:05:06' ) ;
@@ -3208,10 +3236,10 @@ describe('input', function() {
3208
3236
3209
3237
changeGivenInputTo ( weekElm , '2014-W01' ) ;
3210
3238
expect ( monthElm . val ( ) ) . toBe ( '2014-01' ) ;
3211
- expect ( timeElm . val ( ) ) . toBe ( '04:05:06' ) ;
3239
+ expect ( timeElm . val ( ) ) . toBe ( '04:05:06.000 ' ) ;
3212
3240
expect ( weekElm . val ( ) ) . toBe ( '2014-W01' ) ;
3213
3241
3214
- expect ( + scope . val ) . toBe ( + new Date ( 2014 , 0 , 2 , 4 , 5 , 6 , 6 ) ) ;
3242
+ expect ( + scope . val ) . toBe ( + new Date ( 2014 , 0 , 2 , 4 , 5 , 6 , 0 ) ) ;
3215
3243
3216
3244
function changeGivenInputTo ( inputElm , value ) {
3217
3245
inputElm . val ( value ) ;
0 commit comments