@@ -950,42 +950,57 @@ describe('Date picker', () => {
950950 } ) ;
951951
952952 it ( 'should enforce min value constraint' , ( ) => {
953+ // No value - submit passes
953954 spec . setProperties ( { min : new Date ( 2026 , 0 , 1 ) } ) ;
954- spec . assertSubmitFails ( ) ;
955+ spec . assertSubmitPasses ( ) ;
955956
957+ // Invalid min constraint
956958 spec . setProperties ( { value : new Date ( 2022 , 0 , 1 ) } ) ;
957959 spec . assertSubmitFails ( ) ;
958960
961+ // Valid value
959962 spec . setProperties ( { value : new Date ( 2026 , 0 , 2 ) } ) ;
960963 spec . assertSubmitPasses ( ) ;
961964 } ) ;
962965
963966 it ( 'should enforce max value constraint' , ( ) => {
964- spec . setProperties ( { max : new Date ( 2020 , 0 , 1 ) , value : today . native } ) ;
967+ // No value - submit passes
968+ spec . setProperties ( { max : new Date ( 2020 , 0 , 1 ) } ) ;
969+ spec . assertSubmitPasses ( ) ;
970+
971+ // Invalid max constraint
972+ spec . setProperties ( { value : today . native } ) ;
965973 spec . assertSubmitFails ( ) ;
966974
975+ // Valid value
967976 spec . setProperties ( { value : new Date ( 2020 , 0 , 1 ) } ) ;
968977 spec . assertSubmitPasses ( ) ;
969978 } ) ;
970979
971980 it ( 'should enforce min value constraint with string property' , ( ) => {
981+ // No value - submit passes
972982 spec . setProperties ( { min : new Date ( 2026 , 0 , 1 ) . toISOString ( ) } ) ;
973- spec . assertSubmitFails ( ) ;
983+ spec . assertSubmitPasses ( ) ;
974984
985+ // Invalid min constraint
975986 spec . setProperties ( { value : new Date ( 2022 , 0 , 1 ) . toISOString ( ) } ) ;
976987 spec . assertSubmitFails ( ) ;
977988
989+ // Valid value
978990 spec . setProperties ( { value : new Date ( 2026 , 0 , 2 ) . toISOString ( ) } ) ;
979991 spec . assertSubmitPasses ( ) ;
980992 } ) ;
981993
982994 it ( 'should enforce max value constraint with string property' , ( ) => {
983- spec . setProperties ( {
984- max : new Date ( 2020 , 0 , 1 ) . toISOString ( ) ,
985- value : today . native ,
986- } ) ;
995+ // No value - submit passes
996+ spec . setProperties ( { max : new Date ( 2020 , 0 , 1 ) . toISOString ( ) } ) ;
997+ spec . assertSubmitPasses ( ) ;
998+
999+ // Invalid max constraint
1000+ spec . setProperties ( { value : today . native } ) ;
9871001 spec . assertSubmitFails ( ) ;
9881002
1003+ // Valid value
9891004 spec . setProperties ( { value : new Date ( 2020 , 0 , 1 ) . toISOString ( ) } ) ;
9901005 spec . assertSubmitPasses ( ) ;
9911006 } ) ;
@@ -1066,7 +1081,6 @@ describe('Date picker', () => {
10661081 const spec = createFormAssociatedTestBed < IgcDatePickerComponent > ( html `
10671082 < igc-date-picker
10681083 name ="datePicker "
1069- required
10701084 .defaultValue =${ null }
10711085 > </ igc-date-picker >
10721086 ` ) ;
@@ -1076,12 +1090,13 @@ describe('Date picker', () => {
10761090 } ) ;
10771091
10781092 it ( 'fails required validation' , ( ) => {
1093+ spec . setProperties ( { required : true } ) ;
10791094 spec . assertIsPristine ( ) ;
10801095 spec . assertSubmitFails ( ) ;
10811096 } ) ;
10821097
10831098 it ( 'passes required validation when updating defaultValue' , ( ) => {
1084- spec . setProperties ( { defaultValue : today . native } ) ;
1099+ spec . setProperties ( { required : true , defaultValue : today . native } ) ;
10851100 spec . assertIsPristine ( ) ;
10861101
10871102 spec . assertSubmitPasses ( ) ;
@@ -1107,7 +1122,7 @@ describe('Date picker', () => {
11071122 it ( 'fails max validation' , ( ) => {
11081123 spec . setProperties ( {
11091124 max : today . native ,
1110- defaultValue : today . native ,
1125+ defaultValue : today . add ( 'day' , 1 ) . native ,
11111126 } ) ;
11121127
11131128 spec . assertIsPristine ( ) ;
@@ -1117,7 +1132,7 @@ describe('Date picker', () => {
11171132 it ( 'passes max validation' , ( ) => {
11181133 spec . setProperties ( {
11191134 max : today . native ,
1120- defaultValue : today . add ( 'day' , - 1 ) . native ,
1135+ defaultValue : today . native ,
11211136 } ) ;
11221137
11231138 spec . assertIsPristine ( ) ;
@@ -1135,7 +1150,10 @@ describe('Date picker', () => {
11351150 } ,
11361151 ] ;
11371152
1138- spec . setProperties ( { disabledDates } ) ;
1153+ spec . setProperties ( {
1154+ disabledDates,
1155+ defaultValue : new Date ( 2024 , 1 , 28 ) ,
1156+ } ) ;
11391157
11401158 spec . assertIsPristine ( ) ;
11411159 spec . assertSubmitFails ( ) ;
@@ -1154,7 +1172,7 @@ describe('Date picker', () => {
11541172
11551173 spec . setProperties ( {
11561174 disabledDates,
1157- defaultValue : new Date ( 2024 , 1 , 26 ) ,
1175+ defaultValue : new Date ( 2024 , 1 , 29 ) ,
11581176 } ) ;
11591177
11601178 spec . assertIsPristine ( ) ;
@@ -1187,7 +1205,7 @@ describe('Date picker', () => {
11871205 } ) ;
11881206
11891207 describe ( 'Validation message slots' , ( ) => {
1190- it ( '' , async ( ) => {
1208+ it ( '' , ( ) => {
11911209 const now = CalendarDay . today ;
11921210 const tomorrow = now . add ( 'day' , 1 ) ;
11931211 const yesterday = now . add ( 'day' , - 1 ) ;
0 commit comments