@@ -30,14 +30,32 @@ class BrewsControllerTest < ActionDispatch::IntegrationTest
3030 assert_select "input[name=?][value=?]" , "brew[preinfusion_seconds]" , "5"
3131 assert_select "input[name=?][value=?]" , "brew[first_drip_seconds]" , "8" , count : 0
3232 assert_select "input[name=?][value=?][checked]" , "brew[rating]" , "4" , count : 0
33- assert_select "input[type=datetime-local][name=?][required=required]" , "brew[occurred_at]"
33+ assert_select "input[type=datetime-local][name=?][required=required][step=?] " , "brew[occurred_at]" , "1 "
3434 assert_select "textarea[name=?]" , "brew[notes]" , text : ""
3535 assert_select "input[type=checkbox][name=?][value=?][checked]" , "brew[preparation_tool_ids][]" , preparation_tools ( :wdt ) . id . to_s
3636 assert_select "input[type=checkbox][name=?][value=?]" , "brew[preparation_tool_ids][]" , preparation_tools ( :puck_screen ) . id . to_s
3737 assert_select "input[type=checkbox][name=?][value=?]" , "brew[preparation_tool_ids][]" , preparation_tools ( :other_workspace_tool ) . id . to_s , count : 0
3838 assert_select "input[type=file][name=?][multiple=multiple]" , "brew[photos][]"
3939 end
4040
41+ test "new places brew log time at the end of the form" do
42+ sign_in_as ( users ( :one ) )
43+
44+ get new_brew_path
45+
46+ assert_response :success
47+ form_body = Nokogiri ::HTML ( response . body ) . at_css ( "form[action='#{ brews_path } ']" ) . inner_html
48+ log_time_index = form_body . index ( 'data-section="log-time"' )
49+ record_links_index = form_body . index ( 'data-testid="record-links-fields"' )
50+ submit_index = form_body . index ( 'type="submit"' )
51+
52+ assert_not_nil log_time_index
53+ assert_not_nil record_links_index
54+ assert_not_nil submit_index
55+ assert_operator log_time_index , :> , record_links_index
56+ assert_operator log_time_index , :< , submit_index
57+ end
58+
4159 test "new falls back to household last brew defaults for a user without household brews" do
4260 user = users ( :two )
4361 user . update! ( active_workspace : workspaces ( :household ) )
@@ -113,7 +131,7 @@ class BrewsControllerTest < ActionDispatch::IntegrationTest
113131 get new_brew_path ( method : "quick_drip" )
114132
115133 assert_response :success
116- assert_select "input[type=datetime-local][name=?][required=required]" , "brew[occurred_at]"
134+ assert_select "input[type=datetime-local][name=?][required=required][step=?] " , "brew[occurred_at]" , "1 "
117135 assert_select "input[name=?][autofocus]" , "brew[machine_cups]"
118136 assert_select "input[type=text][inputmode=decimal][name=?]" , "brew[machine_cups]"
119137 assert_select "input[type=text][inputmode=decimal][name=?]" , "brew[coffee_spoons]"
@@ -666,14 +684,19 @@ class BrewsControllerTest < ActionDispatch::IntegrationTest
666684 test "writer can update brew log time and inventory adjustment time" do
667685 sign_in_as ( users ( :one ) )
668686 brew = brews ( :morning_espresso )
669- new_time = Time . zone . local ( 2026 , 5 , 27 , 10 , 15 , 0 )
687+ new_time = Time . zone . local ( 2026 , 5 , 27 , 10 , 15 , 28 )
688+
689+ get edit_brew_path ( brew )
690+
691+ assert_response :success
692+ assert_select "input[type=datetime-local][name=?][required=required][step=?]" , "brew[occurred_at]" , "1"
670693
671694 patch brew_path ( brew ) , params : {
672695 brew : {
673696 bean_id : brew . bean . id ,
674697 grinder_id : brew . grinder . id ,
675698 machine_id : brew . machine . id ,
676- occurred_at : "2026-05-27T10:15" ,
699+ occurred_at : "2026-05-27T10:15:28 " ,
677700 bean_weight_grams : brew . bean_weight_grams . to_s ,
678701 ground_weight_grams : brew . ground_weight_grams . to_s ,
679702 dose_grams : brew . dose_grams . to_s ,
0 commit comments