diff --git a/lib/phoenix_html/form.ex b/lib/phoenix_html/form.ex index de5f807..54f7481 100644 --- a/lib/phoenix_html/form.ex +++ b/lib/phoenix_html/form.ex @@ -380,7 +380,11 @@ defmodule Phoenix.HTML.Form do {value, options} end - [acc | option(option_key, option_value, extra ++ options, selected_values)] + if option_key == :hr do + [acc | hr_tag()] + else + [acc | option(option_key, option_value, extra ++ options, selected_values)] + end :hr, acc -> [acc | hr_tag()] diff --git a/test/phoenix_html/form_test.exs b/test/phoenix_html/form_test.exs index 6c482e0..8ab6795 100644 --- a/test/phoenix_html/form_test.exs +++ b/test/phoenix_html/form_test.exs @@ -294,6 +294,19 @@ defmodule Phoenix.HTML.FormTest do ~s(
) <> ~s() + assert options_for_select( + [ + [key: "First", value: "first"], + [key: :hr, value: nil], + [key: "Last", value: "last"] + ], + nil + ) + |> safe_to_string() == + ~s() <> + ~s(
) <> + ~s() + assert options_for_select( [ {"Open", ~U[2025-01-01 06:30:00.000000Z]},