yarn-spinner-runner-ts
Version:
TypeScript parser, compiler, and runtime for Yarn Spinner 3.x with React adapter [NPM package](https://www.npmjs.com/package/yarn-spinner-runner-ts)
18 lines • 823 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { test } from "node:test";
import { ok } from "node:assert";
import { renderToStaticMarkup } from "react-dom/server";
import { parseYarn } from "../parse/parser.js";
import { compile } from "../compile/compiler.js";
import { DialogueView } from "../react/DialogueView.js";
test("DialogueView renders initial variables provided via props", () => {
const yarn = `
title: Start
---
Narrator: Hello {$playerName}!
===`;
const program = compile(parseYarn(yarn));
const html = renderToStaticMarkup(_jsx(DialogueView, { program: program, startNode: "Start", variables: { playerName: "V" } }));
ok(html.includes("Hello V"), "Expected rendered dialogue to include the interpolated variable value from props");
});
//# sourceMappingURL=dialogue_view.test.js.map