demarches-normaliennes/spec
Pierre de La Morinerie 0800bf68d0 views: allow unselecting all values from a multiple dropdown
Currently, deselecting all values from a multiple dropdown rendered as
checkboxes doesn't have any effect when submitting the form (the
previous values are still there, instead of being deselected).

This is because unchecked checkboxes are not sent by the browser – so
the "empty selection" never gets sent.

Rails `form.check_box` usually works around this by inserting an empty
hidden checkbox element, that will be sent even if all others are
de-selected. But the documentation warns that this is not possible when
iterating over an array (rather than a model). Which is our case here.

To fix this, this commit uses `collection_check_boxes` instead. It will
insert the proper hidden checkboxes in all cases, and fix our use case.

See https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes
2020-08-27 11:13:40 +02:00
..
controllers models: require belong_to associations on champ 2020-08-18 15:57:37 +02:00
factories models: require belong_to associations on mail templates 2020-08-18 15:57:37 +02:00
features validates phone champ server side 2020-08-20 15:33:03 +02:00
fixtures prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
helpers prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
jobs models: require belong_to associations on champ 2020-08-18 15:57:37 +02:00
lib prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
mailers mailers: ignore more SMTP errors 2020-07-13 16:17:55 +02:00
middlewares specs: always require rails_helper 2020-03-31 12:48:32 +02:00
models validates phone champ server side 2020-08-20 15:33:03 +02:00
policies policies: fix champ policy for guest users 2020-04-02 11:27:14 +02:00
serializers models: require belong_to associations on champ 2020-08-18 15:57:37 +02:00
services prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
support spec: replace reference to ds in password 2020-07-23 16:20:16 +02:00
views views: allow unselecting all values from a multiple dropdown 2020-08-27 11:13:40 +02:00
rails_helper.rb specs: always require rails_helper 2020-03-31 12:48:32 +02:00
spec_helper.rb renommage des tests 2020-07-21 17:13:28 +02:00