complately update relative path regexp

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent cf54d7dab5
commit cdedca1716
3 changed files with 9 additions and 2 deletions

View File

@@ -5,6 +5,12 @@ import { absoluteToStylesheet } from '../src/snapshot';
describe('absolute url to stylesheet', () => {
const href = 'http://localhost/css/style.css';
it('cam handle relative path', () => {
expect(absoluteToStylesheet('url(a.jpg)', href)).to.equal(
`url('http://localhost/css/a.jpg')`,
);
});
it('can handle same level path', () => {
expect(absoluteToStylesheet('url("./a.jpg")', href)).to.equal(
`url('http://localhost/css/a.jpg')`,