deno.land / x / ruck@v5.0.0 / HeadManagerContext.test.mjs

HeadManagerContext.test.mjs
// @ts-check
import { createElement as h, useContext } from "react";import { renderToStaticMarkup } from "react-dom/server";import { assertStrictEquals } from "std/testing/asserts.ts";
import HeadManager from "./HeadManager.mjs";import HeadManagerContext from "./HeadManagerContext.mjs";
Deno.test("`HeadManagerContext` used as a React context.", () => { let contextValue;
function TestComponent() { contextValue = useContext(HeadManagerContext); return null; }
const value = new HeadManager();
renderToStaticMarkup( h(HeadManagerContext.Provider, { value }, h(TestComponent)), );
assertStrictEquals(contextValue, value);});
ruck
Ruck is an open source buildless React web application framework for Deno.
GitHub Stars
74
Go to latest

Version Info

Tagged at
a month ago

External Dependencies