Skip to content

Commit b1e16b9

Browse files
committed
React -> ReactDOM in test files
1 parent 31cb102 commit b1e16b9

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ of patent rights can be found in the PATENTS file in the same directory.
88
###
99

1010
React = null
11+
ReactDOM = null
1112

1213
describe 'ReactCoffeeScriptClass', ->
1314
div = null
@@ -19,6 +20,7 @@ describe 'ReactCoffeeScriptClass', ->
1920

2021
beforeEach ->
2122
React = require 'React'
23+
ReactDOM = require 'ReactDOM'
2224
container = document.createElement 'div'
2325
attachedListener = null
2426
renderedName = null
@@ -33,7 +35,7 @@ describe 'ReactCoffeeScriptClass', ->
3335
Inner = React.createFactory InnerComponent
3436

3537
test = (element, expectedTag, expectedClassName) ->
36-
instance = React.render(element, container)
38+
instance = ReactDOM.render(element, container)
3739
expect(container.firstChild).not.toBeNull()
3840
expect(container.firstChild.tagName).toBe(expectedTag)
3941
expect(container.firstChild.className).toBe(expectedClassName)
@@ -47,7 +49,7 @@ describe 'ReactCoffeeScriptClass', ->
4749
spyOn console, 'error'
4850
class Foo extends React.Component
4951
expect(->
50-
React.render React.createElement(Foo), container
52+
ReactDOM.render React.createElement(Foo), container
5153
).toThrow()
5254
expect(console.error.calls.length).toBe(1)
5355
expect(console.error.calls[0].args[0]).toContain('No `render` method found on the returned component instance')
@@ -262,7 +264,7 @@ describe 'ReactCoffeeScriptClass', ->
262264
'did-update', { value: 'foo' }, {}
263265
]
264266
lifeCycles = [] # reset
265-
React.unmountComponentAtNode container
267+
ReactDOM.unmountComponentAtNode container
266268
expect(lifeCycles).toEqual ['will-unmount']
267269

268270
it 'warns when classic properties are defined on the instance,
@@ -394,5 +396,5 @@ describe 'ReactCoffeeScriptClass', ->
394396

395397
it 'supports drilling through to the DOM using findDOMNode', ->
396398
instance = test Inner(name: 'foo'), 'DIV', 'foo'
397-
node = React.findDOMNode(instance)
399+
node = ReactDOM.findDOMNode(instance)
398400
expect(node).toBe container.firstChild

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ describe('ReactDOMComponent', function() {
729729
});
730730

731731
expect(function() {
732-
React.render(<Animal/>, container);
732+
ReactDOM.render(<Animal/>, container);
733733
}).toThrow(
734734
'Invariant Violation: The `style` prop expects a mapping from style ' +
735735
'properties to values, not a string. For example, ' +

src/renderers/shared/reconciler/__tests__/ReactStatelessComponent-test.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'use strict';
1313

1414
var React;
15+
var ReactDOM;
1516
var ReactTestUtils;
1617

1718
function StatelessComponent(props) {
@@ -22,12 +23,13 @@ describe('ReactStatelessComponent', function() {
2223

2324
beforeEach(function() {
2425
React = require('React');
26+
ReactDOM = require('ReactDOM');
2527
ReactTestUtils = require('ReactTestUtils');
2628
});
2729

2830
it('should render stateless component', function() {
2931
var el = document.createElement('div');
30-
React.render(<StatelessComponent name="A" />, el);
32+
ReactDOM.render(<StatelessComponent name="A" />, el);
3133

3234
expect(el.textContent).toBe('A');
3335
});
@@ -40,20 +42,20 @@ describe('ReactStatelessComponent', function() {
4042
});
4143

4244
var el = document.createElement('div');
43-
React.render(<Parent name="A" />, el);
45+
ReactDOM.render(<Parent name="A" />, el);
4446
expect(el.textContent).toBe('A');
4547

46-
React.render(<Parent name="B" />, el);
48+
ReactDOM.render(<Parent name="B" />, el);
4749
expect(el.textContent).toBe('B');
4850
});
4951

5052
it('should unmount stateless component', function() {
5153
var container = document.createElement('div');
5254

53-
React.render(<StatelessComponent name="A" />, container);
55+
ReactDOM.render(<StatelessComponent name="A" />, container);
5456
expect(container.textContent).toBe('A');
5557

56-
React.unmountComponentAtNode(container);
58+
ReactDOM.unmountComponentAtNode(container);
5759
expect(container.textContent).toBe('');
5860
});
5961

@@ -87,11 +89,11 @@ describe('ReactStatelessComponent', function() {
8789
});
8890

8991
var el = document.createElement('div');
90-
React.render(<GrandParent test="test" />, el);
92+
ReactDOM.render(<GrandParent test="test" />, el);
9193

9294
expect(el.textContent).toBe('test');
9395

94-
React.render(<GrandParent test="mest" />, el);
96+
ReactDOM.render(<GrandParent test="mest" />, el);
9597

9698
expect(el.textContent).toBe('mest');
9799
});
@@ -106,7 +108,7 @@ describe('ReactStatelessComponent', function() {
106108
}
107109

108110
var el = document.createElement('div');
109-
React.render(<Child test="test" />, el);
111+
ReactDOM.render(<Child test="test" />, el);
110112

111113
expect(el.textContent).toBe('test');
112114
});
@@ -178,7 +180,7 @@ describe('ReactStatelessComponent', function() {
178180
Child.contextTypes = {lang: React.PropTypes.string};
179181

180182
var el = document.createElement('div');
181-
React.render(<Parent />, el);
183+
ReactDOM.render(<Parent />, el);
182184
expect(el.textContent).toBe('en');
183185
});
184186
});

src/test/__tests__/ReactTestUtils-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ describe('ReactTestUtils', function() {
338338
it('should change the value of an input field', function() {
339339
var handler = jasmine.createSpy('spy');
340340
var container = document.createElement('div');
341-
var instance = React.render(<input type="text" onChange={handler} />, container);
341+
var instance = ReactDOM.render(<input type="text" onChange={handler} />, container);
342342

343-
var node = React.findDOMNode(instance);
343+
var node = ReactDOM.findDOMNode(instance);
344344
node.value = 'giraffe';
345345
ReactTestUtils.Simulate.change(node);
346346

@@ -360,9 +360,9 @@ describe('ReactTestUtils', function() {
360360

361361
var handler = jasmine.createSpy('spy');
362362
var container = document.createElement('div');
363-
var instance = React.render(<SomeComponent handleChange={handler} />, container);
363+
var instance = ReactDOM.render(<SomeComponent handleChange={handler} />, container);
364364

365-
var node = React.findDOMNode(instance.refs.input);
365+
var node = ReactDOM.findDOMNode(instance.refs.input);
366366
node.value = 'zebra';
367367
ReactTestUtils.Simulate.change(node);
368368

0 commit comments

Comments
 (0)