@samitouri / QOS-React-2 / commits / 86c0b69390

separate new tests into respective file

Cheng Lou committed Aug 12, 2013 at 16:52 UTC 86c0b69390e684e182728f0051a24f4a58e8a207
2 files changed +55 -33
src/dom/components/__tests__/ReactDOMInput-test.js new
+55
@@ -0,0 +1,55 @@
1 +/**
2 + * Copyright 2013 Facebook, Inc.
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + *
16 + * @jsx React.DOM
17 + * @emails react-core
18 + */
19 +
20 +"use strict";
21 +
22 +/*jshint evil:true */
23 +
24 +describe('ReactDOMInput', function() {
25 + var React;
26 + var ReactTestUtils;
27 +
28 + var renderTextInput;
29 +
30 + beforeEach(function() {
31 + React = require('React');
32 + ReactTestUtils = require('ReactTestUtils');
33 +
34 + renderTextInput = function(component) {
35 + var stub = ReactTestUtils.renderIntoDocument(component);
36 + var node = stub.getDOMNode();
37 + return node;
38 + };
39 + });
40 +
41 + it('should display `defaultValue` of number 0', function() {
42 + var stub = <input type="text" defaultValue={0} />;
43 + var node = renderTextInput(stub);
44 +
45 + expect(node.value).toBe('0');
46 + });
47 +
48 + it('should display `value` of number 0', function() {
49 + var stub = <input type="text" value={0} />;
50 + var node = renderTextInput(stub);
51 +
52 + expect(node.value).toBe('0');
53 + });
54 +
55 +});
src/dom/components/__tests__/ReactDOMTextarea-test.js
-33
@@ -116,36 +116,3 @@ describe('ReactDOMTextarea', function() {
116 expect(console.warn.argsForCall.length).toBe(2);
117 });
118 });
119 -
120 -describe('ReactDOMInput', function() {
121 - var React;
122 - var ReactTestUtils;
123 -
124 - var renderTextarea;
125 -
126 - beforeEach(function() {
127 - React = require('React');
128 - ReactTestUtils = require('ReactTestUtils');
129 -
130 - renderTextarea = function(component) {
131 - var stub = ReactTestUtils.renderIntoDocument(component);
132 - var node = stub.getDOMNode();
133 - return node;
134 - };
135 - });
136 -
137 - it('should display `defaultValue` of number 0', function() {
138 - var stub = <input type="text" defaultValue={0} />;
139 - var node = renderTextarea(stub);
140 -
141 - expect(node.value).toBe('0');
142 - });
143 -
144 - it('should display `value` of number 0', function() {
145 - var stub = <input type="text" value={0} />;
146 - var node = renderTextarea(stub);
147 -
148 - expect(node.value).toBe('0');
149 - });
150 -
151 -});