Skip to content

Commit

Permalink
chore: use correct parse in parser tests for whitespace: condense
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 15, 2024
1 parent 140a768 commit f709238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/compiler-core/__tests__/parse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ describe('compiler: parse', () => {
})

test('should remove leading newline character immediately following the pre element start tag', () => {
const ast = baseParse(`<pre>\n foo bar </pre>`, {
const ast = parse(`<pre>\n foo bar </pre>`, {
isPreTag: tag => tag === 'pre',
})
expect(ast.children).toHaveLength(1)
Expand All @@ -2176,7 +2176,7 @@ describe('compiler: parse', () => {
})

test('should NOT remove leading newline character immediately following child-tag of pre element', () => {
const ast = baseParse(`<pre><span></span>\n foo bar </pre>`, {
const ast = parse(`<pre><span></span>\n foo bar </pre>`, {
isPreTag: tag => tag === 'pre',
})
const preElement = ast.children[0] as ElementNode
Expand All @@ -2187,7 +2187,7 @@ describe('compiler: parse', () => {
})

test('self-closing pre tag', () => {
const ast = baseParse(`<pre/><span>\n foo bar</span>`, {
const ast = parse(`<pre/><span>\n foo bar</span>`, {
isPreTag: tag => tag === 'pre',
})
const elementAfterPre = ast.children[1] as ElementNode
Expand All @@ -2196,7 +2196,7 @@ describe('compiler: parse', () => {
})

test('should NOT condense whitespaces in RCDATA text mode', () => {
const ast = baseParse(`<textarea>Text:\n foo</textarea>`, {
const ast = parse(`<textarea>Text:\n foo</textarea>`, {
parseMode: 'html',
})
const preElement = ast.children[0] as ElementNode
Expand Down
1 change: 1 addition & 0 deletions packages/compiler-core/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface ParserOptions
delimiters?: [string, string]
/**
* Whitespace handling strategy
* @default 'condense'
*/
whitespace?: 'preserve' | 'condense'
/**
Expand Down

0 comments on commit f709238

Please sign in to comment.