mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #609 from subtleGradient/subtlegradient/fixes-ios-crasher
fixes iOS crasher
This commit is contained in:
@@ -40,10 +40,7 @@ describe('rendering React components at document', function() {
|
||||
});
|
||||
|
||||
it('should be able to get root component id for document node', function() {
|
||||
if (!testDocument) {
|
||||
// These tests are not applicable in jst, since jsdom is buggy.
|
||||
return;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var Root = React.createClass({
|
||||
render: function() {
|
||||
@@ -69,10 +66,7 @@ describe('rendering React components at document', function() {
|
||||
});
|
||||
|
||||
it('should be able to unmount component from document node', function() {
|
||||
if (!testDocument) {
|
||||
// These tests are not applicable in jst, since jsdom is buggy.
|
||||
return;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var Root = React.createClass({
|
||||
render: function() {
|
||||
@@ -100,10 +94,7 @@ describe('rendering React components at document', function() {
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var Component = React.createClass({
|
||||
render: function() {
|
||||
@@ -162,10 +153,7 @@ 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;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var Component = React.createClass({
|
||||
render: function() {
|
||||
@@ -210,10 +198,7 @@ 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;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var Component = React.createClass({
|
||||
render: function() {
|
||||
@@ -236,10 +221,7 @@ 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;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var container = testDocument;
|
||||
expect(function() {
|
||||
@@ -255,10 +237,7 @@ 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;
|
||||
}
|
||||
expect(testDocument).not.toBeUndefined();
|
||||
|
||||
var container = testDocument;
|
||||
ReactMount.allowFullPageRender = true;
|
||||
|
||||
+11
-11
@@ -16,18 +16,18 @@
|
||||
* @providesModule getTestDocument
|
||||
*/
|
||||
|
||||
/**
|
||||
* We need to work around the fact that we have two different
|
||||
* test implementations: once that breaks if we clobber document
|
||||
* (open-source) and one that doesn't support createHTMLDocument()
|
||||
* (jst).
|
||||
*/
|
||||
function getTestDocument() {
|
||||
if (document.implementation &&
|
||||
document.implementation.createHTMLDocument) {
|
||||
return document.implementation.createHTMLDocument('test doc');
|
||||
}
|
||||
return null;
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var testDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||
testDocument.open();
|
||||
testDocument.write('<!doctype html><html><meta charset=utf-8><title>test doc</title>');
|
||||
testDocument.close();
|
||||
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
return testDocument;
|
||||
}
|
||||
|
||||
module.exports = getTestDocument;
|
||||
|
||||
Reference in New Issue
Block a user