Skip to content

Commit 4c199da

Browse files
kassenszpao
authored andcommitted
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.
1 parent 089146b commit 4c199da

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/browser/ui/dom/components/__tests__/ReactDOMTextarea-test.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
"use strict";
2121

22-
/*jshint evil:true */
23-
22+
var emptyFunction = require('emptyFunction');
2423
var mocks = require('mocks');
2524

2625
describe('ReactDOMTextarea', function() {
@@ -95,29 +94,29 @@ describe('ReactDOMTextarea', function() {
9594
});
9695

9796
it('should allow setting `value` to `giraffe`', function() {
98-
var stub = <textarea value="giraffe" />;
97+
var stub = <textarea value="giraffe" onChange={emptyFunction} />;
9998
stub = renderTextarea(stub);
10099
var node = stub.getDOMNode();
101100

102101
expect(node.value).toBe('giraffe');
103102

104-
stub.replaceProps({value: 'gorilla'});
103+
stub.replaceProps({value: 'gorilla', onChange: emptyFunction});
105104
expect(node.value).toEqual('gorilla');
106105
});
107106

108107
it('should allow setting `value` to `true`', function() {
109-
var stub = <textarea value="giraffe" />;
108+
var stub = <textarea value="giraffe" onChange={emptyFunction} />;
110109
stub = renderTextarea(stub);
111110
var node = stub.getDOMNode();
112111

113112
expect(node.value).toBe('giraffe');
114113

115-
stub.replaceProps({value: true});
114+
stub.replaceProps({value: true, onChange: emptyFunction});
116115
expect(node.value).toEqual('true');
117116
});
118117

119118
it('should allow setting `value` to `false`', function() {
120-
var stub = <textarea value="giraffe" />;
119+
var stub = <textarea value="giraffe" onChange={emptyFunction} />;
121120
stub = renderTextarea(stub);
122121
var node = stub.getDOMNode();
123122

@@ -128,7 +127,7 @@ describe('ReactDOMTextarea', function() {
128127
});
129128

130129
it('should allow setting `value` to `objToString`', function() {
131-
var stub = <textarea value="giraffe" />;
130+
var stub = <textarea value="giraffe" onChange={emptyFunction} />;
132131
stub = renderTextarea(stub);
133132
var node = stub.getDOMNode();
134133

@@ -139,12 +138,12 @@ describe('ReactDOMTextarea', function() {
139138
return "foo";
140139
}
141140
};
142-
stub.replaceProps({value: objToString});
141+
stub.replaceProps({value: objToString, onChange: emptyFunction});
143142
expect(node.value).toEqual('foo');
144143
});
145144

146145
it('should properly control a value of number `0`', function() {
147-
var stub = <textarea value={0} />;
146+
var stub = <textarea value={0} onChange={emptyFunction} />;
148147
stub = renderTextarea(stub);
149148
var node = stub.getDOMNode();
150149

0 commit comments

Comments
 (0)