| 12345678910111213141516 |
- const templateMinify = require("../minifyTemplate.js")
- test('Test html string with template', () => {
- expect(templateMinify("let echo = 1;\r html`\r\r\n <div> html test ${echo}\r</div> `",{collapseWhitespace: true}))
- .toBe("let echo=1;html`<div>html test ${echo}</div>`;");
- });
- test('Test html string with nested template', () => {
- expect(templateMinify("let echo = 1;\r html`\r\r\n <div> html test ${echo ? html`<div>\r\nEcho\r\n</div>`:``}\r</div> `",{collapseWhitespace: true}))
- .toBe("let echo=1;html`<div>html test ${echo?html`<div>Echo</div>`:``}</div>`;");
- });
- test('Test html string with template in attribute', () => {
- expect(templateMinify("let echo = 1;\r html`\r\r\n <div ${echo}> html test \r</div> `",{collapseWhitespace: true}))
- .toBe("let echo=1;html`<div ${echo}>html test</div>`;");
- });
|