germsvel / phoenix_test

MIT License
144 stars 20 forks source link

Improve test: Add '[]' suffix to multi-select name attr #90

Closed ftes closed 2 months ago

ftes commented 2 months ago

Extracted from #74

Align PageView with IndexLive: <select multiple> should use name attr ending in [].

Even though the tests do not currently fail (decode multiple values), an actual Phoenix app would fail (decode only a single value).

As a follow-up, it might be good to make the Static driver stricter to emulate real-world behaviour.

https://github.com/elixir-plug/plug/blob/v1.16.0/lib/plug/parsers/urlencoded.ex https://github.com/elixir-plug/plug/blob/v1.16.0/lib/plug/conn/query.ex#L24

  Lists are created with `[]`:

      iex> decode("foo[]=bar&foo[]=baz")["foo"]
      ["bar", "baz"]
ftes commented 2 months ago

Somewhat related to #77, #79

germsvel commented 2 months ago

@ftes I'm going to close this since I think it's fixed by #94 (right?). If it's not, happy to reopen it.