Skip to content

Commit 2e73a02

Browse files
committed
Improve tests
- Remove redundant tests - Add rootpath-rewrite-urls-all test - Add rootpath-rewrite-urls-local test
1 parent 78b5254 commit 2e73a02

File tree

13 files changed

+110
-60
lines changed

13 files changed

+110
-60
lines changed
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
#imported-file {
2-
background-image: url(./folder/relative/path);
3-
background-image: url(./relative/path);
4-
background-image: url(../relative/path);
5-
background-image: url(folder/module);
6-
background-image: url(folder/module/path);
7-
background-image: url(folder/module/relative/path);
2+
background-image: url("./folder/relative/path");
3+
background-image: url("./relative/path");
4+
background-image: url("../relative/path");
5+
background-image: url("folder/module");
6+
background-image: url("folder/module/path");
7+
background-image: url("folder/module/relative/path");
88
}
99
#rewrite-urls-all {
10-
background-image: url(./relative/path);
1110
background-image: url("./relative/path");
12-
background-image: url('./relative/path');
13-
background-image: url(../relative/path);
1411
background-image: url("../relative/path");
15-
background-image: url('../relative/path');
16-
background-image: url(./path);
17-
background-image: url(./);
18-
background-image: url(module);
19-
background-image: url(module/path);
12+
background-image: url("./path");
13+
background-image: url("./");
2014
background-image: url("module");
2115
background-image: url("module/path");
22-
background-image: url(module/relative/path);
16+
background-image: url("module/relative/path");
2317
}
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
#imported-file {
2-
background-image: url(./folder/relative/path);
3-
background-image: url(./relative/path);
4-
background-image: url(../relative/path);
5-
background-image: url(module);
6-
background-image: url(module/path);
7-
background-image: url(module/relative/path);
2+
background-image: url("./folder/relative/path");
3+
background-image: url("./relative/path");
4+
background-image: url("../relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/relative/path");
88
}
99
#rewrite-urls-local {
10-
background-image: url(./relative/path);
1110
background-image: url("./relative/path");
12-
background-image: url('./relative/path');
13-
background-image: url(../relative/path);
1411
background-image: url("../relative/path");
15-
background-image: url('../relative/path');
16-
background-image: url(./path);
17-
background-image: url(./);
18-
background-image: url(module);
19-
background-image: url(module/path);
12+
background-image: url("./path");
13+
background-image: url("./");
2014
background-image: url("module");
2115
background-image: url("module/path");
22-
background-image: url(module/relative/path);
16+
background-image: url("module/relative/path");
2317
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#imported-file {
2+
background-image: url("http://example.com/assets/css/folder/relative/path");
3+
background-image: url("http://example.com/assets/css/relative/path");
4+
background-image: url("http://example.com/assets/relative/path");
5+
background-image: url("http://example.com/assets/css/folder/module");
6+
background-image: url("http://example.com/assets/css/folder/module/path");
7+
background-image: url("http://example.com/assets/css/folder/module/relative/path");
8+
}
9+
#rootpath-rewrite-urls-all {
10+
background-image: url("http://example.com/assets/css/relative/path");
11+
background-image: url("http://example.com/assets/relative/path");
12+
background-image: url("http://example.com/assets/css/path");
13+
background-image: url("http://example.com/assets/css");
14+
background-image: url("http://example.com/assets/css/module");
15+
background-image: url("http://example.com/assets/css/module/path");
16+
background-image: url("http://example.com/assets/css/module/relative/path");
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#imported-file {
2+
background-image: url("http://example.com/assets/css/folder/relative/path");
3+
background-image: url("http://example.com/assets/css/relative/path");
4+
background-image: url("http://example.com/assets/relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/relative/path");
8+
}
9+
#rootpath-rewrite-urls-local {
10+
background-image: url("http://example.com/assets/css/relative/path");
11+
background-image: url("http://example.com/assets/relative/path");
12+
background-image: url("http://example.com/assets/css/path");
13+
background-image: url("http://example.com/assets/css");
14+
background-image: url("module");
15+
background-image: url("module/path");
16+
background-image: url("module/relative/path");
17+
}

