fix log spew from ReactDOMTextarea test
Similar to previous but for textarea. If `value` is set, we have to also set `onChange` to avoid warnings.
Jan Kassens committed
Apr 21, 2014 at 15:41 UTC
4c199daa26d529f411c258d88254b0c396b9ac26
1 file changed
+9
-10
src/browser/ui/dom/components/__tests__/ReactDOMTextarea-test.js
+9
-10
@@ -19,8 +19,7 @@
19
20
"use strict";
21
22
-/*jshint evil:true */
23
-
22
+var emptyFunction = require('emptyFunction');
23
var mocks = require('mocks');
24
25
describe('ReactDOMTextarea', function() {
@@ -95,29 +94,29 @@ describe('ReactDOMTextarea', function() {
94
});
95
96
it('should allow setting `value` to `giraffe`', function() {
98
- var stub = <textarea value="giraffe" />;
97
+ var stub = <textarea value="giraffe" onChange={emptyFunction} />;
98
stub = renderTextarea(stub);
99
var node = stub.getDOMNode();
100
101
expect(node.value).toBe('giraffe');
102
104
- stub.replaceProps({value: 'gorilla'});
103
+ stub.replaceProps({value: 'gorilla', onChange: emptyFunction});
104
expect(node.value).toEqual('gorilla');
105
});
106
107
it('should allow setting `value` to `true`', function() {
109
- var stub = <textarea value="giraffe" />;
108
+ var stub = <textarea value="giraffe" onChange={emptyFunction} />;
109
stub = renderTextarea(stub);
110
var node = stub.getDOMNode();
111
112
expect(node.value).toBe('giraffe');
113
115
- stub.replaceProps({value: true});
114
+ stub.replaceProps({value: true, onChange: emptyFunction});
115
expect(node.value).toEqual('true');
116
});
117
118
it('should allow setting `value` to `false`', function() {
120
- var stub = <textarea value="giraffe" />;
119
+ var stub = <textarea value="giraffe" onChange={emptyFunction} />;
120
stub = renderTextarea(stub);
121
var node = stub.getDOMNode();
122
@@ -128,7 +127,7 @@ describe('ReactDOMTextarea', function() {
127
});
128
129
it('should allow setting `value` to `objToString`', function() {
131
- var stub = <textarea value="giraffe" />;
130
+ var stub = <textarea value="giraffe" onChange={emptyFunction} />;
131
stub = renderTextarea(stub);
132
var node = stub.getDOMNode();
133
@@ -139,12 +138,12 @@ describe('ReactDOMTextarea', function() {
138
return "foo";
139
}
140
};
142
- stub.replaceProps({value: objToString});
141
+ stub.replaceProps({value: objToString, onChange: emptyFunction});
142
expect(node.value).toEqual('foo');
143
});
144
145
it('should properly control a value of number `0`', function() {
147
- var stub = <textarea value={0} />;
146
+ var stub = <textarea value={0} onChange={emptyFunction} />;
147
stub = renderTextarea(stub);
148
var node = stub.getDOMNode();
149