templates/static/js/codemirror/mode/stex/test.js in swagr-0.0.8 vs templates/static/js/codemirror/mode/stex/test.js in swagr-0.0.10
- old
+ new
@@ -1,343 +1,104 @@
-var MT = ModeTest;
-MT.modeName = 'stex';
-MT.modeOptions = {};
+(function() {
+ var mode = CodeMirror.getMode({tabSize: 4}, "stex");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
-MT.testMode(
- 'word',
- 'foo',
- [
- null, 'foo'
- ]
-);
+ MT("word",
+ "foo");
-MT.testMode(
- 'twoWords',
- 'foo bar',
- [
- null, 'foo bar'
- ]
-);
+ MT("twoWords",
+ "foo bar");
-MT.testMode(
- 'beginEndDocument',
- '\\begin{document}\n\\end{document}',
- [
- 'tag', '\\begin',
- 'bracket', '{',
- 'atom', 'document',
- 'bracket', '}',
- 'tag', '\\end',
- 'bracket', '{',
- 'atom', 'document',
- 'bracket', '}'
- ]
-);
+ MT("beginEndDocument",
+ "[tag \\begin][bracket {][atom document][bracket }]",
+ "[tag \\end][bracket {][atom document][bracket }]");
-MT.testMode(
- 'beginEndEquation',
- '\\begin{equation}\n E=mc^2\n\\end{equation}',
- [
- 'tag', '\\begin',
- 'bracket', '{',
- 'atom', 'equation',
- 'bracket', '}',
- null, ' E=mc^2',
- 'tag', '\\end',
- 'bracket', '{',
- 'atom', 'equation',
- 'bracket', '}'
- ]
-);
+ MT("beginEndEquation",
+ "[tag \\begin][bracket {][atom equation][bracket }]",
+ " E=mc^2",
+ "[tag \\end][bracket {][atom equation][bracket }]");
-MT.testMode(
- 'beginModule',
- '\\begin{module}[]',
- [
- 'tag', '\\begin',
- 'bracket', '{',
- 'atom', 'module',
- 'bracket', '}[]'
- ]
-);
+ MT("beginModule",
+ "[tag \\begin][bracket {][atom module][bracket }[[]]]");
-MT.testMode(
- 'beginModuleId',
- '\\begin{module}[id=bbt-size]',
- [
- 'tag', '\\begin',
- 'bracket', '{',
- 'atom', 'module',
- 'bracket', '}[',
- null, 'id=bbt-size',
- 'bracket', ']'
- ]
-);
+ MT("beginModuleId",
+ "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
-MT.testMode(
- 'importModule',
- '\\importmodule[b-b-t]{b-b-t}',
- [
- 'tag', '\\importmodule',
- 'bracket', '[',
- 'string', 'b-b-t',
- 'bracket', ']{',
- 'builtin', 'b-b-t',
- 'bracket', '}'
- ]
-);
+ MT("importModule",
+ "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
-MT.testMode(
- 'importModulePath',
- '\\importmodule[\\KWARCslides{dmath/en/cardinality}]{card}',
- [
- 'tag', '\\importmodule',
- 'bracket', '[',
- 'tag', '\\KWARCslides',
- 'bracket', '{',
- 'string', 'dmath/en/cardinality',
- 'bracket', '}]{',
- 'builtin', 'card',
- 'bracket', '}'
- ]
-);
+ MT("importModulePath",
+ "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
-MT.testMode(
- 'psForPDF',
- '\\PSforPDF[1]{#1}', // could treat #1 specially
- [
- 'tag', '\\PSforPDF',
- 'bracket', '[',
- 'atom', '1',
- 'bracket', ']{',
- null, '#1',
- 'bracket', '}'
- ]
-);
+ MT("psForPDF",
+ "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
-MT.testMode(
- 'comment',
- '% foo',
- [
- 'comment', '% foo'
- ]
-);
+ MT("comment",
+ "[comment % foo]");
-MT.testMode(
- 'tagComment',
- '\\item% bar',
- [
- 'tag', '\\item',
- 'comment', '% bar'
- ]
-);
+ MT("tagComment",
+ "[tag \\item][comment % bar]");
-MT.testMode(
- 'commentTag',
- ' % \\item',
- [
- null, ' ',
- 'comment', '% \\item'
- ]
-);
+ MT("commentTag",
+ " [comment % \\item]");
-MT.testMode(
- 'commentLineBreak',
- '%\nfoo',
- [
- 'comment', '%',
- null, 'foo'
- ]
-);
+ MT("commentLineBreak",
+ "[comment %]",
+ "foo");
-MT.testMode(
- 'tagErrorCurly',
- '\\begin}{',
- [
- 'tag', '\\begin',
- 'error', '}',
- 'bracket', '{'
- ]
-);
+ MT("tagErrorCurly",
+ "[tag \\begin][error }][bracket {]");
-MT.testMode(
- 'tagErrorSquare',
- '\\item]{',
- [
- 'tag', '\\item',
- 'error', ']',
- 'bracket', '{'
- ]
-);
+ MT("tagErrorSquare",
+ "[tag \\item][error ]]][bracket {]");
-MT.testMode(
- 'commentCurly',
- '% }',
- [
- 'comment', '% }'
- ]
-);
+ MT("commentCurly",
+ "[comment % }]");
-MT.testMode(
- 'tagHash',
- 'the \\# key',
- [
- null, 'the ',
- 'tag', '\\#',
- null, ' key'
- ]
-);
+ MT("tagHash",
+ "the [tag \\#] key");
-MT.testMode(
- 'tagNumber',
- 'a \\$5 stetson',
- [
- null, 'a ',
- 'tag', '\\$',
- 'atom', 5,
- null, ' stetson'
- ]
-);
+ MT("tagNumber",
+ "a [tag \\$][atom 5] stetson");
-MT.testMode(
- 'tagPercent',
- '100\\% beef',
- [
- 'atom', '100',
- 'tag', '\\%',
- null, ' beef'
- ]
-);
+ MT("tagPercent",
+ "[atom 100][tag \\%] beef");
-MT.testMode(
- 'tagAmpersand',
- 'L \\& N',
- [
- null, 'L ',
- 'tag', '\\&',
- null, ' N'
- ]
-);
+ MT("tagAmpersand",
+ "L [tag \\&] N");
-MT.testMode(
- 'tagUnderscore',
- 'foo\\_bar',
- [
- null, 'foo',
- 'tag', '\\_',
- null, 'bar'
- ]
-);
+ MT("tagUnderscore",
+ "foo[tag \\_]bar");
-MT.testMode(
- 'tagBracketOpen',
- '\\emph{\\{}',
- [
- 'tag', '\\emph',
- 'bracket', '{',
- 'tag', '\\{',
- 'bracket', '}'
- ]
-);
+ MT("tagBracketOpen",
+ "[tag \\emph][bracket {][tag \\{][bracket }]");
-MT.testMode(
- 'tagBracketClose',
- '\\emph{\\}}',
- [
- 'tag', '\\emph',
- 'bracket', '{',
- 'tag', '\\}',
- 'bracket', '}'
- ]
-);
+ MT("tagBracketClose",
+ "[tag \\emph][bracket {][tag \\}][bracket }]");
-MT.testMode(
- 'tagLetterNumber',
- 'section \\S1',
- [
- null, 'section ',
- 'tag', '\\S',
- 'atom', '1'
- ]
-);
+ MT("tagLetterNumber",
+ "section [tag \\S][atom 1]");
-MT.testMode(
- 'textTagNumber',
- 'para \\P2',
- [
- null, 'para ',
- 'tag', '\\P',
- 'atom', '2'
- ]
-);
+ MT("textTagNumber",
+ "para [tag \\P][atom 2]");
-MT.testMode(
- 'thinspace',
- 'x\\,y', // thinspace
- [
- null, 'x',
- 'tag', '\\,',
- null, 'y'
- ]
-);
+ MT("thinspace",
+ "x[tag \\,]y");
-MT.testMode(
- 'thickspace',
- 'x\\;y', // thickspace
- [
- null, 'x',
- 'tag', '\\;',
- null, 'y'
- ]
-);
+ MT("thickspace",
+ "x[tag \\;]y");
-MT.testMode(
- 'negativeThinspace',
- 'x\\!y', // negative thinspace
- [
- null, 'x',
- 'tag', '\\!',
- null, 'y'
- ]
-);
+ MT("negativeThinspace",
+ "x[tag \\!]y");
-MT.testMode(
- 'periodNotSentence',
- 'J.\\ L.\\ is', // period not ending a sentence
- [
- null, 'J.\\ L.\\ is'
- ]
-); // maybe could be better
+ MT("periodNotSentence",
+ "J.\\ L.\\ is");
-MT.testMode(
- 'periodSentence',
- 'X\\@. The', // period ending a sentence
- [
- null, 'X',
- 'tag', '\\@',
- null, '. The'
- ]
-);
+ MT("periodSentence",
+ "X[tag \\@]. The");
-MT.testMode(
- 'italicCorrection',
- '{\\em If\\/} I', // italic correction
- [
- 'bracket', '{',
- 'tag', '\\em',
- null, ' If',
- 'tag', '\\/',
- 'bracket', '}',
- null, ' I'
- ]
-);
+ MT("italicCorrection",
+ "[bracket {][tag \\em] If[tag \\/][bracket }] I");
-MT.testMode(
- 'tagBracket',
- '\\newcommand{\\pop}',
- [
- 'tag', '\\newcommand',
- 'bracket', '{',
- 'tag', '\\pop',
- 'bracket', '}'
- ]
-);
\ No newline at end of file
+ MT("tagBracket",
+ "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
+})();