scss_test.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/LICENSE
  3. ;(function () {
  4. var mode = CodeMirror.getMode({ indentUnit: 2 }, 'text/x-scss')
  5. function MT(name) {
  6. test.mode(name, mode, Array.prototype.slice.call(arguments, 1), 'scss')
  7. }
  8. MT('url_with_quotation', '[tag foo] { [property background]:[variable&callee url]([string test.jpg]) }')
  9. MT('url_with_double_quotes', '[tag foo] { [property background]:[variable&callee url]([string "test.jpg"]) }')
  10. MT('url_with_single_quotes', "[tag foo] { [property background]:[variable&callee url]([string 'test.jpg']) }")
  11. MT('string', '[def @import] [string "compass/css3"]')
  12. MT('important_keyword', "[tag foo] { [property background]:[variable&callee url]([string 'test.jpg']) [keyword !important] }")
  13. MT('variable', '[variable-2 $blue]:[atom #333]')
  14. MT('variable_as_attribute', '[tag foo] { [property color]:[variable-2 $blue] }')
  15. MT('numbers', '[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }')
  16. MT('number_percentage', '[tag foo] { [property width]:[number 80%] }')
  17. MT('selector', '[builtin #hello][qualifier .world]{}')
  18. MT('singleline_comment', '[comment // this is a comment]')
  19. MT('multiline_comment', '[comment /*foobar*/]')
  20. MT('attribute_with_hyphen', '[tag foo] { [property font-size]:[number 10px] }')
  21. MT('string_after_attribute', '[tag foo] { [property content]:[string "::"] }')
  22. MT('directives', '[def @include] [qualifier .mixin]')
  23. MT('basic_structure', '[tag p] { [property background]:[keyword red]; }')
  24. MT('nested_structure', '[tag p] { [tag a] { [property color]:[keyword red]; } }')
  25. MT('mixin', '[def @mixin] [tag table-base] {}')
  26. MT('number_without_semicolon', '[tag p] {[property width]:[number 12]}', '[tag a] {[property color]:[keyword red];}')
  27. MT('atom_in_nested_block', '[tag p] { [tag a] { [property color]:[atom #000]; } }')
  28. MT('interpolation_in_property', '[tag foo] { #{[variable-2 $hello]}:[number 2]; }')
  29. MT('interpolation_in_selector', '[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }')
  30. MT('interpolation_error', '[tag foo]#{[variable foo]} { [property color]:[atom #000]; }')
  31. MT('divide_operator', '[tag foo] { [property width]:[number 4] [operator /] [number 2] }')
  32. MT('nested_structure_with_id_selector', '[tag p] { [builtin #hello] { [property color]:[keyword red]; } }')
  33. MT('indent_mixin', '[def @mixin] [tag container] (', ' [variable-2 $a]: [number 10],', ' [variable-2 $b]: [number 10])', '{}')
  34. MT('indent_nested', '[tag foo] {', ' [tag bar] {', ' }', '}')
  35. MT('indent_parentheses', '[tag foo] {', ' [property color]: [variable&callee darken]([variable-2 $blue],', ' [number 9%]);', '}')
  36. MT('indent_vardef', '[variable-2 $name]:', " [string 'val'];", '[tag tag] {', ' [tag inner] {', ' [property margin]: [number 3px];', ' }', '}')
  37. })()