@@ -248,9 +248,10 @@ defmodule Phoenix.HTML.FormTest do
248
248
249
249
describe "options_for_select/2" do
250
250
test "simple" do
251
- assert options_for_select ( ~w ( value novalue) , "novalue" ) |> safe_to_string ( ) ==
251
+ assert options_for_select ( [ " value" , " novalue" , nil ] , "novalue" ) |> safe_to_string ( ) ==
252
252
~s( <option value="value">value</option>) <>
253
- ~s( <option selected value="novalue">novalue</option>)
253
+ ~s( <option selected value="novalue">novalue</option>) <>
254
+ ~s( <option value=""></option>)
254
255
255
256
assert options_for_select ( [ "value" , :hr , "novalue" ] , "novalue" ) |> safe_to_string ( ) ==
256
257
~s( <option value="value">value</option>) <>
@@ -261,14 +262,16 @@ defmodule Phoenix.HTML.FormTest do
261
262
[
262
263
[ value: "value" , key: "Value" , disabled: true ] ,
263
264
:hr ,
264
- [ value: "novalue" , key: "No Value" ]
265
+ [ value: "novalue" , key: "No Value" ] ,
266
+ [ value: nil , key: nil ]
265
267
] ,
266
268
"novalue"
267
269
)
268
270
|> safe_to_string ( ) ==
269
271
~s( <option disabled value="value">Value</option>) <>
270
272
~s( <hr/>) <>
271
- ~s( <option selected value="novalue">No Value</option>)
273
+ ~s( <option selected value="novalue">No Value</option>) <>
274
+ ~s( <option value=""></option>)
272
275
273
276
assert options_for_select ( ~w( value novalue) , [ "value" , "novalue" ] ) |> safe_to_string ( ) ==
274
277
~s( <option selected value="value">value</option>) <>
0 commit comments