|
|
@@ -79,4 +79,18 @@ describe('compiler sfc: transform asset url', () => {
|
|
|
)
|
|
|
expect(code).toMatchSnapshot()
|
|
|
})
|
|
|
+
|
|
|
+ // vitejs/vite#298
|
|
|
+ test('should not transform hash fragments', () => {
|
|
|
+ const { code } = compileWithAssetUrls(
|
|
|
+ `<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
+ <defs>
|
|
|
+ <circle id="myCircle" cx="0" cy="0" r="5" />
|
|
|
+ </defs>
|
|
|
+ <use x="5" y="5" xlink:href="#myCircle" />
|
|
|
+ </svg>`
|
|
|
+ )
|
|
|
+ // should not remove it
|
|
|
+ expect(code).toMatch(`"xlink:href": "#myCircle"`)
|
|
|
+ })
|
|
|
})
|