Anahkiasen/former — pull request #163 by petercoles (2013-07-10 07:56:18+00:00)
Title: User-defined checkbox values being overwritten when unchecked value is zero.

When the unchecked value is integer zero (which is the the Former default) the recently loosened comparison in createCheckable() reduces string values to their integer equivalent for comparison to the unchecked version. The integer value of most strings is zero, causing createCheckable to wrongly equate them to the unchecked value and over-write the user-defined value with the fallback.

This wasn't being caught by the existing tests as they were all using strings for the unchecked value, so this pull request includes a new test to illustrate the issue, and that change reversed.

The loosening of the comparison appears to have been made recently to address a re-population issue. However, the associated test is the victim of the same typeless comparison. By populating with a value of false, that comparison finds itself executing false == '' for the existing tests or false == 0 with the new test, both of which return true, causing the fallback value to be used. So the test currently passes, not because the original value (true => 1) is not re-populated, but because it is repopulated with the same value (fallback => 1).

Changing the populated values to 'bar' and 'baz' and executing confirms this. So this pull request suspends the test as the it appears that the repopulating issue needs more attention.