Skip to content

Commit

Permalink
Merge pull request #1031 from varya/fix/1027_trim-spaces-in-between-k…
Browse files Browse the repository at this point in the history
…ss-parameters

Allow trailing spaces in between KSS parameters. Fix#1027
  • Loading branch information
varya authored Nov 11, 2016
2 parents df8cbca + 9f021c0 commit 93a199f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/modules/kss-additional-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
get: function(source) {

// Remove comment markup from comments
var comment = source.split('//').join('').split('/*').join('').split('*/').join(''),
var comment = source.split(/\/\/[ ]?/).join('').split('/*').join('').split('*/').join(''),
additionalKssParams = {},
_this = this;

Expand Down
28 changes: 14 additions & 14 deletions test/unit/modules/kss-additional-params.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Parsing KSS additional params', () => {
var str = `// sg-param:
// Value`,
// jscs:enable
result = { 'sg-param': ' Value' },
result = { 'sg-param': 'Value' },
params = kssAdditionalParams.get(str);

expect(params).eql(result);
Expand All @@ -21,7 +21,7 @@ describe('Parsing KSS additional params', () => {
/*jshint -W109 */
var str = "/*\r\n// sg-param:\r\n// Value\r\n*/\r\n",
str2 = "/*\r// sg-param:\r// Value\r*/\r",
result = { 'sg-param': ' Value' };
result = { 'sg-param': 'Value' };
// jscs:enable
expect(kssAdditionalParams.get(str)).eql(result);
expect(kssAdditionalParams.get(str2)).eql(result);
Expand All @@ -30,10 +30,10 @@ describe('Parsing KSS additional params', () => {
it('Should parse from multiline-commented block', () => {
var str = '' +
'/*\n' +
' sg-param:\n' +
' Value' +
'sg-param:\n' +
'Value' +
'*/',
result = { 'sg-param': ' Value' },
result = { 'sg-param': 'Value' },
params = kssAdditionalParams.get(str);

expect(params).eql(result);
Expand All @@ -51,9 +51,9 @@ describe('Parsing KSS additional params', () => {
// Value`,
// jscs:enable
result = {
'sg-param1':' Value',
'sg-param2':' Value',
'sg-param3':' Value'
'sg-param1':'Value',
'sg-param2':'Value',
'sg-param3':'Value'
},
params = kssAdditionalParams.get(str);

Expand All @@ -72,9 +72,9 @@ describe('Parsing KSS additional params', () => {
// Value`,
// jscs:enable
result = {
'sg-param1':' Value',
'sg-param2':' Value',
'sg-param3':' Value'
'sg-param1':'Value',
'sg-param2':'Value',
'sg-param3':'Value'
},
params = kssAdditionalParams.get(str);

Expand All @@ -97,9 +97,9 @@ describe('Parsing KSS additional params', () => {
// Value`,
// jscs:enable
result = {
'sg-param1':' Value',
'sg-param2':' Value',
'sg-param3':' Value'
'sg-param1':'Value',
'sg-param2':'Value',
'sg-param3':'Value'
},
params = kssAdditionalParams.get(str);

Expand Down

0 comments on commit 93a199f

Please sign in to comment.