peerigon / alamid

Framework for RESTful JavaScript web applications that run both on the server- and clientside.
http://www.alamidjs.com
MIT License
23 stars 3 forks source link

Casting of Booleans #125

Closed topa closed 12 years ago

topa commented 12 years ago

For refactoring of View.class I've also refactored it's tests. So I've implemented the FormModel with it's schema formSchema.

This is a property of the Model defined in schema:


"checkbox": {

     "type": Boolean,
     "required": true,
     "default": false

},

But in the test occurred a problem. It seems that the default value of the checkbox and radio is not false but "false". For the moment I had to comment some parts of the View.class.test. I've marked this parts with code>//@TODO</code Is there any issue or lack of support of casting for Booleans in the Model-Class? Did I something wrong?

@meaku could you please help me with this one?

meaku commented 12 years ago

So the default-value of the Schema false was casted to "false" by the Model-Class? Or is the default value of the checkbox in the dom "false" which doesn't get casted to false?

I'm not sure if i understood your problem.

Alamid doesn't cast "false" to false, because we keep it the native JavaScript-way.

I would prefer handling such stuff in the applications-code (like in the view in this case), because i don't like changing the way javascript handles the "false" string. It might confuse others if we change it. Although i agree it's stupid of JavaScript not to accept "false" as boolean false.

topa commented 12 years ago

If the esacpe-question of commit above is clear, we can close this issue.

topa commented 12 years ago

This commit closes this issue: https://github.com/peerigon/alamid/commit/e4727f89ee3f7c95771599a24b98b38381604167