This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree 2 files changed +27
-0
lines changed
src/components/datepicker 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 574
574
this . calendarPaneOpenedFrom = null ;
575
575
this . $mdUtil . enableScrolling ( ) ;
576
576
577
+ this . ngModelCtrl . $setTouched ( ) ;
578
+
577
579
this . documentElement . off ( 'click touchstart' , this . bodyClickHandler ) ;
578
580
window . removeEventListener ( 'resize' , this . windowResizeHandler ) ;
579
581
}
598
600
* @param {boolean } isFocused
599
601
*/
600
602
DatePickerCtrl . prototype . setFocused = function ( isFocused ) {
603
+ if ( ! isFocused ) {
604
+ this . ngModelCtrl . $setTouched ( ) ;
605
+ }
601
606
this . isFocused = isFocused ;
602
607
} ;
603
608
Original file line number Diff line number Diff line change @@ -293,6 +293,28 @@ describe('md-date-picker', function() {
293
293
expect ( controller . ngModelCtrl . $modelValue ) . toEqual ( initialDate ) ;
294
294
} ) ;
295
295
296
+ it ( 'shoud become touched from bluring closing the pane' , function ( ) {
297
+ populateInputElement ( '17/1/2015' ) ;
298
+
299
+ controller . openCalendarPane ( {
300
+ target : controller . inputElement
301
+ } ) ;
302
+ controller . closeCalendarPane ( ) ;
303
+
304
+ expect ( controller . ngModelCtrl . $touched ) . toBe ( true ) ;
305
+ } ) ;
306
+
307
+ it ( 'should become touch from bluring the input' , function ( ) {
308
+ populateInputElement ( '17/1/2015' ) ;
309
+
310
+ var input = angular . element ( controller . inputElement ) ;
311
+
312
+ input . triggerHandler ( 'focus' ) ;
313
+ input . triggerHandler ( 'blur' ) ;
314
+
315
+ expect ( controller . ngModelCtrl . $touched ) . toBe ( true ) ;
316
+ } ) ;
317
+
296
318
it ( 'should not update the input string is not "complete"' , function ( ) {
297
319
var date = new Date ( 2015 , DEC , 1 ) ;
298
320
pageScope . myDate = date ;
You can’t perform that action at this time.
0 commit comments