Skip to content

Commit b47edae

Browse files
committed
Add failing test for strings w/ spaces/commas
#5
1 parent c60d310 commit b47edae

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

test/fixtures/strings/content.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import 'variables.json';
2+
3+
p::after {
4+
content: $alt;
5+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"color-red": "#c33",
3-
"color-blue": "#33c"
3+
"color-blue": "#33c",
4+
"alt": "Ashness Pier, Derwentwater, Lake District, Cumbria, UK."
45
}

test/index.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import sass from 'node-sass';
33
import {expect} from 'chai';
44
import {resolve} from 'path';
55

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

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

@@ -13,7 +14,17 @@ describe('Import type test', function() {
1314
importer: jsonImporter
1415
});
1516

16-
expect(result.css.toString()).to.eql(EXPECTATION);
17+
expect(result.css.toString()).to.eql(EXPECTATION1);
18+
});
19+
20+
// Added as failing test for: https://github.com/Updater/node-sass-json-importer/pull/5
21+
it('imports strings with spaces and/or commas', function() {
22+
let result = sass.renderSync({
23+
file: './test/fixtures/strings/content.scss',
24+
importer: jsonImporter
25+
});
26+
27+
expect(result.css.toString()).to.eql(EXPECTATION2);
1728
});
1829

1930
it('imports lists', function() {
@@ -22,7 +33,7 @@ describe('Import type test', function() {
2233
importer: jsonImporter
2334
});
2435

25-
expect(result.css.toString()).to.eql(EXPECTATION);
36+
expect(result.css.toString()).to.eql(EXPECTATION1);
2637
});
2738

2839
it('imports maps', function() {
@@ -31,7 +42,7 @@ describe('Import type test', function() {
3142
importer: jsonImporter
3243
});
3344

34-
expect(result.css.toString()).to.eql(EXPECTATION);
45+
expect(result.css.toString()).to.eql(EXPECTATION1);
3546
});
3647

3748
it('finds imports via includePaths', function() {
@@ -41,7 +52,7 @@ describe('Import type test', function() {
4152
importer: jsonImporter
4253
});
4354

44-
expect(result.css.toString()).to.eql(EXPECTATION);
55+
expect(result.css.toString()).to.eql(EXPECTATION1);
4556
});
4657

4758
it('finds imports via multiple includePaths', function() {
@@ -51,7 +62,7 @@ describe('Import type test', function() {
5162
importer: jsonImporter
5263
});
5364

54-
expect(result.css.toString()).to.eql(EXPECTATION);
65+
expect(result.css.toString()).to.eql(EXPECTATION1);
5566
});
5667

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

0 commit comments

Comments
 (0)