forked from webpack-contrib/css-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliasTest.js
30 lines (26 loc) · 951 Bytes
/
aliasTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*globals describe */
var test = require("./helpers").test;
describe("alias", function() {
var css = ".className { background: url(./path/to/file.png); }";
var exports = {
without: [
[1, ".className { background: url({./path/to/file.png}); }", ""]
],
onlyModule: [
[1, ".className { background: url({module/file.png}); }", ""]
],
exactMatch: [
[1, ".className { background: url({module/file.png}); }", ""]
],
notExactMatch: [
[1, ".className { background: url({./path/to/file.png}); }", ""]
]
};
function aliasOptions(alias) {
return { query: { alias: alias }}
}
test("without", css, exports.without);
test("onlyModule", css, exports.onlyModule, aliasOptions({ "./path/to": "module" }));
test("exactMatch", css, exports.exactMatch, aliasOptions({ "./path/to/file.png$": "module/file.png" }));
test("notExactMatch", css, exports.notExactMatch, aliasOptions({ "./path/to/file.jpg$": "module/file.jpg" }));
});