mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix EnterLeaveEventPlugin Test in jsdom
This is a follow-up to #803. In jsdom (used for internal testing), `<iframe>` does not properly create a default document. This makes the `EnterLeaveEventPlugin` tests work for jsdom, too. Open source does not need this because it uses PhantomJS.
This commit is contained in:
committed by
Paul O’Shannessy
parent
49d6d2169d
commit
73d9d286ee
@@ -17,6 +17,8 @@
|
||||
* @emails react-core
|
||||
*/
|
||||
|
||||
/*jslint evil: true */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EnterLeaveEventPlugin;
|
||||
@@ -42,7 +44,13 @@ describe('EnterLeaveEventPlugin', function() {
|
||||
var iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var component = React.renderComponent(<div />, iframe.contentDocument.body);
|
||||
var iframeDocument = iframe.contentDocument;
|
||||
|
||||
if (!iframeDocument.innerHTML) {
|
||||
iframeDocument.innerHTML = '<html><head></head><body></body></html>';
|
||||
}
|
||||
|
||||
var component = React.renderComponent(<div />, iframeDocument.body);
|
||||
var div = component.getDOMNode();
|
||||
|
||||
var extracted = EnterLeaveEventPlugin.extractEvents(
|
||||
|
||||
Reference in New Issue
Block a user