mirror of https://github.com/vuejs/core.git
test(shared): add test case for escapeHtmlComment (#8065)
This commit is contained in:
parent
f01afda159
commit
fa65cb6af1
|
@ -1,11 +1,31 @@
|
||||||
import { escapeHtml } from '../src'
|
import { escapeHtml, escapeHtmlComment } from '../src'
|
||||||
|
|
||||||
test('ssr: escapeHTML', () => {
|
describe('escapeHtml', () => {
|
||||||
expect(escapeHtml(`foo`)).toBe(`foo`)
|
test('ssr: escapeHTML', () => {
|
||||||
expect(escapeHtml(true)).toBe(`true`)
|
expect(escapeHtml(`foo`)).toBe(`foo`)
|
||||||
expect(escapeHtml(false)).toBe(`false`)
|
expect(escapeHtml(true)).toBe(`true`)
|
||||||
expect(escapeHtml(`a && b`)).toBe(`a && b`)
|
expect(escapeHtml(false)).toBe(`false`)
|
||||||
expect(escapeHtml(`"foo"`)).toBe(`"foo"`)
|
expect(escapeHtml(`a && b`)).toBe(`a && b`)
|
||||||
expect(escapeHtml(`'bar'`)).toBe(`'bar'`)
|
expect(escapeHtml(`"foo"`)).toBe(`"foo"`)
|
||||||
expect(escapeHtml(`<div>`)).toBe(`<div>`)
|
expect(escapeHtml(`'bar'`)).toBe(`'bar'`)
|
||||||
|
expect(escapeHtml(`<div>`)).toBe(`<div>`)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ssr: escapeHTMLComment', () => {
|
||||||
|
const input = '<!-- Hello --><!-- World! -->'
|
||||||
|
const result = escapeHtmlComment(input)
|
||||||
|
expect(result).toEqual(' Hello World! ')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ssr: escapeHTMLComment', () => {
|
||||||
|
const input = '<!-- Comment 1 --> Hello <!--! Comment 2 --> World!'
|
||||||
|
const result = escapeHtmlComment(input)
|
||||||
|
expect(result).toEqual(' Comment 1 Hello ! Comment 2 World!')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('should not affect non-comment strings', () => {
|
||||||
|
const input = 'Hello World'
|
||||||
|
const result = escapeHtmlComment(input)
|
||||||
|
expect(result).toEqual(input)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue