feat(compiler): preserve whitespace in pre tag, add tests

This commit is contained in:
Evan You
2019-10-24 16:42:09 -04:00
parent 9298f46f92
commit eb20730a67
4 changed files with 89 additions and 27 deletions

View File

@@ -98,6 +98,15 @@ describe('DOM parser', () => {
}
})
})
test('<pre> tag should preserve raw whitespace', () => {
const rawText = ` \na b \n c`
const ast = parse(`<pre>${rawText}</pre>`, parserOptions)
expect((ast.children[0] as ElementNode).children[0]).toMatchObject({
type: NodeTypes.TEXT,
content: rawText
})
})
})
describe('Interpolation', () => {