Skip to content

Commit

Permalink
Merge pull request #1050 from varya/fix/1037_active-modifier
Browse files Browse the repository at this point in the history
Parse additional params correctly if many modifiers are in use. Fix #1037
  • Loading branch information
varya committed Dec 28, 2016
2 parents 1afd060 + f97eb5e commit a7b0fba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/modules/kss-additional-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
comment.split('\n\n').forEach(function(markUpBlock) {

var varName = markUpBlock.match(/([^:^\n]*):[\s\S]*\n/);
if (varName && varName[1]) {
if (varName && varName[1] !== undefined) {
varName = varName[1].trim();
}
if (varName && varName.substring(0, 3) === 'sg-') {
Expand Down
15 changes: 15 additions & 0 deletions test/unit/modules/kss-additional-params.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ describe('Parsing KSS additional params', () => {
expect(params).eql(result);
});

it('Should parse with KSS modifiers', () => {
// jscs:disable
var str = `default - Default button
:hover - Hover button
:active - Active button
sg-param:
Value`,
result = { 'sg-param': 'Value' },
value = kssAdditionalParams.get(str);
// jscs:enable
expect(value).eql(result);
});

it('should parse windows linebreaks correctly', () => {
// jscs:disable
/*jshint -W109 */
Expand Down Expand Up @@ -219,4 +233,5 @@ describe('Parsing KSS additional params', () => {
// jscs:enable
expect(value).eql(result);
});

});

0 comments on commit a7b0fba

Please sign in to comment.