test.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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({tabSize: 4}, "stex");
  5. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  6. MT("word",
  7. "foo");
  8. MT("twoWords",
  9. "foo bar");
  10. MT("beginEndDocument",
  11. "[tag \\begin][bracket {][atom document][bracket }]",
  12. "[tag \\end][bracket {][atom document][bracket }]");
  13. MT("beginEndEquation",
  14. "[tag \\begin][bracket {][atom equation][bracket }]",
  15. " E=mc^2",
  16. "[tag \\end][bracket {][atom equation][bracket }]");
  17. MT("beginModule",
  18. "[tag \\begin][bracket {][atom module][bracket }[[]]]");
  19. MT("beginModuleId",
  20. "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
  21. MT("importModule",
  22. "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
  23. MT("importModulePath",
  24. "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
  25. MT("psForPDF",
  26. "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
  27. MT("comment",
  28. "[comment % foo]");
  29. MT("tagComment",
  30. "[tag \\item][comment % bar]");
  31. MT("commentTag",
  32. " [comment % \\item]");
  33. MT("commentLineBreak",
  34. "[comment %]",
  35. "foo");
  36. MT("tagErrorCurly",
  37. "[tag \\begin][error }][bracket {]");
  38. MT("tagErrorSquare",
  39. "[tag \\item][error ]]][bracket {]");
  40. MT("commentCurly",
  41. "[comment % }]");
  42. MT("tagHash",
  43. "the [tag \\#] key");
  44. MT("tagNumber",
  45. "a [tag \\$][atom 5] stetson");
  46. MT("tagPercent",
  47. "[atom 100][tag \\%] beef");
  48. MT("tagAmpersand",
  49. "L [tag \\&] N");
  50. MT("tagUnderscore",
  51. "foo[tag \\_]bar");
  52. MT("tagBracketOpen",
  53. "[tag \\emph][bracket {][tag \\{][bracket }]");
  54. MT("tagBracketClose",
  55. "[tag \\emph][bracket {][tag \\}][bracket }]");
  56. MT("tagLetterNumber",
  57. "section [tag \\S][atom 1]");
  58. MT("textTagNumber",
  59. "para [tag \\P][atom 2]");
  60. MT("thinspace",
  61. "x[tag \\,]y");
  62. MT("thickspace",
  63. "x[tag \\;]y");
  64. MT("negativeThinspace",
  65. "x[tag \\!]y");
  66. MT("periodNotSentence",
  67. "J.\\ L.\\ is");
  68. MT("periodSentence",
  69. "X[tag \\@]. The");
  70. MT("italicCorrection",
  71. "[bracket {][tag \\em] If[tag \\/][bracket }] I");
  72. MT("tagBracket",
  73. "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
  74. MT("inlineMathTagFollowedByNumber",
  75. "[keyword $][tag \\pi][number 2][keyword $]");
  76. MT("inlineMath",
  77. "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
  78. MT("displayMath",
  79. "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
  80. MT("mathWithComment",
  81. "[keyword $][variable-2 x] [comment % $]",
  82. "[variable-2 y][keyword $] other text");
  83. MT("lineBreakArgument",
  84. "[tag \\\\][bracket [[][atom 1cm][bracket ]]]");
  85. })();