Permalink
Browse files

Number editor: Set input type to 'number'

  • Loading branch information...
1 parent dde880d commit 3a67a77aa4c8107a2adb8e33fdc598916d6f8506 @powmedia committed Mar 22, 2012
Showing with 14 additions and 0 deletions.
  1. +6 −0 src/backbone-forms.js
  2. +8 −0 test/editors.js
@@ -941,6 +941,12 @@
'keypress': 'onKeyPress'
},
+ initialize: function(options) {
+ editors.Text.prototype.initialize.call(this, options);
+
+ this.$el.attr('type', 'number');
+ },
+
/**
* Check value is numeric
*/
View
@@ -199,6 +199,14 @@ module('Number');
deepEqual(field.getValue(), 99);
});
+
+ test('Sets input type to "number"', function() {
+ var field = new editor({
+ value: 123
+ }).render();
+
+ deepEqual(field.$el.attr('type'), 'number');
+ });
test("TODO: Restricts non-numeric characters", function() {
console.log('TODO')

0 comments on commit 3a67a77

Please sign in to comment.