•Created by Guilherme Rosado on 3/31/2023 in #support
How do I test this behavior?
I want to test the following behavior but I think there's no DOM tree here, right? When we're testing SolidJS components how do I visualize the current tree?
describe("Turnstile Component", () => {
it("renders the Turnstile component", () => {
createRoot(() => {
const container = (
<Turnstile sitekey="" onToken={(t) => {}} />
) as HTMLDivElement;
expect(container.outerHTML).toBe("<div></div>");
console.log("SCRIPT: ", document.querySelector("#turnstile-script")); // null, onMount creates an element with the id="turnstile-script"
});
});
});
describe("Turnstile Component", () => {
it("renders the Turnstile component", () => {
createRoot(() => {
const container = (
<Turnstile sitekey="" onToken={(t) => {}} />
) as HTMLDivElement;
expect(container.outerHTML).toBe("<div></div>");
console.log("SCRIPT: ", document.querySelector("#turnstile-script")); // null, onMount creates an element with the id="turnstile-script"