From fea4fec0bc3cd72b57cc65e75ef6ba2131cdedcb Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Tue, 10 Sep 2013 22:42:05 -0700 Subject: [PATCH] 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.) --- .../__tests__/ReactRenderDocument-test.js | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/core/__tests__/ReactRenderDocument-test.js b/src/core/__tests__/ReactRenderDocument-test.js index 9b4a93ad0ea..33331122f02 100644 --- a/src/core/__tests__/ReactRenderDocument-test.js +++ b/src/core/__tests__/ReactRenderDocument-test.js @@ -37,12 +37,12 @@ describe('rendering React components at document', function() { testDocument = getTestDocument(); }); - if (!testDocument) { - // These tests are not applicable in jst, since jsdom is buggy. - return; - } - it('should be able to switch root constructors via state', function() { + if (!testDocument) { + // These tests are not applicable in jst, since jsdom is buggy. + return; + } + var Component = React.createClass({ render: function() { return ( @@ -100,6 +100,11 @@ describe('rendering React components at document', function() { }); it('should be able to switch root constructors', function() { + if (!testDocument) { + // These tests are not applicable in jst, since jsdom is buggy. + return; + } + var Component = React.createClass({ render: function() { return ( @@ -143,6 +148,11 @@ describe('rendering React components at document', function() { }); it('should be able to mount into document', function() { + if (!testDocument) { + // These tests are not applicable in jst, since jsdom is buggy. + return; + } + var Component = React.createClass({ render: function() { return ( @@ -164,6 +174,11 @@ describe('rendering React components at document', function() { }); it('should throw on full document render', function() { + if (!testDocument) { + // These tests are not applicable in jst, since jsdom is buggy. + return; + } + var container = testDocument; expect(function() { React.renderComponent(, container); @@ -178,6 +193,11 @@ describe('rendering React components at document', function() { }); it('should throw on full document render of non-html', function() { + if (!testDocument) { + // These tests are not applicable in jst, since jsdom is buggy. + return; + } + var container = testDocument; ReactMount.allowFullPageRender = true; expect(function() {