RCFilters: Fix validation for single_option groups
authorMoriel Schottlender <moriel@gmail.com>
Thu, 17 Aug 2017 18:27:44 +0000 (11:27 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Thu, 17 Aug 2017 18:33:36 +0000 (11:33 -0700)
commit4f6624451aa979a49840a10071cac75a1a5aae80
tree13cbb049615cc6ab2e24919112133b341c16878b
parentebcb7aef37d54d8d8fea75ca0156a010f2fd0c9a
RCFilters: Fix validation for single_option groups

The single_option groups have a base definition that means they
always must have a value, and must never have more than one value.
The previous way we attempted to do that was confusing and missed
a case where after resetting filters, two values were selected before
one could be unselected, which then broke the behavior in the
entire group.

This fix reorganizes the validation when an item in the group is
selected or unselected to make sure the group retains its promised
behavior.

Bug: T173303
Change-Id: I5758ec324a26c0e5e6f5c473d206e818a1d22523
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterGroup.js