gwtchosen
gwtchosen copied to clipboard
Allow null values to be treated as deselect options.
When a renderer doesn't render null as an empty string "" the setting allowSingleDeselect doesn't take effect. Therefore, when ChosenValueListBox encounters a null value it passes an empty string as the list box item's value. ChosenImpl now looks at the
It seems we have a failing test in master. I'll check that.
The test that is failing is tabNavigation in ChosenIT. I think it's because you are changing the behaviour of ChosenValueListBox.
Could you fix the failing test or make sure that it still passes (depending on what is relevant)?
On my local machine the test fails from master, I'm not sure if it is a version issue with Chrome/ChromeDriver, can you force a rebuild of master in team city to rule that out?
Still failing after forcing the rebuild.
What's the use case? I'm not sure I understand why you cannot use the current placeholder functionality? You want to allow "" value to have the same meaning as null for the placeholder?
master fails on the same test http://teamcity.arcbees.com/viewLog.html?buildId=6239&tab=buildResultsDiv&buildTypeId=GwtChosen_MonitorPulls.
The issue is that in order for allowSingleDeselect to actually be active the first item in the
It seems you are doing this pull request to bypass how the placeholder is handled. You are using the renderer to render a value as the placeholder, but in reality, you should use the setPlaceholderText on your ChosenOptions. @jDramaix Thoughts?
This is separate from a placeholder. With ChosenValueListBox one must add a null value to acceptable values in order to have something to deselect to. Therefore the first item in acceptableValues is null. Now, before my change, ChosenImpl would only select the null value if it rendered as "" (an empty string). In my application null is rendered as "Select One", while the merits of rendering null as "" or "Select One" can be debated, I won't touch on that subject. This change makes it so a null value has its form value as "", and ChosenImpl is updated to check the form value instead of the text of the rendered item.
See https://github.com/ArcBees/gwtchosen/blob/d9eec8188c044dedfda7b0d15b12f4b1b41e7499/plugin/src/main/java/com/arcbees/chosen/client/gwt/BaseChosenValueListBox.java#L153 for more details about null being in the list.
Can I get some feedback on this? It is documented and fully tested, what else are you guys looking for?
@jDramaix to review
seems pretty straightforward. LGTM
@awaters-escribe could you fix the conflicts? After that we could merge that PR as we have an LGTM from @jDramaix
@jDramaix @olafleur merge conflicts have been fixed, and pr rebased on the latest.
the tests that are failing are:
DesktopChosenIT.allowSingleDeselect
MobileChosenIT.allowSingleDeselect
it is unclear from here whether these tests should be failing or not.