iabw/fork_of_backbone-forms — pull request #1 by iabw (2014-08-27 13:41:37+00:00)
Title: don't clobber editor defaultValue by setting options.value to 'null'

Referencing - https://github.com/powmedia/backbone-forms/issues/395

The tests didn't show this problem with the list editor, because of calling addItem directly and passing no value, whereas (as Tim points out), clicking the add button adds it with 'null', which over-rides the default value.

There doesn't appear to be a test for the click to add process, and I'm hesitant to add one because I haven't used sinon before, and am not sure what special requirements it might need for simulating events.

There is also a very similar problem with normal editors, when created by a Form.
https://github.com/powmedia/backbone-forms/blob/master/src/form.js#L114-L120

##### Functional Changes
- made List add button click pass undefined instead of null
- made Form 'createField' method set options value to undefined instead of null

##### Test Changes
- added Form tests to create schemas with a defaultValue and make sure it wasn't being clobbered
- added an Editor test to look for defaultValue other than null
- this one doesn't strictly do anything, since the problem was only for an editor created via a Form, but checking only for defaultValues of null might not actually be very revealing.
- added a List test for an editor itemType with a defaultValue

If you rollback the functional changes, you can see the new tests failing.

Is it bad etiquette to have a PR spammed with whitespace diffs? I'm not sure how to get rid of it!