fix css url regexp

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 188fe68081
commit 7cb33bfe80
2 changed files with 13 additions and 1 deletions

View File

@@ -28,4 +28,16 @@ describe('absolute url to stylesheet', () => {
absoluteToStylesheet('url("http://localhost/a.jpg")', href),
).to.equal(`url('http://localhost/a.jpg')`);
});
it('can handle single quote path', () => {
expect(absoluteToStylesheet(`url('./a.jpg')`, href)).to.equal(
`url('http://localhost/css/a.jpg')`,
);
});
it('can handle no quote path', () => {
expect(absoluteToStylesheet('url(./a.jpg)', href)).to.equal(
`url('http://localhost/css/a.jpg')`,
);
});
});