test/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ var testMap = [
5050
[{urlArgs: '424242'}, 'url-args/'],
5151
[{rewriteUrls: 'all'}, 'rewrite-urls-all/'],
5252
[{rewriteUrls: 'local'}, 'rewrite-urls-local/'],
53+
[{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'all'}, 'rootpath-rewrite-urls-all/'],
54+
[{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'local'}, 'rootpath-rewrite-urls-local/'],
5355
[{paths: ['test/data/', 'test/less/import/']}, 'include-path/'],
5456
[{paths: 'test/data/'}, 'include-path-string/'],
5557
[{plugin: 'test/plugins/postprocess/'}, 'postProcessorPlugin/'],
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#imported-file {
2-
background-image: url(./relative/path);
3-
background-image: url(../relative/path);
4-
background-image: url(../../relative/path);
5-
background-image: url(module);
6-
background-image: url(module/path);
7-
background-image: url(module/path/../relative/path);
2+
background-image: url("./relative/path");
3+
background-image: url("../relative/path");
4+
background-image: url("../../relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/path/../relative/path");
88
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
@import "./folder/file.less";
22

33
#rewrite-urls-all {
4-
background-image: url(./relative/path);
54
background-image: url("./relative/path");
6-
background-image: url('./relative/path');
7-
background-image: url(../relative/path);
85
background-image: url("../relative/path");
9-
background-image: url('../relative/path');
10-
background-image: url(./relative/../path);
11-
background-image: url(./relative/../path/..);
12-
background-image: url(module);
13-
background-image: url(module/path);
6+
background-image: url("./relative/../path");
7+
background-image: url("./relative/../path/..");
148
background-image: url("module");
159
background-image: url("module/path");
16-
background-image: url(module/path/../relative/path);
10+
background-image: url("module/path/../relative/path");
1711
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#imported-file {
2-
background-image: url(./relative/path);
3-
background-image: url(../relative/path);
4-
background-image: url(../../relative/path);
5-
background-image: url(module);
6-
background-image: url(module/path);
7-
background-image: url(module/path/../relative/path);
2+
background-image: url("./relative/path");
3+
background-image: url("../relative/path");
4+
background-image: url("../../relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/path/../relative/path");
88
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
@import "./folder/file.less";
22

33
#rewrite-urls-local {
4-
background-image: url(./relative/path);
54
background-image: url("./relative/path");
6-
background-image: url('./relative/path');
7-
background-image: url(../relative/path);
85
background-image: url("../relative/path");
9-
background-image: url('../relative/path');
10-
background-image: url(./relative/../path);
11-
background-image: url(./relative/../path/..);
12-
background-image: url(module);
13-
background-image: url(module/path);
6+
background-image: url("./relative/../path");
7+
background-image: url("./relative/../path/..");
148
background-image: url("module");
159
background-image: url("module/path");
16-
background-image: url(module/path/../relative/path);
10+
background-image: url("module/path/../relative/path");
1711
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#imported-file {
2+
background-image: url("./relative/path");
3+
background-image: url("../relative/path");
4+
background-image: url("../../relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/path/../relative/path");
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./folder/file.less";
2+
3+
#rootpath-rewrite-urls-all {
4+
background-image: url("./relative/path");
5+
background-image: url("../relative/path");
6+
background-image: url("./relative/../path");
7+
background-image: url("./relative/../path/..");
8+
background-image: url("module");
9+
background-image: url("module/path");
10+
background-image: url("module/path/../relative/path");
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#imported-file {
2+
background-image: url("./relative/path");
3+
background-image: url("../relative/path");
4+
background-image: url("../../relative/path");
5+
background-image: url("module");
6+
background-image: url("module/path");
7+
background-image: url("module/path/../relative/path");
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./folder/file.less";
2+
3+
#rootpath-rewrite-urls-local {
4+
background-image: url("./relative/path");
5+
background-image: url("../relative/path");
6+
background-image: url("./relative/../path");
7+
background-image: url("./relative/../path/..");
8+
background-image: url("module");
9+
background-image: url("module/path");
10+
background-image: url("module/path/../relative/path");
11+
}

0 commit comments

Comments
 (0)