fix(test): Rerender

This commit is contained in:
Sidharth Vinod 2022-10-05 14:08:53 +08:00
parent d3a81f025a
commit a017ffc3c9
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
1 changed files with 5 additions and 4 deletions

View File

@ -17,11 +17,12 @@
rerender('XMas'); rerender('XMas');
function rerender(text) { function rerender(text) {
var graphText = `graph TD const graphText = `graph TD
A[${text}] -->|Get money| B(Go shopping)`; A[${text}] -->|Get money| B(Go shopping)`;
var graph = mermaid.mermaidAPI.render('id', graphText); mermaid.mermaidAPI.render('id', graphText).then((svg) => {
console.log('\x1b[35m%s\x1b[0m', '>> graph', graph); console.log('\x1b[35m%s\x1b[0m', '>> graph', svg);
document.getElementById('graph').innerHTML = graph; document.getElementById('graph').innerHTML = svg;
});
} }
</script> </script>
<button id="rerender" onclick="rerender('Saturday')">Rerender</button> <button id="rerender" onclick="rerender('Saturday')">Rerender</button>