Skip to content

Commit f00767a

Browse files
committed
Gonzales 3.0: Update element-case option
1 parent 234e21c commit f00767a

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

lib/options/element-case.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,24 @@ module.exports = {
77

88
/**
99
* Processes tree node.
10-
* @param {String} nodeType
1110
* @param {node} node
1211
*/
13-
process: function(nodeType, node) {
14-
if (nodeType !== 'selector' &&
15-
nodeType !== 'arguments') return;
16-
17-
for (var x = node.length; x--;) {
18-
var selector = node[x];
19-
if (selector[0] !== 'simpleselector') continue;
20-
21-
for (var i = selector.length; i--;) {
22-
var simpleselector = selector[i];
23-
if (!Array.isArray(simpleselector) ||
24-
simpleselector[0] !== 'ident') continue;
25-
26-
simpleselector[1] = this.getValue('element-case') === 'lower' ?
27-
simpleselector[1].toLowerCase() :
28-
simpleselector[1].toUpperCase();
12+
process: function(node) {
13+
if (node.type !== 'selector' &&
14+
node.type !== 'arguments') return;
15+
16+
for (var x = node.content.length; x--;) {
17+
var selector = node.content[x];
18+
if (selector.type !== 'simpleselector') continue;
19+
20+
for (var i = selector.content.length; i--;) {
21+
var simpleselector = selector.content[i];
22+
if (!simpleselector ||
23+
simpleselector.type !== 'ident') continue;
24+
25+
simpleselector.content = this.getValue('element-case') === 'lower' ?
26+
simpleselector.content.toLowerCase() :
27+
simpleselector.content.toUpperCase();
2928
}
3029
}
3130
},

test/options/element-case-scss/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe.skip('options/element-case (scss):', function() {
1+
describe('options/element-case (scss):', function() {
22
it('Should not touch mixin names', function() {
33
this.comb.configure({ 'element-case': 'lower' });
44
this.shouldBeEqual('mixin.scss', 'mixin.expected.scss');

test/options/element-case/test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var assert = require('assert');
22

3-
describe.skip('options/element-case', function() {
3+
describe('options/element-case', function() {
44
it('Invalid String should not change case of elements', function() {
55
this.comb.configure({ 'element-case': 'foobar' });
66
assert.equal(
@@ -41,7 +41,7 @@ describe.skip('options/element-case', function() {
4141
);
4242
});
4343

44-
it('Should detect lowercase elements', function() {
44+
it.skip('Should detect lowercase elements', function() {
4545
this.shouldDetect(
4646
['element-case'],
4747
'a { color: red }',
@@ -51,7 +51,7 @@ describe.skip('options/element-case', function() {
5151
);
5252
});
5353

54-
it('Should detect uppercase elements', function() {
54+
it.skip('Should detect uppercase elements', function() {
5555
this.shouldDetect(
5656
['element-case'],
5757
'A { color: red }',
@@ -61,7 +61,7 @@ describe.skip('options/element-case', function() {
6161
);
6262
});
6363

64-
it('Should detect lowercase elements in a long selector', function() {
64+
it.skip('Should detect lowercase elements in a long selector', function() {
6565
this.shouldDetect(
6666
['element-case'],
6767
'ul li:not(:hover) A { color: red }',
@@ -71,7 +71,7 @@ describe.skip('options/element-case', function() {
7171
);
7272
});
7373

74-
it('Should detect uppercase elements in a long selector', function() {
74+
it.skip('Should detect uppercase elements in a long selector', function() {
7575
this.shouldDetect(
7676
['element-case'],
7777
'ul .lol:not(LI) A { color: red }',
@@ -81,15 +81,15 @@ describe.skip('options/element-case', function() {
8181
);
8282
});
8383

84-
it('Shouldn’t detect case of elements in a mixed case', function() {
84+
it.skip('Shouldn’t detect case of elements in a mixed case', function() {
8585
this.shouldDetect(
8686
['element-case'],
8787
'aRtIcLe { color: red }',
8888
{}
8989
);
9090
});
9191

92-
it('Shouldn’t detect case of elements when there are no such', function() {
92+
it.skip('Shouldn’t detect case of elements when there are no such', function() {
9393
this.shouldDetect(
9494
['element-case'],
9595
'*.lol { color: red }',

0 commit comments

Comments
 (0)