lumpy-turnips/minty

front-end code in the file being tested may cause graphViz code to be displayed unparsed

Opened this issue · 1 comments

Example:

'use strict';
const minty = require('minty');
const http = require('http');


const testDoc = `
<html>
  <head>
    <title>Minty Node Example</title>
    <script type="text/javascript">
    var alertContent = 'If this alert shows, you have done a  great job!';

    function showAlert(string) {
      alert(string);
    }
    </script>
  </head>
  <body onload="showAlert(alertContent);">
    <h1>Minty Node Example</h1>
    <p>
      <a onclick="showAlert(alertContent)">Click to show alert again</a>!
    </p>
  </body>
</html>
`;

const testHeader = { 'Content-Type': 'text/plain' }

function sendContent(response, content, header) {
  response.writeHead(200, header);
  response.end(content);
}

var sendMinty = minty.wrap(sendContent);

http.createServer((req, res) => {
  sendMinty(res, testDoc, testHeader);
}).listen(3000);

Refining the test case further, I've determined it's the presence of the <script> tag that causes the problem.