mirror of https://github.com/vuejs/core.git
chore: use correct parse in parser tests for whitespace: condense
This commit is contained in:
parent
140a7681cc
commit
f709238c30
|
@ -2166,7 +2166,7 @@ describe('compiler: parse', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should remove leading newline character immediately following the pre element start tag', () => {
|
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',
|
isPreTag: tag => tag === 'pre',
|
||||||
})
|
})
|
||||||
expect(ast.children).toHaveLength(1)
|
expect(ast.children).toHaveLength(1)
|
||||||
|
@ -2176,7 +2176,7 @@ describe('compiler: parse', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should NOT remove leading newline character immediately following child-tag of pre element', () => {
|
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',
|
isPreTag: tag => tag === 'pre',
|
||||||
})
|
})
|
||||||
const preElement = ast.children[0] as ElementNode
|
const preElement = ast.children[0] as ElementNode
|
||||||
|
@ -2187,7 +2187,7 @@ describe('compiler: parse', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('self-closing pre tag', () => {
|
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',
|
isPreTag: tag => tag === 'pre',
|
||||||
})
|
})
|
||||||
const elementAfterPre = ast.children[1] as ElementNode
|
const elementAfterPre = ast.children[1] as ElementNode
|
||||||
|
@ -2196,7 +2196,7 @@ describe('compiler: parse', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should NOT condense whitespaces in RCDATA text mode', () => {
|
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',
|
parseMode: 'html',
|
||||||
})
|
})
|
||||||
const preElement = ast.children[0] as ElementNode
|
const preElement = ast.children[0] as ElementNode
|
||||||
|
|
|
@ -74,6 +74,7 @@ export interface ParserOptions
|
||||||
delimiters?: [string, string]
|
delimiters?: [string, string]
|
||||||
/**
|
/**
|
||||||
* Whitespace handling strategy
|
* Whitespace handling strategy
|
||||||
|
* @default 'condense'
|
||||||
*/
|
*/
|
||||||
whitespace?: 'preserve' | 'condense'
|
whitespace?: 'preserve' | 'condense'
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue