@@ -25,6 +25,41 @@ describe('CSS Builder', function() {
25
25
} ) ;
26
26
} ) ;
27
27
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
+
54
+ // https://github.com/systemjs/plugin-css/pull/135#commitcomment-24415595
55
+ it ( 'should handle a root-relative url when no rootURL and no browserRootURL are configured' , function ( ) {
56
+ var builder = new Builder ( ) ;
57
+ builder . config ( System . getConfig ( ) ) ;
58
+ return builder . compile ( 'test/data/rootRelative.css!' , { minify : false } ) . then ( ( results ) => {
59
+ return expect ( results . source ) . to . contain ( "body{background-color:red;background-image:url(/path/to/x.png)}" ) ;
60
+ } ) ;
61
+ } ) ;
62
+
28
63
it ( 'Should support buildCSS: false' , function ( ) {
29
64
var builder = new Builder ( ) ;
30
65
builder . config ( System . getConfig ( ) ) ;
0 commit comments