Skip to content

Commit 1856ea6

Browse files
committed
updated tests with prefixing
1 parent 1e2fc9c commit 1856ea6

File tree

6 files changed

+94
-1
lines changed

6 files changed

+94
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ renameCssSelectors.process = (pathString, options, cb) => {
6868
// call in series
6969
// not all selectors are stored, maybe some selectors are duplicated in different files
7070
async.eachSeries(filesArray, (filePath, callback) => {
71-
rcs.replace.fileCss(path.join(options.cwd, filePath), (err, data) => {
71+
rcs.replace.fileCss(path.join(options.cwd, filePath), options, (err, data) => {
7272
let joinedPath;
7373

7474
if (err) callback(err);

test/files/fixtures/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
.jp-attribute[src] {
3030
content: 'attribute';
31+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
3132
}
3233

3334
@media screen and (min-width: .40em) {
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.prefixed-a {
2+
content: 'block';
3+
}
4+
5+
.prefixed-b {
6+
content: 'block__element';
7+
}
8+
9+
.prefixed-c {
10+
content: 'block__element--modifier';
11+
}
12+
13+
.prefixed-d{
14+
content: 'block--modifier';
15+
}
16+
17+
.prefixed-e:before {
18+
content: 'before';
19+
}
20+
21+
.prefixed-c {
22+
content: 'block__element--modifier';
23+
}
24+
25+
#prefixed-f {
26+
content: 'id';
27+
}
28+
29+
.prefixed-g[src] {
30+
content: 'attribute';
31+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
32+
}
33+
34+
@media screen and (min-width: .40em) {
35+
#prefixed-f {
36+
height: .20px;
37+
width: .20em;
38+
}
39+
}
40+
41+
/**
42+
* a description
43+
*/
44+
@media screen and (min-width: 40em)
45+
46+
{
47+
#prefixed-f
48+
{
49+
height: .20px;
50+
width: .20em;
51+
}
52+
}
53+
54+
h1 {
55+
color: red;
56+
}
57+
58+
.prefixed-h {
59+
content: 'reveal';
60+
color: #eee;
61+
font-size: .5rem;
62+
}
63+
64+
.prefixed-i.prefixed-h {
65+
content: 'js reveal';
66+
}
67+
68+
.prefixed-j.prefixed-h {
69+
content: 'js reveal';
70+
}
71+
72+
.prefixed-k {
73+
content: 'js-reveal';
74+
}

test/files/results/style-with-config.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
.g[src] {
3030
content: 'attribute';
31+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
3132
}
3233

3334
@media screen and (min-width: .40em) {

test/files/results/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
.g[src] {
3030
content: 'attribute';
31+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
3132
}
3233

3334
@media screen and (min-width: .40em) {

test/index.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ describe('app.js', () => {
4747

4848
// duplicated code from the test before
4949
// but another function - especially for css
50+
it('should process css files and prefix them', done => {
51+
app.processCss('**/*.css', {
52+
newPath: testCwd,
53+
cwd: fixturesCwd,
54+
prefix: 'prefixed-'
55+
}, (err, data) => {
56+
let newFile = fs.readFileSync(testCwd + '/style.css', 'utf8');
57+
let expectedFile = fs.readFileSync(resultsCwd + '/style-prefix.css', 'utf8');
58+
59+
expect(err).to.not.exist;
60+
expect(newFile).to.equal(expectedFile);
61+
62+
done();
63+
});
64+
});
65+
5066
it('should process css files with processCss', done => {
5167
app.processCss('**/*.css', {
5268
newPath: testCwd,

0 commit comments

Comments
 (0)