complately update relative path regexp

This commit is contained in:
Yanzhen Yu
2018-11-26 17:42:52 +08:00
parent aca8207db9
commit f73bad21e5
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')`,