Skip to content

Commit 2018a26

Browse files
committed
fix(compiler-sfc): lang="" on a html tag produces error
1 parent 02fb4d8 commit 2018a26

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

packages/compiler-sfc/__tests__/parse.spec.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,10 @@ h1 { color: red }
144144
expect(descriptor.template!.content).toBe(content)
145145
})
146146

147-
test('error tolerance', () => {
148-
const { errors } = parse(`<template>`)
149-
expect(errors.length).toBe(1)
150-
})
151-
152-
test('should parse as DOM by default', () => {
147+
//#2566
148+
test('only template lang be treated as plain text', () => {
153149
const { errors } = parse(`
154-
<template>
150+
<template lang="pug">
155151
<div lang="">
156152
<div></div>
157153
</div>
@@ -160,6 +156,16 @@ h1 { color: red }
160156
expect(errors.length).toBe(0)
161157
})
162158

159+
test('error tolerance', () => {
160+
const { errors } = parse(`<template>`)
161+
expect(errors.length).toBe(1)
162+
})
163+
164+
test('should parse as DOM by default', () => {
165+
const { errors } = parse(`<template><input></template>`)
166+
expect(errors.length).toBe(0)
167+
})
168+
163169
test('custom compiler', () => {
164170
const { errors } = parse(`<template><input></template>`, {
165171
compiler: {

0 commit comments

Comments
 (0)