Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
5faaed1b
Commit
5faaed1b
authored
Nov 05, 2014
by
Andrew Nesbitt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #514 from kevva/test-indented
Add tests for indented syntax and some tweaks
parents
bb91cfec
029d0899
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
6 deletions
+73
-6
api.js
test/api.js
+73
-6
No files found.
test/api.js
View file @
5faaed1b
...
@@ -19,6 +19,19 @@ describe('api (deprecated)', function() {
...
@@ -19,6 +19,19 @@ describe('api (deprecated)', function() {
});
});
});
});
it
(
'should compile sass to css using indented syntax'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'indent/index.sass'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
();
sass
.
render
(
src
,
function
(
err
,
css
)
{
assert
(
!
err
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
},
{
indentedSyntax
:
true
});
});
it
(
'should throw error for bad input'
,
function
(
done
)
{
it
(
'should throw error for bad input'
,
function
(
done
)
{
sass
.
render
(
'#navbar width 80%;'
,
function
(
err
)
{
sass
.
render
(
'#navbar width 80%;'
,
function
(
err
)
{
assert
(
err
);
assert
(
err
);
...
@@ -31,8 +44,18 @@ describe('api (deprecated)', function() {
...
@@ -31,8 +44,18 @@ describe('api (deprecated)', function() {
it
(
'should compile sass to css'
,
function
(
done
)
{
it
(
'should compile sass to css'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
css
=
sass
.
renderSync
(
src
).
trim
();
assert
.
equal
(
css
,
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
});
it
(
'should compile sass to css using indented syntax'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'indent/index.sass'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
();
var
css
=
sass
.
renderSync
(
src
,
{
indentedSyntax
:
true
}).
trim
();
assert
.
equal
(
sass
.
renderSync
(
src
).
trim
()
,
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
assert
.
equal
(
css
,
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -61,6 +84,20 @@ describe('api', function() {
...
@@ -61,6 +84,20 @@ describe('api', function() {
});
});
});
});
it
(
'should compile sass to css using indented syntax'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'indent/index.sass'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
();
sass
.
render
({
data
:
src
,
indentedSyntax
:
true
,
success
:
function
(
css
)
{
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
}
});
});
it
(
'should throw error status 1 for bad input'
,
function
(
done
)
{
it
(
'should throw error status 1 for bad input'
,
function
(
done
)
{
sass
.
render
({
sass
.
render
({
data
:
'#navbar width 80%;'
,
data
:
'#navbar width 80%;'
,
...
@@ -150,14 +187,27 @@ describe('api', function() {
...
@@ -150,14 +187,27 @@ describe('api', function() {
it
(
'should compile sass to css'
,
function
(
done
)
{
it
(
'should compile sass to css'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
css
=
sass
.
renderSync
({
data
:
src
}).
trim
();
assert
.
equal
(
css
,
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
});
assert
.
equal
(
sass
.
renderSync
({
data
:
src
}).
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
it
(
'should compile sass to css using indented syntax'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'indent/index.sass'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
();
var
css
=
sass
.
renderSync
({
data
:
src
,
indentedSyntax
:
true
}).
trim
();
assert
.
equal
(
css
,
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
it
(
'should throw error for bad input'
,
function
(
done
)
{
it
(
'should throw error for bad input'
,
function
(
done
)
{
assert
.
throws
(
function
()
{
assert
.
throws
(
function
()
{
sass
.
renderSync
({
data
:
'#navbar width 80%;'
});
sass
.
renderSync
({
data
:
'#navbar width 80%;'
});
});
});
done
();
done
();
...
@@ -165,7 +215,7 @@ describe('api', function() {
...
@@ -165,7 +215,7 @@ describe('api', function() {
});
});
describe
(
'.renderFile(options)'
,
function
()
{
describe
(
'.renderFile(options)'
,
function
()
{
it
(
'should compile
with renderFile
'
,
function
(
done
)
{
it
(
'should compile
sass to css
'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
dest
=
fixture
(
'simple/build.css'
);
var
dest
=
fixture
(
'simple/build.css'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
...
@@ -181,6 +231,23 @@ describe('api', function() {
...
@@ -181,6 +231,23 @@ describe('api', function() {
});
});
});
});
it
(
'should compile sass to css using indented syntax'
,
function
(
done
)
{
var
src
=
read
(
fixture
(
'indent/index.sass'
),
'utf8'
);
var
dest
=
fixture
(
'indent/build.css'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
();
sass
.
renderFile
({
data
:
src
,
outFile
:
dest
,
indentedSyntax
:
true
,
success
:
function
()
{
assert
.
equal
(
read
(
dest
,
'utf8'
).
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
fs
.
unlinkSync
(
dest
);
done
();
}
});
});
it
(
'should save source map to default name'
,
function
(
done
)
{
it
(
'should save source map to default name'
,
function
(
done
)
{
var
src
=
fixture
(
'source-map/index.scss'
);
var
src
=
fixture
(
'source-map/index.scss'
);
var
dest
=
fixture
(
'source-map/build.css'
);
var
dest
=
fixture
(
'source-map/build.css'
);
...
@@ -241,7 +308,7 @@ describe('api', function() {
...
@@ -241,7 +308,7 @@ describe('api', function() {
});
});
});
});
describe
(
'.render({
stats: {}
})'
,
function
()
{
describe
(
'.render({
stats: {}
})'
,
function
()
{
var
start
=
Date
.
now
();
var
start
=
Date
.
now
();
var
stats
=
{};
var
stats
=
{};
...
@@ -345,7 +412,7 @@ describe('api', function() {
...
@@ -345,7 +412,7 @@ describe('api', function() {
});
});
});
});
describe
(
'.renderSync({
stats: {}
})'
,
function
()
{
describe
(
'.renderSync({
stats: {}
})'
,
function
()
{
var
start
=
Date
.
now
();
var
start
=
Date
.
now
();
var
stats
=
{};
var
stats
=
{};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment