This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/components/datepicker Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 576
576
this . calendarPaneOpenedFrom = null ;
577
577
this . $mdUtil . enableScrolling ( ) ;
578
578
579
+ this . ngModelCtrl . $setTouched ( ) ;
580
+
579
581
this . documentElement . off ( 'click touchstart' , this . bodyClickHandler ) ;
580
582
window . removeEventListener ( 'resize' , this . windowResizeHandler ) ;
581
583
}
600
602
* @param {boolean } isFocused
601
603
*/
602
604
DatePickerCtrl . prototype . setFocused = function ( isFocused ) {
605
+ if ( ! isFocused ) {
606
+ this . ngModelCtrl . $setTouched ( ) ;
607
+ }
603
608
this . isFocused = isFocused ;
604
609
} ;
605
610
Original file line number Diff line number Diff line change @@ -311,6 +311,28 @@ describe('md-date-picker', function() {
311
311
expect ( controller . ngModelCtrl . $modelValue ) . toEqual ( initialDate ) ;
312
312
} ) ;
313
313
314
+ it ( 'shoud become touched from bluring closing the pane' , function ( ) {
315
+ populateInputElement ( '17/1/2015' ) ;
316
+
317
+ controller . openCalendarPane ( {
318
+ target : controller . inputElement
319
+ } ) ;
320
+ controller . closeCalendarPane ( ) ;
321
+
322
+ expect ( controller . ngModelCtrl . $touched ) . toBe ( true ) ;
323
+ } ) ;
324
+
325
+ it ( 'should become touch from bluring the input' , function ( ) {
326
+ populateInputElement ( '17/1/2015' ) ;
327
+
328
+ var input = angular . element ( controller . inputElement ) ;
329
+
330
+ input . triggerHandler ( 'focus' ) ;
331
+ input . triggerHandler ( 'blur' ) ;
332
+
333
+ expect ( controller . ngModelCtrl . $touched ) . toBe ( true ) ;
334
+ } ) ;
335
+
314
336
it ( 'should not update the input string is not "complete"' , function ( ) {
315
337
var date = new Date ( 2015 , DEC , 1 ) ;
316
338
pageScope . myDate = date ;
You can’t perform that action at this time.
0 commit comments