Index: trunk/extensions/VisualEditor/tests/parser/parserTests-whitelist.js |
— | — | @@ -12,10 +12,39 @@ |
13 | 13 | |
14 | 14 | testWhiteList["Unclosed and unmatched quotes"] = "<p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i></p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b></p><p><b>Bold text..</b></p><p>..spanning two paragraphs (should not work).<b></b></p><p><b>Bold tag left open</b></p><p><i>Italic tag left open</i></p><p>Normal text.<!-- Unmatching number of opening, closing tags: -->\n</p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.</p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.</p>"; |
15 | 15 | |
| 16 | +testWhiteList["Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)"] = "<p><i>Some <a data-type=\"internal\" href=\"Link\">pretty </a></i><a data-type=\"internal\" href=\"Link\">italics<i> and stuff</i></a><i>!</i></p>"; |
| 17 | + |
| 18 | +testWhiteList["External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)"] = "<p><i>Some <a href=\"http://example.com/\">pretty </a></i><a href=\"http://example.com/\">italics<i> and stuff</i></a><i>!</i></p>"; |
| 19 | + |
| 20 | + |
| 21 | + |
16 | 22 | // empty table tags / with only a caption are legal in HTML5. |
17 | 23 | testWhiteList["A table with no data."] = "<table></table>"; |
18 | 24 | testWhiteList["A table with nothing but a caption"] = "<table><caption> caption</caption></table>"; |
19 | 25 | |
| 26 | +// MediaWiki changes the order of attributes in tables, ignore that |
| 27 | +testWhiteList["Multiplication table"] = "<table border=\"1\" cellpadding=\"2\"><caption>Multiplication table</caption><tbody><tr><th> × </th><th> 1 </th><th> 2 </th><th> 3</th></tr><tr><th> 1</th><td> 1 </td><td> 2 </td><td> 3</td></tr><tr><th> 2</th><td> 2 </td><td> 4 </td><td> 6</td></tr><tr><th> 3</th><td> 3 </td><td> 6 </td><td> 9</td></tr><tr><th> 4</th><td> 4 </td><td> 8 </td><td> 12</td></tr><tr><th> 5</th><td> 5 </td><td> 10 </td><td> 15</td></tr></tbody></table>"; |
| 28 | + |
| 29 | +testWhiteList["Nested table"] = "<table border=\"1\"><tbody><tr><td> α</td><td><table bgcolor=\"#ABCDEF\" border=\"2\"><tbody><tr><td>nested</td></tr><tr><td>table</td></tr></tbody></table></td><td>the original table again</td></tr></tbody></table>"; |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +/* Missing token transform functionality */ |
| 34 | + |
| 35 | +// We don't implement percent encoding for URIs yet. |
| 36 | +testWhiteList["Link containing double-single-quotes '' (bug 4598)"] = "<p><a data-type=\"internal\" href=\"Lista d''e paise d''o munno\">Lista d''e paise d''o munno</a></p>"; |
| 37 | + |
| 38 | +testWhiteList["Link containing \"<#\" and \">#\" as a hex sequences"] = "<p><a data-type=\"internal\" href=\"<%23\"><%23</a><a data-type=\"internal\" href=\">%23\">>%23</a></p>"; |
| 39 | + |
| 40 | + |
| 41 | +// Sanitizer |
| 42 | +testWhiteList["Invalid attributes in table cell (bug 1830)"] = "<table><tbody><tr><td Cell:=\"\">broken</td></tr></tbody></table>"; |
| 43 | +testWhiteList["Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)"] = "<table><tbody><tr><td> |<a href=\"ftp://|x||\">[1]</a>\" onmouseover=\"alert(document.cookie)\">test</td></tr></tbody></table>"; |
| 44 | + |
| 45 | +// Sanitizer, but UTF8 in link might actually be ok in HTML5 |
| 46 | +testWhiteList["External link containing double-single-quotes with no space separating the url from text in italics"] = "<p><a href=\"http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm\"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a data-type=\"internal\" href=\"Museo Picasso (París)\">Museo Picasso</a></p>"; |
| 47 | + |
| 48 | + |
20 | 49 | if (typeof module == "object") { |
21 | 50 | module.exports.testWhiteList = testWhiteList; |
22 | 51 | } |