Skip to content

Revert strings w commas fix #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
rules:
indent:
- 2
- 2
quotes:
- 2
- single
linebreak-style:
- 2
- unix
semi:
- 2
- always
env:
es6: true
node: true
extends: 'eslint:recommended'
parser: 'babel-eslint'
9 changes: 0 additions & 9 deletions .jshintrc

This file was deleted.

2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ function parseValue(value) {
return parseList(value);
} else if (_.isPlainObject(value)) {
return parseMap(value);
} else if (_.isString(value) && value.match(/[\s,]/)) {
return `"${value}"`;
} else {
return value;
}
Expand Down
4 changes: 0 additions & 4 deletions test/.jshintrc

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/strings/content.scss

This file was deleted.

3 changes: 1 addition & 2 deletions test/fixtures/strings/variables.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"color-red": "#c33",
"color-blue": "#33c",
"alt": "Ashness Pier, Derwentwater, Lake District, Cumbria, UK."
"color-blue": "#33c"
}
24 changes: 7 additions & 17 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env mocha */
import jsonImporter from '../src/index';
import sass from 'node-sass';
import {expect} from 'chai';
import {resolve} from 'path';

const EXPECTATION1 = 'body {\n color: #c33; }\n';
const EXPECTATION2 = 'p::after {\n content: "Ashness Pier, Derwentwater, Lake District, Cumbria, UK."; }\n';
const EXPECTATION = 'body {\n color: #c33; }\n';

describe('Import type test', function() {

Expand All @@ -14,17 +14,7 @@ describe('Import type test', function() {
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION1);
});

// Added as failing test for: https://github.com/Updater/node-sass-json-importer/pull/5
it('imports strings with spaces and/or commas', function() {
let result = sass.renderSync({
file: './test/fixtures/strings/content.scss',
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION2);
expect(result.css.toString()).to.eql(EXPECTATION);
});

it('imports lists', function() {
Expand All @@ -33,7 +23,7 @@ describe('Import type test', function() {
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION1);
expect(result.css.toString()).to.eql(EXPECTATION);
});

it('imports maps', function() {
Expand All @@ -42,7 +32,7 @@ describe('Import type test', function() {
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION1);
expect(result.css.toString()).to.eql(EXPECTATION);
});

it('finds imports via includePaths', function() {
Expand All @@ -52,7 +42,7 @@ describe('Import type test', function() {
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION1);
expect(result.css.toString()).to.eql(EXPECTATION);
});

it('finds imports via multiple includePaths', function() {
Expand All @@ -62,7 +52,7 @@ describe('Import type test', function() {
importer: jsonImporter
});

expect(result.css.toString()).to.eql(EXPECTATION1);
expect(result.css.toString()).to.eql(EXPECTATION);
});

it(`throws when an import doesn't exist`, function() {
Expand Down