Created
November 5, 2011 23:25
-
-
Save dnagir/1342183 to your computer and use it in GitHub Desktop.
Model spec for boolean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("can understand checkboxes as booleans", function(){ | |
var form = $('<form />'); | |
form.append('<input name="available" value="1" checked="checked" />'); | |
var asset = Asset.fromForm(form); | |
expect(asset.available).toEqual(true); | |
form.find('input').prop('checked', false); | |
expect(Asset.fromForm(form).available).toEqual(false); | |
}); | |
// Or otherwise you'd have to do inn each (coffee) model something like: | |
// fromForm: (f) -> | |
// super | |
// @available = @available == '1' # and for each boolean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment