Skip to content

Commit

Permalink
Merge pull request #360 from kristerkari/bugfix/selector-nest-combina…
Browse files Browse the repository at this point in the history
…tors-nested-properties

Fix selector-nest-combinators throwing an error when using nested props
  • Loading branch information
kristerkari committed Aug 20, 2019
2 parents 1b0bdd2 + f0f53ad commit ecc4de9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/rules/declaration-nested-properties/__tests__/index.js
Expand Up @@ -33,6 +33,17 @@ testRule(rule, {
}
`,
description: "{ always } Vendor prefixed rules."
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "nested properties"
}
]
});
Expand Down
22 changes: 22 additions & 0 deletions src/rules/selector-nest-combinators/__tests__/index.js
Expand Up @@ -96,6 +96,17 @@ testRule(rule, {
}
`,
description: "should support interpolation"
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "ignores nested properties"
}
],

Expand Down Expand Up @@ -240,6 +251,17 @@ testRule(rule, {
.class-name #{if(&, "&", "")} {}
`,
description: "should support interpolation"
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "ignores nested properties"
}
],

Expand Down
8 changes: 8 additions & 0 deletions src/rules/selector-nest-combinators/index.js
Expand Up @@ -46,6 +46,14 @@ export default function(expectation) {
const interpolationRe = /#{.+?}$/;

root.walkRules(rule => {
if (typeof rule.selector === "string") {
const isNestedProperty = rule.selector.slice(-1) === ":";

if (isNestedProperty) {
return;
}
}

parseSelector(rule.selector, result, rule, fullSelector => {
let message;

Expand Down

0 comments on commit ecc4de9

Please sign in to comment.