',
+ );
textCache = new Map();
- // Test Environment
- const jsdom = new JSDOM(
- '
',
- {
- runScripts: 'dangerously',
- },
- );
- document = jsdom.window.document;
container = document.getElementById('container');
buffer = '';
@@ -129,10 +147,8 @@ describe('ReactDOMFloat', () => {
// We assume that we have now received a proper fragment of HTML.
const bufferedContent = buffer;
// Test Environment
- const jsdom = new JSDOM(bufferedContent, {
- runScripts: 'dangerously',
- });
- document = jsdom.window.document;
+ resetModules(bufferedContent);
+
container = document;
buffer = '';
}
@@ -394,16 +410,14 @@ describe('ReactDOMFloat', () => {
ReactDOM.preload('foo', {as: 'style'});
ReactDOMClient.createRoot(container);
ReactDOM.preload('bar', {as: 'style'});
- // We need to use global.document because preload falls back
- // to the window.document global when no other documents have been used
- // The way the JSDOM runtim is created for these tests the local document
- // global does not point to the global.document
- expect(getVisibleChildren(global.document)).toEqual(
+ expect(getVisibleChildren(document)).toEqual(
-
foo
-
,
);
@@ -537,16 +550,14 @@ describe('ReactDOMFloat', () => {
ReactDOM.preinit('foo', {as: 'style'});
ReactDOMClient.hydrateRoot(container, null);
ReactDOM.preinit('bar', {as: 'style'});
- // We need to use global.document because preload falls back
- // to the window.document global when no other documents have been used
- // The way the JSDOM runtim is created for these tests the local document
- // global does not point to the global.document
- expect(getVisibleChildren(global.document)).toEqual(
+ expect(getVisibleChildren(document)).toEqual(
-
+