import { renderToString, snapshotEverything } from "../helpers"; snapshotEverything(); // ----------------------------------------------------------------------------- // white space // ----------------------------------------------------------------------------- describe("white space handling", () => { test("white space only text nodes are condensed into a single space", () => { const template = `
`; expect(renderToString(template)).toBe("
"); }); test("consecutives whitespaces are condensed into a single space", () => { const template = `
abc
`; expect(renderToString(template)).toBe("
abc
"); }); test("whitespace only text nodes with newlines are removed", () => { const template = `
abc
`; expect(renderToString(template)).toBe("
abc
"); }); test("nothing is done in pre tags", () => { const template1 = `
   
`; expect(renderToString(template1)).toBe(template1); const template2 = `
          some text
        
`; expect(renderToString(template2)).toBe(template2); const template3 = `
          
        
`; expect(renderToString(template3)).toBe(template3); }); test("pre inside a div with a new line", () => { expect(renderToString(`
SomeText
\n
`)).toBe( "
SomeText
" ); }); });