Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix endInterpolant not being captured
Fixes #20
- Loading branch information
Showing
7 changed files
with
274 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`interpolant should tokenize interpolant decimal 1`] = ` | ||
Array [ | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
1, | ||
2, | ||
], | ||
Array [ | ||
"number", | ||
"1.0", | ||
1, | ||
3, | ||
1, | ||
5, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
1, | ||
6, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
2, | ||
0, | ||
], | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
2, | ||
2, | ||
], | ||
Array [ | ||
"number", | ||
"10.00", | ||
2, | ||
10, | ||
2, | ||
14, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
2, | ||
15, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
3, | ||
0, | ||
], | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
3, | ||
2, | ||
], | ||
Array [ | ||
"number", | ||
".100", | ||
3, | ||
19, | ||
3, | ||
22, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
3, | ||
23, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
4, | ||
0, | ||
], | ||
] | ||
`; | ||
exports[`interpolant should tokenize interpolant number 1`] = ` | ||
Array [ | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
1, | ||
2, | ||
], | ||
Array [ | ||
"number", | ||
"1", | ||
1, | ||
3, | ||
1, | ||
3, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
1, | ||
4, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
2, | ||
0, | ||
], | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
2, | ||
2, | ||
], | ||
Array [ | ||
"number", | ||
"123", | ||
2, | ||
8, | ||
2, | ||
10, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
2, | ||
11, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
3, | ||
0, | ||
], | ||
] | ||
`; | ||
exports[`interpolant should tokenize interpolant quoted-string 1`] = ` | ||
Array [ | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
1, | ||
2, | ||
], | ||
Array [ | ||
"\\"", | ||
"\\"", | ||
1, | ||
3, | ||
], | ||
Array [ | ||
"string", | ||
"hello world!", | ||
1, | ||
4, | ||
1, | ||
15, | ||
], | ||
Array [ | ||
"\\"", | ||
"\\"", | ||
1, | ||
16, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
1, | ||
17, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
2, | ||
0, | ||
], | ||
] | ||
`; | ||
exports[`interpolant should tokenize interpolant unquoted-string 1`] = ` | ||
Array [ | ||
Array [ | ||
"startInterpolant", | ||
"#{", | ||
1, | ||
2, | ||
], | ||
Array [ | ||
"ident", | ||
"hello", | ||
1, | ||
3, | ||
1, | ||
7, | ||
], | ||
Array [ | ||
"space", | ||
" ", | ||
], | ||
Array [ | ||
"ident", | ||
"world", | ||
1, | ||
9, | ||
1, | ||
13, | ||
], | ||
Array [ | ||
"endInterpolant", | ||
"}", | ||
1, | ||
14, | ||
], | ||
Array [ | ||
"newline", | ||
" | ||
", | ||
2, | ||
0, | ||
], | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#{1.0} | ||
#{10.00} | ||
#{.100} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#{1} | ||
#{123} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#{"hello world!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#{hello world} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var scss = require('..'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
var fixture = function(name) { | ||
return fs.readFileSync( | ||
path.join(__dirname, 'fixture', name) | ||
); | ||
} | ||
|
||
describe('interpolant', function() { | ||
it('should tokenize interpolant decimal', function() { | ||
const tree = scss.tokenize(fixture('interpolant/decimal.scss')); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('should tokenize interpolant number', function() { | ||
const tree = scss.tokenize(fixture('interpolant/number.scss')); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('should tokenize interpolant quoted-string', function() { | ||
const tree = scss.tokenize(fixture('interpolant/quoted-string.scss')); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('should tokenize interpolant unquoted-string', function() { | ||
const tree = scss.tokenize(fixture('interpolant/unquoted-string.scss')); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters