Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 5a840b7

Browse files
committed
Add regression test for #135
1 parent 5889e06 commit 5a840b7

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

test/css.builder.spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@ describe('CSS Builder', function() {
2525
});
2626
});
2727

28+
describe('with a browserRootURL config', function () {
29+
it('should preprend it to a relative url(...) reference', function () {
30+
var builder = new Builder();
31+
builder.config(System.getConfig());
32+
builder.config({
33+
browserRootURL: 'https://example.com/',
34+
rootURL: './test'
35+
});
36+
return builder.compile('test/data/test.css!', {minify: false}).then((results) => {
37+
return expect(results.source).to.contain("body{background-color:red;background-image:url(https://example.com/data/x.png)}");
38+
});
39+
});
40+
41+
it('should preprend it to a root-relative url(...) reference', function () {
42+
var builder = new Builder();
43+
builder.config(System.getConfig());
44+
builder.config({
45+
browserRootURL: 'https://example.com/',
46+
rootURL: './test'
47+
});
48+
return builder.compile('test/data/rootRelative.css!', {minify: false}).then((results) => {
49+
return expect(results.source).to.contain("body{background-color:red;background-image:url(https://example.com/path/to/x.png)}");
50+
});
51+
});
52+
});
53+
2854
it('Should support buildCSS: false', function() {
2955
var builder = new Builder();
3056
builder.config(System.getConfig());

test/data/rootRelative.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import "./dep.css";
2+
3+
body {
4+
background-color: red;
5+
background-image: url(/path/to/x.png);
6+
}

0 commit comments

Comments
 (0)