pikchr-wasm-kindone
Version:
A fast and small port of Pikchr to WASM.
39 lines (22 loc) • 829 B
JavaScript
/* IMPORT */
import {describe} from 'fava';
import psize from '../dist/size.js';
import pspeed from '../dist/speed.js';
/* MAIN */
describe ( 'pikchr', () => {
for ( const [pikchr, name] of [[psize, 'size'], [pspeed, 'speed']] ) {
describe ( name, it => {
it ( 'works', async t => {
const markup = `box`;
const svg = (
`<svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 112.32 76.32" data-pikchr-date="20250319161943">\n` +
`<path d="M2.16,74.16L110.16,74.16L110.16,2.16L2.16,2.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />\n` +
`</svg>\n`
);
await pikchr.loadWASM ();
const output = pikchr.render ( markup );
t.is ( output, svg );
});
});
}
});