-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #751 from Golmote/tests-stylus
Add tests for Stylus
- Loading branch information
Showing
14 changed files
with
709 additions
and
0 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,31 @@ | ||
@media print | ||
@import "reset.css" | ||
@font-face { | ||
@keyframes { | ||
@media (max-{foo}: bar) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["atrule-declaration", [["atrule", "@media"], " print"]], | ||
["atrule-declaration", [["atrule", "@import"], ["string", "\"reset.css\""]]], | ||
["atrule-declaration", [["atrule", "@font-face"], ["punctuation", "{"]]], | ||
["atrule-declaration", [["atrule", "@keyframes"], ["punctuation", "{"]]], | ||
["atrule-declaration", [ | ||
["atrule", "@media"], | ||
["punctuation", "("], | ||
"max-", | ||
["interpolation", [ | ||
["punctuation", "{"], | ||
"foo", | ||
["punctuation", "}"] | ||
]], | ||
["punctuation", ":"], | ||
" bar", | ||
["punctuation", ")"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for at-rules. |
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,21 @@ | ||
a = true | ||
b = false | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["variable-declaration", [ | ||
["variable", "a"], | ||
["operator", "="], | ||
["boolean", "true"] | ||
]], | ||
["variable-declaration", [ | ||
["variable", "b"], | ||
["operator", "="], | ||
["boolean", "false"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for booleans. |
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,18 @@ | ||
/**/ | ||
/* foo | ||
bar */ | ||
// | ||
// foobar | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "/**/"], | ||
["comment", "/* foo\r\nbar */"], | ||
["comment", "//"], | ||
["comment", "// foobar"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
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,51 @@ | ||
border-radius(n) | ||
-webkit-border-radius n | ||
-moz-border-radius n | ||
border-radius n | ||
|
||
form input[type=button] | ||
border-radius(5px) | ||
color foo() | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["func", [ | ||
["function", "border-radius"], | ||
["punctuation", "("], | ||
"n", | ||
["punctuation", ")"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["-webkit-border-radius"]], | ||
" n" | ||
]], | ||
["property-declaration", [ | ||
["property", ["-moz-border-radius"]], | ||
" n" | ||
]], | ||
["property-declaration", [ | ||
["property", ["border-radius"]], | ||
" n" | ||
]], | ||
["selector", ["form input[type=button]"]], | ||
["func", [ | ||
["function", "border-radius"], | ||
["punctuation", "("], | ||
["number", "5"], | ||
"px", | ||
["punctuation", ")"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["color"]], | ||
["func", [ | ||
["function", "foo"], | ||
["punctuation", "("], | ||
["punctuation", ")"] | ||
]] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for functions. |
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,29 @@ | ||
color: #fff | ||
color: #FA3 | ||
color: #f7c111 | ||
color: #9F4ABB | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["property-declaration", [ | ||
["property", ["color"]], ["punctuation", ":"], | ||
["hexcode", "#fff"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["color"]], ["punctuation", ":"], | ||
["hexcode", "#FA3"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["color"]], ["punctuation", ":"], | ||
["hexcode", "#f7c111"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["color"]], ["punctuation", ":"], | ||
["hexcode", "#9F4ABB"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for hexadecimal values. |
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,22 @@ | ||
color: red !important | ||
@extend foo !optional | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["property-declaration", [ | ||
["property", ["color"]], | ||
["punctuation", ":"], | ||
" red ", | ||
["important", "!important"] | ||
]], | ||
["atrule-declaration", [ | ||
["atrule", "@extend"], | ||
" foo ", | ||
["important", "!optional"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for !important and !optional. |
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,44 @@ | ||
for i in 1..5 | ||
if a == 3 | ||
z-index: 1 unless @z-index; | ||
return pair[1] if pair[0] == key for pair in hash | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["statement", [ | ||
["keyword", "for"], | ||
" i ", | ||
["operator", "in"], | ||
["number", "1"], | ||
["operator", ".."], | ||
["number", "5"] | ||
]], | ||
["statement", [ | ||
["keyword", "if"], | ||
" a ", | ||
["operator", "=="], | ||
["number", "3"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["z-index"]], | ||
["punctuation", ":"], | ||
["number", "1"], | ||
["keyword", "unless"], | ||
["keyword", "@z-index"], | ||
["punctuation", ";"] | ||
]], | ||
["statement", [ | ||
["keyword", "return"], " pair", | ||
["punctuation", "["], ["number", "1"], ["punctuation", "]"], | ||
["keyword", "if"], " pair", | ||
["punctuation", "["], ["number", "0"], ["punctuation", "]"], | ||
["operator", "=="], " key ", | ||
["keyword", "for"], " pair ", | ||
["operator", "in"], " hash" | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for statements and keywords. |
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,32 @@ | ||
z-index 42 | ||
foo = 3.14159 | ||
width: 23% | ||
bar = 1.5% | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["property-declaration", [ | ||
["property", ["z-index"]], | ||
["number", "42"] | ||
]], | ||
["variable-declaration", [ | ||
["variable", "foo"], | ||
["operator", "="], | ||
["number", "3.14159"] | ||
]], | ||
["property-declaration", [ | ||
["property", ["width"]], | ||
["punctuation", ":"], | ||
["number", "23%"] | ||
]], | ||
["variable-declaration", [ | ||
["variable", "bar"], | ||
["operator", "="], | ||
["number", "1.5%"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for numbers and percentages. |
Oops, something went wrong.