all repos — NoPaste @ 3e3c433f026c49e04d0efa0f0f39fc688ed32bb1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/xml/test.js (view raw)

 1// CodeMirror, copyright (c) by Marijn Haverbeke and others
 2// Distributed under an MIT license: https://codemirror.net/LICENSE
 3
 4(function() {
 5  var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml";
 6  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); }
 7
 8  MT("matching",
 9     "[tag&bracket <][tag top][tag&bracket >]",
10     "  text",
11     "  [tag&bracket <][tag inner][tag&bracket />]",
12     "[tag&bracket </][tag top][tag&bracket >]");
13
14  MT("nonmatching",
15     "[tag&bracket <][tag top][tag&bracket >]",
16     "  [tag&bracket <][tag inner][tag&bracket />]",
17     "  [tag&bracket </][tag&error tip][tag&bracket&error >]");
18
19  MT("doctype",
20     "[meta <!doctype foobar>]",
21     "[tag&bracket <][tag top][tag&bracket />]");
22
23  MT("cdata",
24     "[tag&bracket <][tag top][tag&bracket >]",
25     "  [atom <![CDATA[foo]",
26     "[atom barbazguh]]]]>]",
27     "[tag&bracket </][tag top][tag&bracket >]");
28
29  // HTML tests
30  mode = CodeMirror.getMode({indentUnit: 2}, "text/html");
31
32  MT("selfclose",
33     "[tag&bracket <][tag html][tag&bracket >]",
34     "  [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]",
35     "[tag&bracket </][tag html][tag&bracket >]");
36
37  MT("list",
38     "[tag&bracket <][tag ol][tag&bracket >]",
39     "  [tag&bracket <][tag li][tag&bracket >]one",
40     "  [tag&bracket <][tag li][tag&bracket >]two",
41     "[tag&bracket </][tag ol][tag&bracket >]");
42
43  MT("valueless",
44     "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]");
45
46  MT("pThenArticle",
47     "[tag&bracket <][tag p][tag&bracket >]",
48     "  foo",
49     "[tag&bracket <][tag article][tag&bracket >]bar");
50
51})();