scss_test.js 3.1 KB

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