@@ -271,7 +271,7 @@ describe('ReactDOMInput', () => {
271
271
272
272
dispatchEventOnNode ( node , 'input' ) ;
273
273
274
- expect ( node . getAttribute ( 'value' ) ) . toBe ( '2.0 ' ) ;
274
+ expect ( node . getAttribute ( 'value' ) ) . toBe ( '2' ) ;
275
275
expect ( node . value ) . toBe ( '2.0' ) ;
276
276
} ) ;
277
277
} ) ;
@@ -667,7 +667,7 @@ describe('ReactDOMInput', () => {
667
667
const node = container . firstChild ;
668
668
669
669
expect ( node . value ) . toBe ( '0' ) ;
670
- expect ( node . defaultValue ) . toBe ( '0 ' ) ;
670
+ expect ( node . defaultValue ) . toBe ( '' ) ;
671
671
} ) ;
672
672
673
673
it ( 'should properly transition from 0 to an empty value' , function ( ) {
@@ -683,7 +683,7 @@ describe('ReactDOMInput', () => {
683
683
const node = container . firstChild ;
684
684
685
685
expect ( node . value ) . toBe ( '' ) ;
686
- expect ( node . defaultValue ) . toBe ( '' ) ;
686
+ expect ( node . defaultValue ) . toBe ( '0 ' ) ;
687
687
} ) ;
688
688
689
689
it ( 'should properly transition a text input from 0 to an empty 0.0' , function ( ) {
@@ -699,7 +699,7 @@ describe('ReactDOMInput', () => {
699
699
const node = container . firstChild ;
700
700
701
701
expect ( node . value ) . toBe ( '0.0' ) ;
702
- expect ( node . defaultValue ) . toBe ( '0.0 ' ) ;
702
+ expect ( node . defaultValue ) . toBe ( '0' ) ;
703
703
} ) ;
704
704
705
705
it ( 'should properly transition a number input from "" to 0' , function ( ) {
@@ -715,7 +715,7 @@ describe('ReactDOMInput', () => {
715
715
const node = container . firstChild ;
716
716
717
717
expect ( node . value ) . toBe ( '0' ) ;
718
- expect ( node . defaultValue ) . toBe ( '0 ' ) ;
718
+ expect ( node . defaultValue ) . toBe ( '' ) ;
719
719
} ) ;
720
720
721
721
it ( 'should properly transition a number input from "" to "0"' , function ( ) {
@@ -731,7 +731,7 @@ describe('ReactDOMInput', () => {
731
731
const node = container . firstChild ;
732
732
733
733
expect ( node . value ) . toBe ( '0' ) ;
734
- expect ( node . defaultValue ) . toBe ( '0 ' ) ;
734
+ expect ( node . defaultValue ) . toBe ( '' ) ;
735
735
} ) ;
736
736
737
737
it ( 'should have the correct target value' , ( ) => {
@@ -1605,15 +1605,15 @@ describe('ReactDOMInput', () => {
1605
1605
} ;
1606
1606
}
1607
1607
1608
- it ( 'always sets the attribute when values change on text inputs' , function ( ) {
1608
+ it ( 'retains the initial value attribute when values change on text inputs' , function ( ) {
1609
1609
const Input = getTestInput ( ) ;
1610
1610
const stub = ReactDOM . render ( < Input type = "text" /> , container ) ;
1611
1611
const node = ReactDOM . findDOMNode ( stub ) ;
1612
1612
1613
1613
setUntrackedValue . call ( node , '2' ) ;
1614
1614
dispatchEventOnNode ( node , 'input' ) ;
1615
1615
1616
- expect ( node . getAttribute ( 'value' ) ) . toBe ( '2 ' ) ;
1616
+ expect ( node . getAttribute ( 'value' ) ) . toBe ( '' ) ;
1617
1617
} ) ;
1618
1618
1619
1619
it ( 'does not set the value attribute on number inputs if focused' , ( ) => {
@@ -1632,21 +1632,6 @@ describe('ReactDOMInput', () => {
1632
1632
expect ( node . getAttribute ( 'value' ) ) . toBe ( '1' ) ;
1633
1633
} ) ;
1634
1634
1635
- it ( 'sets the value attribute on number inputs on blur' , ( ) => {
1636
- const Input = getTestInput ( ) ;
1637
- const stub = ReactDOM . render (
1638
- < Input type = "number" value = "1" /> ,
1639
- container ,
1640
- ) ;
1641
- const node = ReactDOM . findDOMNode ( stub ) ;
1642
-
1643
- setUntrackedValue . call ( node , '2' ) ;
1644
- dispatchEventOnNode ( node , 'input' ) ;
1645
- dispatchEventOnNode ( node , 'blur' ) ;
1646
-
1647
- expect ( node . getAttribute ( 'value' ) ) . toBe ( '2' ) ;
1648
- } ) ;
1649
-
1650
1635
it ( 'an uncontrolled number input will not update the value attribute on blur' , ( ) => {
1651
1636
const node = ReactDOM . render (
1652
1637
< input type = "number" defaultValue = "1" /> ,
@@ -1784,7 +1769,7 @@ describe('ReactDOMInput', () => {
1784
1769
expect ( node . getAttribute ( 'value' ) ) . toBe ( '' ) ;
1785
1770
} ) ;
1786
1771
1787
- it ( 'treats updated Symbol value as an empty string ' , function ( ) {
1772
+ it ( 'treats updated Symbol value as initial value ' , function ( ) {
1788
1773
ReactDOM . render ( < input value = "foo" onChange = { ( ) => { } } /> , container ) ;
1789
1774
expect ( ( ) =>
1790
1775
ReactDOM . render (
@@ -1795,7 +1780,7 @@ describe('ReactDOMInput', () => {
1795
1780
const node = container . firstChild ;
1796
1781
1797
1782
expect ( node . value ) . toBe ( '' ) ;
1798
- expect ( node . getAttribute ( 'value' ) ) . toBe ( '' ) ;
1783
+ expect ( node . getAttribute ( 'value' ) ) . toBe ( 'foo ' ) ;
1799
1784
} ) ;
1800
1785
1801
1786
it ( 'treats initial Symbol defaultValue as an empty string' , function ( ) {
@@ -1832,7 +1817,7 @@ describe('ReactDOMInput', () => {
1832
1817
expect ( node . getAttribute ( 'value' ) ) . toBe ( '' ) ;
1833
1818
} ) ;
1834
1819
1835
- it ( 'treats updated function value as an empty string ' , function ( ) {
1820
+ it ( 'treats updated function value as initial value ' , function ( ) {
1836
1821
ReactDOM . render ( < input value = "foo" onChange = { ( ) => { } } /> , container ) ;
1837
1822
expect ( ( ) =>
1838
1823
ReactDOM . render (
@@ -1843,7 +1828,7 @@ describe('ReactDOMInput', () => {
1843
1828
const node = container . firstChild ;
1844
1829
1845
1830
expect ( node . value ) . toBe ( '' ) ;
1846
- expect ( node . getAttribute ( 'value' ) ) . toBe ( '' ) ;
1831
+ expect ( node . getAttribute ( 'value' ) ) . toBe ( 'foo ' ) ;
1847
1832
} ) ;
1848
1833
1849
1834
it ( 'treats initial function defaultValue as an empty string' , function ( ) {
0 commit comments