Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
soleilwu committed Jun 4, 2024
1 parent e8040b6 commit 527afe4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1,191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ exports[`compiler: parse > Edge Cases > invalid html 1`] = `
{
"children": [
{
"children": [],
"children": [
{
"content": " ",
"loc": {
"end": {
"column": 1,
"line": 3,
"offset": 13,
},
"source": "
",
"start": {
"column": 7,
"line": 2,
"offset": 12,
},
},
"type": 2,
},
],
"codegenNode": undefined,
"loc": {
"end": {
Expand Down
9 changes: 8 additions & 1 deletion packages/compiler-core/__tests__/parse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,12 @@ describe('compiler: parse', () => {
expect((ast.children[0] as TextNode).content).toBe(` foo bar baz `)
})

// #7789
test('should condense consecutive whitespaces in texts full of whitespaces', () => {
const ast = parse(` `)
expect((ast.children[0] as TextNode).content).toBe(` `)
})

test('should remove leading newline character immediately following the pre element start tag', () => {
const ast = parse(`<pre>\n foo bar </pre>`, {
isPreTag: tag => tag === 'pre',
Expand Down Expand Up @@ -2290,7 +2296,8 @@ describe('compiler: parse', () => {
expect((ast.children[0] as TextNode).content).toBe(content)
})

it('should preserve consecutive whitespaces in texts full of whitespaces', () => {
// #7789
test('should preserve consecutive whitespaces in texts full of whitespaces', () => {
const whitespaces = ' '
const ast = parse(`${whitespaces}`)
expect((ast.children[0] as TextNode).content).toBe(whitespaces)
Expand Down
Loading

0 comments on commit 527afe4

Please sign in to comment.