template.test.js 718 B

1234567891011
  1. const templateMinify = require("../minifyTemplate.js")
  2. test('Test html string with tempalte', () => {
  3. expect(templateMinify("let echo = 1;\r html`\r\r\n <div> html test ${echo}\r</div> `",{collapseWhitespace: true}))
  4. .toBe("let echo=1;html`<div>html test ${echo}</div>`;");
  5. });
  6. test('Test simple svg string', () => {
  7. expect(templateMinify('let echo = 0;svg`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24">\r\n<path d="M${echo} 0h24v24H0z"/>\r\n</svg>`',{collapseWhitespace: true}))
  8. .toBe('let echo=0;svg`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M${echo} 0h24v24H0z"/></svg>`;');
  9. });