@@ -13,9 +13,11 @@ const resultsCwd = 'test/files/results';
1313describe ( 'app.js' , ( ) => {
1414 beforeEach ( ( ) => {
1515 // reset counter and selectors for tests
16+ rcs . selectorLibrary . excludes = [ ] ;
1617 rcs . selectorLibrary . selectors = { } ;
18+ rcs . selectorLibrary . attributeSelectors = { } ;
1719 rcs . selectorLibrary . compressedSelectors = { } ;
18- rcs . selectorLibrary . excludes = [ ] ;
20+
1921 rcs . nameGenerator . resetCountForTests ( ) ;
2022 } ) ;
2123
@@ -25,7 +27,7 @@ describe('app.js', () => {
2527
2628 describe ( 'processing' , ( ) => {
2729 it ( 'should process css files' , done => {
28- app . process ( '**/*.css' , {
30+ app . process ( '**/style *.css' , {
2931 collectSelectors : true ,
3032 newPath : testCwd ,
3133 cwd : fixturesCwd
@@ -71,7 +73,7 @@ describe('app.js', () => {
7173 // duplicated code from the test before
7274 // but another function - especially for css
7375 it ( 'should process css files and prefix them' , done => {
74- app . processCss ( '**/*.css' , {
76+ app . processCss ( '**/style *.css' , {
7577 newPath : testCwd ,
7678 cwd : fixturesCwd ,
7779 prefix : 'prefixed-'
@@ -87,7 +89,7 @@ describe('app.js', () => {
8789 } ) ;
8890
8991 it ( 'should process css files with processCss' , done => {
90- app . processCss ( '**/*.css' , {
92+ app . processCss ( '**/style *.css' , {
9193 newPath : testCwd ,
9294 cwd : fixturesCwd
9395 } , ( err , data ) => {
@@ -108,7 +110,7 @@ describe('app.js', () => {
108110 } ) ;
109111
110112 it ( 'should process css files without options' , done => {
111- app . processCss ( fixturesCwd + '/**/*.css' , ( err , data ) => {
113+ app . processCss ( fixturesCwd + '/**/style *.css' , ( err , data ) => {
112114 let newFile = fs . readFileSync ( './rcs/' + fixturesCwd + '/style.css' , 'utf8' ) ;
113115 let expectedFile = fs . readFileSync ( resultsCwd + '/style.css' , 'utf8' ) ;
114116
@@ -121,8 +123,46 @@ describe('app.js', () => {
121123 } ) ;
122124 } ) ;
123125
126+ it ( 'should replace the selector attributes correctly' , done => {
127+ app . processCss ( 'css-attributes.css' , {
128+ newPath : testCwd ,
129+ cwd : fixturesCwd
130+ } , err => {
131+ expect ( fs . readFileSync ( testCwd + '/css-attributes.css' , 'utf8' ) ) . to . equal ( fs . readFileSync ( resultsCwd + '/css-attributes.css' , 'utf8' ) ) ;
132+
133+ done ( ) ;
134+ } ) ;
135+ } ) ;
136+
137+ it ( 'should replace the selector attributes with pre and suffixes correctly' , done => {
138+ app . processCss ( 'css-attributes.css' , {
139+ prefix : 'prefix-' ,
140+ suffix : '-suffix' ,
141+ newPath : testCwd ,
142+ cwd : fixturesCwd
143+ } , err => {
144+ expect ( fs . readFileSync ( testCwd + '/css-attributes.css' , 'utf8' ) ) . to . equal ( fs . readFileSync ( resultsCwd + '/css-attributes-pre-suffix.css' , 'utf8' ) ) ;
145+
146+ done ( ) ;
147+ } ) ;
148+ } ) ;
149+
150+ it ( 'should replace the selector attributes without caring about attribute selectors' , done => {
151+ app . processCss ( 'css-attributes.css' , {
152+ prefix : 'prefix-' ,
153+ suffix : '-suffix' ,
154+ ignoreAttributeSelector : true ,
155+ newPath : testCwd ,
156+ cwd : fixturesCwd
157+ } , err => {
158+ expect ( fs . readFileSync ( testCwd + '/css-attributes.css' , 'utf8' ) ) . to . equal ( fs . readFileSync ( resultsCwd + '/css-attributes-ignore.css' , 'utf8' ) ) ;
159+
160+ done ( ) ;
161+ } ) ;
162+ } ) ;
163+
124164 it ( 'should process css files and flatten the directories' , done => {
125- app . process ( '**/*.css' , {
165+ app . process ( '**/style *.css' , {
126166 collectSelectors : true ,
127167 flatten : true ,
128168 newPath : testCwd ,
@@ -199,7 +239,7 @@ describe('app.js', () => {
199239
200240 describe ( 'generating files' , ( ) => {
201241 beforeEach ( done => {
202- app . processCss ( '**/*.css' , {
242+ app . processCss ( '**/style *.css' , {
203243 newPath : testCwd ,
204244 cwd : fixturesCwd
205245 } , ( err , data ) => {
@@ -341,7 +381,7 @@ describe('app.js', () => {
341381
342382 describe ( 'load mapping' , ( ) => {
343383 beforeEach ( done => {
344- app . processCss ( '**/*.css' , {
384+ app . processCss ( '**/style *.css' , {
345385 newPath : testCwd ,
346386 cwd : fixturesCwd
347387 } , ( err , data ) => {
@@ -410,7 +450,7 @@ describe('app.js', () => {
410450 } ) ;
411451
412452 it ( 'should load from a filestring' , done => {
413- app . processCss ( '**/*.css' , {
453+ app . processCss ( '**/style *.css' , {
414454 newPath : testCwd ,
415455 cwd : fixturesCwd
416456 } , ( err , data ) => {
0 commit comments