| 1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 |
// Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 |
|
| 4 |
(function() { |
| 5 |
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss"); |
| 6 |
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); } |
| 7 |
|
| 8 |
MT('url_with_quotation', |
| 9 |
"[tag foo] { [property background]:[atom url]([string test.jpg]) }"); |
| 10 |
|
| 11 |
MT('url_with_double_quotes', |
| 12 |
"[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }"); |
| 13 |
|
| 14 |
MT('url_with_single_quotes', |
| 15 |
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }"); |
| 16 |
|
| 17 |
MT('string', |
| 18 |
"[def @import] [string \"compass/css3\"]"); |
| 19 |
|
| 20 |
MT('important_keyword', |
| 21 |
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }"); |
| 22 |
|
| 23 |
MT('variable', |
| 24 |
"[variable-2 $blue]:[atom #333]"); |
| 25 |
|
| 26 |
MT('variable_as_attribute', |
| 27 |
"[tag foo] { [property color]:[variable-2 $blue] }"); |
| 28 |
|
| 29 |
MT('numbers', |
| 30 |
"[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }"); |
| 31 |
|
| 32 |
MT('number_percentage', |
| 33 |
"[tag foo] { [property width]:[number 80%] }"); |
| 34 |
|
| 35 |
MT('selector', |
| 36 |
"[builtin #hello][qualifier .world]{}"); |
| 37 |
|
| 38 |
MT('singleline_comment', |
| 39 |
"[comment // this is a comment]"); |
| 40 |
|
| 41 |
MT('multiline_comment', |
| 42 |
"[comment /*foobar*/]"); |
| 43 |
|
| 44 |
MT('attribute_with_hyphen', |
| 45 |
"[tag foo] { [property font-size]:[number 10px] }"); |
| 46 |
|
| 47 |
MT('string_after_attribute', |
| 48 |
"[tag foo] { [property content]:[string \"::\"] }"); |
| 49 |
|
| 50 |
MT('directives', |
| 51 |
"[def @include] [qualifier .mixin]"); |
| 52 |
|
| 53 |
MT('basic_structure', |
| 54 |
"[tag p] { [property background]:[keyword red]; }"); |
| 55 |
|
| 56 |
MT('nested_structure', |
| 57 |
"[tag p] { [tag a] { [property color]:[keyword red]; } }"); |
| 58 |
|
| 59 |
MT('mixin', |
| 60 |
"[def @mixin] [tag table-base] {}"); |
| 61 |
|
| 62 |
MT('number_without_semicolon', |
| 63 |
"[tag p] {[property width]:[number 12]}", |
| 64 |
"[tag a] {[property color]:[keyword red];}"); |
| 65 |
|
| 66 |
MT('atom_in_nested_block', |
| 67 |
"[tag p] { [tag a] { [property color]:[atom #000]; } }"); |
| 68 |
|
| 69 |
MT('interpolation_in_property', |
| 70 |
"[tag foo] { #{[variable-2 $hello]}:[number 2]; }"); |
| 71 |
|
| 72 |
MT('interpolation_in_selector', |
| 73 |
"[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }"); |
| 74 |
|
| 75 |
MT('interpolation_error', |
| 76 |
"[tag foo]#{[variable foo]} { [property color]:[atom #000]; }"); |
| 77 |
|
| 78 |
MT("divide_operator", |
| 79 |
"[tag foo] { [property width]:[number 4] [operator /] [number 2] }"); |
| 80 |
|
| 81 |
MT('nested_structure_with_id_selector', |
| 82 |
"[tag p] { [builtin #hello] { [property color]:[keyword red]; } }"); |
| 83 |
|
| 84 |
MT('indent_mixin', |
| 85 |
"[def @mixin] [tag container] (", |
| 86 |
" [variable-2 $a]: [number 10],", |
| 87 |
" [variable-2 $b]: [number 10])", |
| 88 |
"{}"); |
| 89 |
|
| 90 |
MT('indent_nested', |
| 91 |
"[tag foo] {", |
| 92 |
" [tag bar] {", |
| 93 |
" }", |
| 94 |
"}"); |
| 95 |
|
| 96 |
MT('indent_parentheses', |
| 97 |
"[tag foo] {", |
| 98 |
" [property color]: [atom darken]([variable-2 $blue],", |
| 99 |
" [number 9%]);", |
| 100 |
"}"); |
| 101 |
|
| 102 |
MT('indent_vardef', |
| 103 |
"[variable-2 $name]:", |
| 104 |
" [string 'val'];", |
| 105 |
"[tag tag] {", |
| 106 |
" [tag inner] {", |
| 107 |
" [property margin]: [number 3px];", |
| 108 |
" }", |
| 109 |
"}"); |
| 110 |
})(); |
| 111 |
|