mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
tests for displaying defaultValue of 0
This commit is contained in:
1 parent
1b747c526c
commit
d5989a0de4
1 file changed
+47
@@ -51,6 +51,13 @@ describe('ReactDOMTextarea', function() {
|
||||
expect(node.value).toEqual('giraffe');
|
||||
});
|
||||
|
||||
it('should display `defaultValue` of number 0', function() {
|
||||
var stub = <textarea defaultValue={0} />;
|
||||
var node = renderTextarea(stub);
|
||||
|
||||
expect(node.value).toBe('0');
|
||||
});
|
||||
|
||||
it('should allow setting `value`', function() {
|
||||
var stub = <textarea value="giraffe" />;
|
||||
var node = renderTextarea(stub);
|
||||
@@ -61,6 +68,13 @@ describe('ReactDOMTextarea', function() {
|
||||
expect(node.value).toEqual('gorilla');
|
||||
});
|
||||
|
||||
it('should display `value` of number 0', function() {
|
||||
var stub = <textarea value={0} />;
|
||||
var node = renderTextarea(stub);
|
||||
|
||||
expect(node.value).toBe('0');
|
||||
});
|
||||
|
||||
it('should treat children like `defaultValue`', function() {
|
||||
spyOn(console, 'warn');
|
||||
|
||||
@@ -102,3 +116,36 @@ describe('ReactDOMTextarea', function() {
|
||||
expect(console.warn.argsForCall.length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReactDOMInput', function() {
|
||||
var React;
|
||||
var ReactTestUtils;
|
||||
|
||||
var renderTextarea;
|
||||
|
||||
beforeEach(function() {
|
||||
React = require('React');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
|
||||
renderTextarea = function(component) {
|
||||
var stub = ReactTestUtils.renderIntoDocument(component);
|
||||
var node = stub.getDOMNode();
|
||||
return node;
|
||||
};
|
||||
});
|
||||
|
||||
it('should display `defaultValue` of number 0', function() {
|
||||
var stub = <input type="text" defaultValue={0} />;
|
||||
var node = renderTextarea(stub);
|
||||
|
||||
expect(node.value).toBe('0');
|
||||
});
|
||||
|
||||
it('should display `value` of number 0', function() {
|
||||
var stub = <input type="text" value={0} />;
|
||||
var node = renderTextarea(stub);
|
||||
|
||||
expect(node.value).toBe('0');
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user