UNPKG

functionalscript

Version:

FunctionalScript is a purely functional subset of JavaScript

43 lines (42 loc) 1.38 kB
import { htmlToString } from "./module.f.js"; export default { empty: () => { const r = htmlToString(['html']); if (r !== '<!DOCTYPE html><html></html>') { throw `empty: ${r}`; } }, empty2: () => { const r = htmlToString(['html']); if (r !== '<!DOCTYPE html><html></html>') { throw r; } }, void: () => { const r = htmlToString(['area']); if (r !== '<!DOCTYPE html><area>') { throw r; } }, some: () => { const x = ['div', {}, '<div>&amp;</div>', ['a', { href: 'hello"' }]]; const s = htmlToString(x); if (s !== '<!DOCTYPE html><div>&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s; } }, some2: () => { const x = ['div', '<div>&amp;</div>', ['a', { href: 'hello"' }]]; const s = htmlToString(x); if (s !== '<!DOCTYPE html><div>&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s; } }, someVoid: () => { const x = ['div', ['br', { id: '5' }], '<div>&amp;</div>', ['a', { href: 'hello"' }]]; const s = htmlToString(x); if (s !== '<!DOCTYPE html><div><br id="5">&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s; } } };