1
0

test.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. (function() {
  2. var mode = CodeMirror.getMode({tabSize: 4}, "haml");
  3. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  4. // Requires at least one media query
  5. MT("elementName",
  6. "[tag %h1] Hey There");
  7. MT("oneElementPerLine",
  8. "[tag %h1] Hey There %h2");
  9. MT("idSelector",
  10. "[tag %h1][attribute #test] Hey There");
  11. MT("classSelector",
  12. "[tag %h1][attribute .hello] Hey There");
  13. MT("docType",
  14. "[tag !!! XML]");
  15. MT("comment",
  16. "[comment / Hello WORLD]");
  17. MT("notComment",
  18. "[tag %h1] This is not a / comment ");
  19. MT("attributes",
  20. "[tag %a]([variable title][operator =][string \"test\"]){[atom :title] [operator =>] [string \"test\"]}");
  21. MT("htmlCode",
  22. "[tag <h1>]Title[tag </h1>]");
  23. MT("rubyBlock",
  24. "[operator =][variable-2 @item]");
  25. MT("selectorRubyBlock",
  26. "[tag %a.selector=] [variable-2 @item]");
  27. MT("nestedRubyBlock",
  28. "[tag %a]",
  29. " [operator =][variable puts] [string \"test\"]");
  30. MT("multilinePlaintext",
  31. "[tag %p]",
  32. " Hello,",
  33. " World");
  34. MT("multilineRuby",
  35. "[tag %p]",
  36. " [comment -# this is a comment]",
  37. " [comment and this is a comment too]",
  38. " Date/Time",
  39. " [operator -] [variable now] [operator =] [tag DateTime][operator .][variable now]",
  40. " [tag %strong=] [variable now]",
  41. " [operator -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][variable parse]([string \"December 31, 2006\"])",
  42. " [operator =][string \"Happy\"]",
  43. " [operator =][string \"Belated\"]",
  44. " [operator =][string \"Birthday\"]");
  45. MT("multilineComment",
  46. "[comment /]",
  47. " [comment Multiline]",
  48. " [comment Comment]");
  49. MT("hamlComment",
  50. "[comment -# this is a comment]");
  51. MT("multilineHamlComment",
  52. "[comment -# this is a comment]",
  53. " [comment and this is a comment too]");
  54. MT("multilineHTMLComment",
  55. "[comment <!--]",
  56. " [comment what a comment]",
  57. " [comment -->]");
  58. MT("hamlAfterRubyTag",
  59. "[attribute .block]",
  60. " [tag %strong=] [variable now]",
  61. " [attribute .test]",
  62. " [operator =][variable now]",
  63. " [attribute .right]");
  64. MT("stretchedRuby",
  65. "[operator =] [variable puts] [string \"Hello\"],",
  66. " [string \"World\"]");
  67. MT("interpolationInHashAttribute",
  68. //"[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
  69. "[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
  70. MT("interpolationInHTMLAttribute",
  71. "[tag %div]([variable title][operator =][string \"#{][variable test][string }_#{][variable ting]()[string }\"]) Test");
  72. })();