Open peterjwest opened 7 years ago
@peterjwest the recently released 1.1.0 version should allow you to do:
import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
renderSpyConfig.createFragment = () => undom().body;
This is documented here:
https://github.com/mzgoddard/preact-render-spy#configuration
I would be open to a PR making a change to the README with an example
import undom from 'undom';
import {config as renderSpyConfig} from 'preact-render-spy';
let doc = undom();
renderSpyConfig.createFragment = () => doc.createElement('body');
@developit would createElement('#fragment')
be better/worse?
Ace, thanks! I will be trying this out in the next few days.
@peterjwest got any feedback, how do you think we should document this?
Not yet, sorry! I will try to have a look tonight.
Okay, so this seems to be the most sensible/minimal setup:
import 'undom/register';
import { config } from 'preact-render-spy';
config.createFragment = () => document.createElement('body');
Although I'm not sure where the #fragment
came from, maybe that's more appropriate?
Can you add documentation for running on node?
I am currently using a hack found in a closed issue:
Hopefully there's a way to do this without messing with global objects!