Fix ReactRenderDocument tests
I am unsure how this was ever supposed to work, as testDocument is guaranteed to be undefined at that point since beforeEach doesn't run synchronously. (I don't think there's any way to have beforeEach halt the tests.)
Ben Alpert committed
Sep 10, 2013 at 22:42 UTC
fea4fec0bc3cd72b57cc65e75ef6ba2131cdedcb
1 file changed
+25
-5
src/core/__tests__/ReactRenderDocument-test.js
+25
-5
@@ -37,12 +37,12 @@ describe('rendering React components at document', function() {
37
testDocument = getTestDocument();
38
});
39
40
- if (!testDocument) {
41
- // These tests are not applicable in jst, since jsdom is buggy.
42
- return;
43
- }
44
-
40
it('should be able to switch root constructors via state', function() {
41
+ if (!testDocument) {
42
+ // These tests are not applicable in jst, since jsdom is buggy.
43
+ return;
44
+ }
45
+
46
var Component = React.createClass({
47
render: function() {
48
return (
@@ -100,6 +100,11 @@ describe('rendering React components at document', function() {
100
});
101
102
it('should be able to switch root constructors', function() {
103
+ if (!testDocument) {
104
+ // These tests are not applicable in jst, since jsdom is buggy.
105
+ return;
106
+ }
107
+
108
var Component = React.createClass({
109
render: function() {
110
return (
@@ -143,6 +148,11 @@ describe('rendering React components at document', function() {
148
});
149
150
it('should be able to mount into document', function() {
151
+ if (!testDocument) {
152
+ // These tests are not applicable in jst, since jsdom is buggy.
153
+ return;
154
+ }
155
+
156
var Component = React.createClass({
157
render: function() {
158
return (
@@ -164,6 +174,11 @@ describe('rendering React components at document', function() {
174
});
175
176
it('should throw on full document render', function() {
177
+ if (!testDocument) {
178
+ // These tests are not applicable in jst, since jsdom is buggy.
179
+ return;
180
+ }
181
+
182
var container = testDocument;
183
expect(function() {
184
React.renderComponent(<html />, container);
@@ -178,6 +193,11 @@ describe('rendering React components at document', function() {
193
});
194
195
it('should throw on full document render of non-html', function() {
196
+ if (!testDocument) {
197
+ // These tests are not applicable in jst, since jsdom is buggy.
198
+ return;
199
+ }
200
+
201
var container = testDocument;
202
ReactMount.allowFullPageRender = true;
203
expect(function() {