fix(compiler-sfc): transformAssetUrl should ignore inline data url (#1431)

This commit is contained in:
underfin
2020-06-24 09:46:18 +08:00
committed by GitHub
parent 37a5952c09
commit 90c285c5c8
8 changed files with 61 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import {
isRelativeUrl,
isExternalUrl
isExternalUrl,
isDataUrl
} from '../../compiler-sfc/src/templateUtils'
describe('compiler sfc:templateUtils isRelativeUrl', () => {
@@ -36,3 +37,17 @@ describe('compiler sfc:templateUtils isExternalUrl', () => {
expect(result).toBe(true)
})
})
describe('compiler sfc:templateUtils isDataUrl', () => {
test('should return true w/ hasn`t media type and encode', () => {
expect(isDataUrl('data:,i')).toBe(true)
})
test('should return true w/ media type + encode', () => {
expect(isDataUrl('data:image/png;base64,i')).toBe(true)
})
test('should return true w/ media type + hasn`t encode', () => {
expect(isDataUrl('data:image/png,i')).toBe(true)
})
})