@samitouri / QOS-React-2 / commits / 916ee6b394

jsx & JSDOM support

Thomas Aylott committed Nov 27, 2013 at 17:00 UTC 916ee6b3946dc2e79a7a1f932272c31d6936bf9f
2 files changed +8 -29
src/core/__tests__/ReactRenderDocument-test.js
+7 -28
@@ -40,10 +40,7 @@ describe('rendering React components at document', function() {
40 });
41
42 it('should be able to get root component id for document node', function() {
43 - if (!testDocument) {
44 - // These tests are not applicable in jst, since jsdom is buggy.
45 - return;
46 - }
43 + expect(testDocument).not.toBeUndefined();
44
45 var Root = React.createClass({
46 render: function() {
@@ -69,10 +66,7 @@ describe('rendering React components at document', function() {
66 });
67
68 it('should be able to unmount component from document node', function() {
72 - if (!testDocument) {
73 - // These tests are not applicable in jst, since jsdom is buggy.
74 - return;
75 - }
69 + expect(testDocument).not.toBeUndefined();
70
71 var Root = React.createClass({
72 render: function() {
@@ -100,10 +94,7 @@ describe('rendering React components at document', function() {
94 });
95
96 it('should be able to switch root constructors via state', function() {
103 - if (!testDocument) {
104 - // These tests are not applicable in jst, since jsdom is buggy.
105 - return;
106 - }
97 + expect(testDocument).not.toBeUndefined();
98
99 var Component = React.createClass({
100 render: function() {
@@ -162,10 +153,7 @@ describe('rendering React components at document', function() {
153 });
154
155 it('should be able to switch root constructors', function() {
165 - if (!testDocument) {
166 - // These tests are not applicable in jst, since jsdom is buggy.
167 - return;
168 - }
156 + expect(testDocument).not.toBeUndefined();
157
158 var Component = React.createClass({
159 render: function() {
@@ -210,10 +198,7 @@ describe('rendering React components at document', function() {
198 });
199
200 it('should be able to mount into document', function() {
213 - if (!testDocument) {
214 - // These tests are not applicable in jst, since jsdom is buggy.
215 - return;
216 - }
201 + expect(testDocument).not.toBeUndefined();
202
203 var Component = React.createClass({
204 render: function() {
@@ -236,10 +221,7 @@ describe('rendering React components at document', function() {
221 });
222
223 it('should throw on full document render', function() {
239 - if (!testDocument) {
240 - // These tests are not applicable in jst, since jsdom is buggy.
241 - return;
242 - }
224 + expect(testDocument).not.toBeUndefined();
225
226 var container = testDocument;
227 expect(function() {
@@ -255,10 +237,7 @@ describe('rendering React components at document', function() {
237 });
238
239 it('should throw on full document render of non-html', function() {
258 - if (!testDocument) {
259 - // These tests are not applicable in jst, since jsdom is buggy.
260 - return;
261 - }
240 + expect(testDocument).not.toBeUndefined();
241
242 var container = testDocument;
243 ReactMount.allowFullPageRender = true;
src/test/getTestDocument.js
+1 -1
@@ -23,7 +23,7 @@ function getTestDocument() {
23
24 var testDocument = iframe.contentDocument || iframe.contentWindow.document;
25 testDocument.open();
26 - testDocument.write('<!doctype html><meta charset=utf-8><title>test doc</title>');
26 + testDocument.write('<!doctype html><html><meta charset=utf-8><title>test doc</title>');
27 testDocument.close();
28
29 iframe.parentNode.removeChild(iframe);