mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-04 04:44:08 +01:00 
			
		
		
		
	#478 API crashes on 2nd render() call
- add e2e test for (re)rendering by api
This commit is contained in:
		
							
								
								
									
										33
									
								
								cypress/platform/rerender.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								cypress/platform/rerender.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
  <meta charset="utf-8">
 | 
			
		||||
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
  <title>Mermaid Quick Test Page</title>
 | 
			
		||||
  <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
<div id="graph">
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
  <script src="./mermaid.js"></script>
 | 
			
		||||
  <script>
 | 
			
		||||
 | 
			
		||||
    mermaid.init({ startOnLoad: false });
 | 
			
		||||
    mermaid.mermaidAPI.initialize();
 | 
			
		||||
 | 
			
		||||
    rerender('XMas');
 | 
			
		||||
 | 
			
		||||
    function rerender(text) {
 | 
			
		||||
      var graphText = `graph TD
 | 
			
		||||
        A[${text}] -->|Get money| B(Go shopping)`
 | 
			
		||||
      var graph = mermaid.mermaidAPI.render('id', graphText);
 | 
			
		||||
      console.log('\x1b[35m%s\x1b[0m', '>> graph', graph)
 | 
			
		||||
      document.getElementById('graph').innerHTML=graph;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  </script>
 | 
			
		||||
  <button id="rerender" onclick="rerender('Saturday')">Rerender</button>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user