@samitouri / QOS-React-2 / commits / 748ed6cd81

adding better test - moving execution env module.

Jordan Walke committed Aug 23, 2013 at 12:32 UTC 748ed6cd818a7b18c5ea020265844d6713533452
3 files changed +19 -3
src/core/ReactComponentBrowserEnvironment.js
+1 -1
@@ -85,7 +85,7 @@ var ReactComponentBrowserEnvironment = {
85 container.nodeType === ELEMENT_NODE_TYPE ||
86 container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender
87 ),
88 - 'mountComponentIntoNode(...): Target container is not a DOM element.'
88 + 'mountComponentIntoNode(...): Target container is not valid.'
89 );
90 if (shouldReuseMarkup) {
91 if (ReactMarkupChecksum.canReuseMarkup(
src/core/__tests__/ReactComponent-test.js
+18 -2
@@ -20,6 +20,7 @@
20 "use strict";
21
22 var React;
23 +var ReactMount;
24 var ReactTestUtils;
25
26 var reactComponentExpect;
@@ -27,10 +28,25 @@ var reactComponentExpect;
28 describe('ReactComponent', function() {
29 beforeEach(function() {
30 React = require('React');
31 + ReactMount = require('ReactMount');
32 ReactTestUtils = require('ReactTestUtils');
33 reactComponentExpect = require('reactComponentExpect');
34 });
35
36 + it('should not throw on full document rendering', function() {
37 + var container = {nodeType: 9};
38 + expect(function() {
39 + React.renderComponent(<div></div>, container);
40 + }).toThrow(
41 + 'Invariant Violation: mountComponentIntoNode(...): Target container is ' +
42 + 'not valid.'
43 + );
44 + ReactMount.allowFullPageRender = true;
45 + expect(function() {
46 + React.renderComponent(<div></div>, container);
47 + }).not.toThrow();
48 + });
49 +
50 it('should throw on invalid render targets', function() {
51 var container = document.createElement('div');
52 // jQuery objects are basically arrays; people often pass them in by mistake
@@ -38,14 +54,14 @@ describe('ReactComponent', function() {
54 React.renderComponent(<div></div>, [container]);
55 }).toThrow(
56 'Invariant Violation: mountComponentIntoNode(...): Target container is ' +
41 - 'not a DOM element.'
57 + 'not valid.'
58 );
59
60 expect(function() {
61 React.renderComponent(<div></div>, null);
62 }).toThrow(
63 'Invariant Violation: mountComponentIntoNode(...): Target container is ' +
48 - 'not a DOM element.'
64 + 'not valid.'
65 );
66 });
67
src/vendor/core/ExecutionEnvironment.js renamed