This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 173
173
var eventType = getEventForInputType ( input ) ;
174
174
175
175
function eventHandler ( ) {
176
- observable . setValue ( input [ property ] ) ;
176
+ if ( property == 'value' && input . type == 'number' )
177
+ observable . setValue ( input . valueAsNumber ) ;
178
+ else
179
+ observable . setValue ( input [ property ] ) ;
180
+
177
181
observable . discardChanges ( ) ;
178
182
( postEventFn || noop ) ( input ) ;
179
183
Platform . performMicrotaskCheckpoint ( ) ;
Original file line number Diff line number Diff line change @@ -652,6 +652,22 @@ suite('Form Element Bindings', function() {
652
652
radioInputCheckedMultipleForms ( shadowRoot , done ) ;
653
653
} ) ;
654
654
655
+ test ( '(Number)Input.number' , function ( done ) {
656
+ var input = testDiv . appendChild ( document . createElement ( 'input' ) ) ;
657
+ testDiv . appendChild ( input ) ;
658
+ input . type = 'number' ;
659
+ var model = { x : 0 } ;
660
+ bindings . push ( input . bind ( 'value' , new PathObserver ( model , 'x' ) ) ) ;
661
+ input . value = "999" ;
662
+
663
+ then ( function ( ) {
664
+ dispatchEvent ( 'input' , input ) ;
665
+ assert . isNumber ( model . x ) ;
666
+ assert . strictEqual ( 999 , model . x ) ;
667
+ done ( ) ;
668
+ } ) ;
669
+ } ) ;
670
+
655
671
test ( 'Select.selectedIndex' , function ( done ) {
656
672
var select = testDiv . appendChild ( document . createElement ( 'select' ) ) ;
657
673
testDiv . appendChild ( select ) ;
You can’t perform that action at this time.
0 commit comments