germsvel / phoenix_test

PhoenixTest provides a unified way of writing feature tests -- regardless of whether you're testing LiveView pages or static (non-LiveView) pages.
https://hex.pm/packages/phoenix_test
MIT License
181 stars 23 forks source link

Fix multi checkbox: Add hidden input only once #110

Closed ftes closed 1 month ago

ftes commented 2 months ago

Given

<input type="hidden" name="race_3[]" value="dwarf" />
<label><input type="checkbox" name="race_3[]" value="human" />Human</label>
<label><input type="checkbox" name="race_3[]" value="elf" />Elf</label>
|> check("Human")
|> check("Elf")

Expected

race_3: [dwarf, human, elf]

Actual

race_3: [dwarf, dwarf, dwarf, human, elf]

Todo

germsvel commented 1 month ago

Not 100% sure, but I think this might be related to #105. Might not be 100% the same, but I think when we moved active form data from being maps into tuples, we lost the ability to dedup.

In any case, I'm looking into a solution for #105 that might fix this too.