@@ -255,8 +255,15 @@ public void InputDateInteractsWithEditContext_NullableDateTimeOffset()
255255 public void InputDateInteractsWithEditContext_TimeInput ( )
256256 {
257257 var appElement = MountTypicalValidationComponent ( ) ;
258- var departureTimeInput = appElement . FindElement ( By . ClassName ( "departure-time" ) ) . FindElement ( By . TagName ( "input" ) ) ;
259258 var messagesAccessor = CreateValidationMessagesAccessor ( appElement ) ;
259+ var departureTimeInput = appElement . FindElement ( By . ClassName ( "departure-time" ) ) . FindElement ( By . Id ( "time-input" ) ) ;
260+ var includeSecondsCheckbox = appElement . FindElement ( By . ClassName ( "departure-time" ) ) . FindElement ( By . Id ( "time-seconds-checkbox" ) ) ;
261+
262+ // Ensure we're not using a custom step
263+ if ( includeSecondsCheckbox . Selected )
264+ {
265+ includeSecondsCheckbox . Click ( ) ;
266+ }
260267
261268 // Validates on edit
262269 Browser . Equal ( "valid" , ( ) => departureTimeInput . GetAttribute ( "class" ) ) ;
@@ -271,7 +278,39 @@ public void InputDateInteractsWithEditContext_TimeInput()
271278 Browser . Equal ( new [ ] { "The DepartureTime field must be a time." } , messagesAccessor ) ;
272279 }
273280
274- [ Fact ( Skip = "https://github.com/dotnet/aspnetcore/issues/35498" ) ]
281+ [ Fact ]
282+ public void InputDateInteractsWithEditContext_TimeInput_Step ( )
283+ {
284+ var appElement = MountTypicalValidationComponent ( ) ;
285+ var messagesAccessor = CreateValidationMessagesAccessor ( appElement ) ;
286+ var departureTimeInput = appElement . FindElement ( By . ClassName ( "departure-time" ) ) . FindElement ( By . Id ( "time-input" ) ) ;
287+ var includeSecondsCheckbox = appElement . FindElement ( By . ClassName ( "departure-time" ) ) . FindElement ( By . Id ( "time-seconds-checkbox" ) ) ;
288+
289+ // Ensure we're using a custom step
290+ if ( ! includeSecondsCheckbox . Selected )
291+ {
292+ includeSecondsCheckbox . Click ( ) ;
293+ }
294+
295+ // Input works with seconds value of zero and has the expected final value
296+ Browser . Equal ( "valid" , ( ) => departureTimeInput . GetAttribute ( "class" ) ) ;
297+ departureTimeInput . SendKeys ( "111111" ) ;
298+ Browser . Equal ( "modified valid" , ( ) => departureTimeInput . GetAttribute ( "class" ) ) ;
299+ Browser . Equal ( "11:11:11" , ( ) => departureTimeInput . GetAttribute ( "value" ) ) ;
300+
301+ // Input works with non-zero seconds value
302+ // Move to the beginning of the input and put the new time
303+ departureTimeInput . SendKeys ( string . Concat ( Enumerable . Repeat ( Keys . ArrowLeft , 3 ) ) + "101010" ) ;
304+ Browser . Equal ( "modified valid" , ( ) => departureTimeInput . GetAttribute ( "class" ) ) ;
305+ Browser . Equal ( "10:10:10" , ( ) => departureTimeInput . GetAttribute ( "value" ) ) ;
306+
307+ // Can become invalid
308+ departureTimeInput . SendKeys ( Keys . Backspace ) ;
309+ Browser . Equal ( "modified invalid" , ( ) => departureTimeInput . GetAttribute ( "class" ) ) ;
310+ Browser . Equal ( new [ ] { "The DepartureTime field must be a time." } , messagesAccessor ) ;
311+ }
312+
313+ [ Fact ]
275314 public void InputDateInteractsWithEditContext_MonthInput ( )
276315 {
277316 var appElement = MountTypicalValidationComponent ( ) ;
@@ -283,50 +322,92 @@ public void InputDateInteractsWithEditContext_MonthInput()
283322 visitMonthInput . SendKeys ( $ "03{ Keys . ArrowRight } 2005\t ") ;
284323 Browser . Equal ( "modified valid" , ( ) => visitMonthInput . GetAttribute ( "class" ) ) ;
285324
286- // Can become invalid
287- visitMonthInput . SendKeys ( $ "11 { Keys . ArrowRight } 11111 \t " ) ;
325+ // Empty is invalid because it's not nullable
326+ visitMonthInput . Clear ( ) ;
288327 Browser . Equal ( "modified invalid" , ( ) => visitMonthInput . GetAttribute ( "class" ) ) ;
289328 Browser . Equal ( new [ ] { "The VisitMonth field must be a year and month." } , messagesAccessor ) ;
290329
291- // Empty is invalid, because it's not nullable
292- visitMonthInput . SendKeys ( $ "{ Keys . Backspace } \t { Keys . Backspace } \t ") ;
330+ // Invalid year (11111)
331+ visitMonthInput . SendKeys ( $ "11 { Keys . ArrowRight } 11111 \t ") ;
293332 Browser . Equal ( "modified invalid" , ( ) => visitMonthInput . GetAttribute ( "class" ) ) ;
294333 Browser . Equal ( new [ ] { "The VisitMonth field must be a year and month." } , messagesAccessor ) ;
295334
335+ // Can become valid again
296336 visitMonthInput . Clear ( ) ;
297- visitMonthInput . SendKeys ( $ "05 { Keys . ArrowRight } 2007 \t ") ;
337+ visitMonthInput . SendKeys ( $ "11 { Keys . ArrowRight } 1111 \t ") ;
298338 Browser . Equal ( "modified valid" , ( ) => visitMonthInput . GetAttribute ( "class" ) ) ;
299339 Browser . Empty ( messagesAccessor ) ;
300340 }
301341
302- [ Fact ( Skip = "https://github.com/dotnet/aspnetcore/issues/35498" ) ]
342+ [ Fact ]
303343 [ QuarantinedTest ( "https://github.com/dotnet/aspnetcore/issues/34884" ) ]
304344 public void InputDateInteractsWithEditContext_DateTimeLocalInput ( )
305345 {
306346 var appElement = MountTypicalValidationComponent ( ) ;
307- var appointmentInput = appElement . FindElement ( By . ClassName ( "appointment-date-time" ) ) . FindElement ( By . TagName ( "input" ) ) ;
308347 var messagesAccessor = CreateValidationMessagesAccessor ( appElement ) ;
348+ var appointmentInput = appElement . FindElement ( By . ClassName ( "appointment-date-time" ) ) . FindElement ( By . Id ( "datetime-local-input" ) ) ;
349+ var includeSecondsCheckbox = appElement . FindElement ( By . ClassName ( "appointment-date-time" ) ) . FindElement ( By . Id ( "datetime-local-seconds-checkbox" ) ) ;
309350
310- // Validates on edit
351+ // Ensure we're not using a custom step
352+ if ( includeSecondsCheckbox . Selected )
353+ {
354+ includeSecondsCheckbox . Click ( ) ;
355+ }
356+
357+ // Validates on edit and has the expected value
311358 Browser . Equal ( "valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
312- appointmentInput . SendKeys ( "01 \t 02 \t 1988 \t 0523 \t 1 ") ;
359+ appointmentInput . SendKeys ( $ "01011970 { Keys . ArrowRight } 05421 ") ;
313360 Browser . Equal ( "modified valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
314361
315- // Can become invalid
316- appointmentInput . SendKeys ( $ "11 { Keys . ArrowRight } 11 { Keys . ArrowRight } 11111 { Keys . ArrowRight } \t " ) ;
362+ // Empty is invalid because it's not nullable
363+ appointmentInput . Clear ( ) ;
317364 Browser . Equal ( "modified invalid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
318365 Browser . Equal ( new [ ] { "The AppointmentDateAndTime field must be a date and time." } , messagesAccessor ) ;
319366
320- // Empty is invalid, because it's not nullable
321- appointmentInput . SendKeys ( $ "{ Keys . Backspace } \t { Keys . Backspace } \t { Keys . Backspace } \t { Keys . Backspace } \t { Keys . Backspace } \t { Keys . Backspace } \t ") ;
367+ // Invalid year (11111)
368+ appointmentInput . SendKeys ( $ "111111111 { Keys . ArrowRight } 11111 ") ;
322369 Browser . Equal ( "modified invalid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
323370 Browser . Equal ( new [ ] { "The AppointmentDateAndTime field must be a date and time." } , messagesAccessor ) ;
324371
325- appointmentInput . SendKeys ( "01234567\t 11551\t " ) ;
372+ // Can become valid again
373+ appointmentInput . Clear ( ) ;
374+ appointmentInput . SendKeys ( $ "11111111{ Keys . ArrowRight } 11111") ;
326375 Browser . Equal ( "modified valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
327376 Browser . Empty ( messagesAccessor ) ;
328377 }
329378
379+ [ Fact ]
380+ public void InputDateInteractsWithEditContext_DateTimeLocalInput_Step ( )
381+ {
382+ var appElement = MountTypicalValidationComponent ( ) ;
383+ var messagesAccessor = CreateValidationMessagesAccessor ( appElement ) ;
384+ var appointmentInput = appElement . FindElement ( By . ClassName ( "appointment-date-time" ) ) . FindElement ( By . Id ( "datetime-local-input" ) ) ;
385+ var includeSecondsCheckbox = appElement . FindElement ( By . ClassName ( "appointment-date-time" ) ) . FindElement ( By . Id ( "datetime-local-seconds-checkbox" ) ) ;
386+
387+ // Ensure we're using a custom step
388+ if ( ! includeSecondsCheckbox . Selected )
389+ {
390+ includeSecondsCheckbox . Click ( ) ;
391+ }
392+
393+ // Input works with seconds value of zero and has the expected final value
394+ Browser . Equal ( "valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
395+ appointmentInput . SendKeys ( $ "11111970{ Keys . ArrowRight } 114216") ;
396+ Browser . Equal ( "modified valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
397+ Browser . Equal ( "1970-11-11T11:42:16" , ( ) => appointmentInput . GetAttribute ( "value" ) ) ;
398+
399+ // Input works with non-zero seconds value
400+ // Move to the beginning of the input and put the new value
401+ appointmentInput . SendKeys ( string . Concat ( Enumerable . Repeat ( Keys . ArrowLeft , 6 ) ) + $ "10101970{ Keys . ArrowRight } 105321") ;
402+ Browser . Equal ( "modified valid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
403+ Browser . Equal ( "1970-10-10T10:53:21" , ( ) => appointmentInput . GetAttribute ( "value" ) ) ;
404+
405+ // Can become invalid
406+ appointmentInput . SendKeys ( Keys . Backspace ) ;
407+ Browser . Equal ( "modified invalid" , ( ) => appointmentInput . GetAttribute ( "class" ) ) ;
408+ Browser . Equal ( new [ ] { "The AppointmentDateAndTime field must be a date and time." } , messagesAccessor ) ;
409+ }
410+
330411 [ Fact ]
331412 public void InputSelectInteractsWithEditContext ( )
332413 {
0 commit comments