@samitouri / QOS-React-2 / commits / 8857e12c9e

Use main document for getTestDocument

This should be fine in a jest environment, which is all we really care about now.

Paul O’Shannessy committed Sep 18, 2015 at 11:09 UTC 8857e12c9ee79384b56d7a08abda1abe23cda49c
1 file changed +4 -11
src/test/getTestDocument.js
+4 -11
@@ -12,19 +12,12 @@
12 'use strict';
13
14 function getTestDocument(markup) {
15 - var iframe = document.createElement('iframe');
16 - iframe.style.display = 'none';
17 - document.body.appendChild(iframe);
18 -
19 - var testDocument = iframe.contentDocument || iframe.contentWindow.document;
20 - testDocument.open();
21 - testDocument.write(
15 + document.open();
16 + document.write(
17 markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>'
18 );
24 - testDocument.close();
25 -
26 - iframe.parentNode.removeChild(iframe);
27 - return testDocument;
19 + document.close();
20 + return document;
21 }
22
23 module.exports = getTestDocument;