OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 function test() | 6 function test() |
7 { | 7 { |
8 InspectorTest.registerModule("documentation", true); | 8 InspectorTest.registerModule("documentation", true); |
9 | 9 |
10 InspectorTest.runTestSuite([ | 10 InspectorTest.runTestSuite([ |
11 function testWikiParser(next) | 11 function testWikiParser(next) |
12 { | 12 { |
13 var testCases = [ | 13 var testCases = [ |
| 14 "{{A|text=<code>it's not a code <code>}}", |
| 15 "{{A|Code={{=}} }}", |
| 16 "{{ABC|Array={{A|B=c}}{{X|y=Z}}|text=blabla}}", |
| 17 "{{A|B=C}}", |
14 "{{A|B={{C|D=blablabla}}}}", | 18 "{{A|B={{C|D=blablabla}}}}", |
15 "{{CS|Init=black|Values={{CSS Property Value\n|Data Type=color\n
|Description=[[css/color|CSS color value]]}}\n}}", | 19 "{{A|B={{C|D=bla}}|x=y}}", |
| 20 "{{CS|Init=black|Values={{CSS Property Value\n|Data Type=color\n
|Description= [[css/color|CSS color value]]}}\n}}", |
16 "{{A}}", | 21 "{{A}}", |
17 "{{A|B=bla<a=c>bla}}", | 22 "{{A|B= [[google.com{{!}}Google]]}}", |
18 "{{A}}", | 23 "{{AbC|xyz \n\t \r}}", |
19 "{{AbC|xyz \n \t \r}}"]; | 24 "{{Table|there is a table {{{!}}\n}}", |
| 25 "{{External_Attribution|MSDN_link=[http://msdn.microsoft.com/en-
us/library/ie/ms536365(v=vs.85).aspx cloneNode Method]|HTML5Rocks_link=}}", |
| 26 "{{JS_Syntax|Formats={{JS Syntax Format|Format='''JSON.stringify
(''' value [ , replacer] [ , space] ''')'''}}\n}}"]; |
20 for (var i = 0; i < testCases.length; i++) { | 27 for (var i = 0; i < testCases.length; i++) { |
21 var wikiParser = new WebInspector.WikiParser(testCases[i]); | 28 var wikiParser = new WebInspector.WikiParser(testCases[i]); |
22 InspectorTest.addResult("\"" + testCases[i].replace("\r", "\\r")
+ "\" is parsed"); | 29 InspectorTest.addResult("\"" + testCases[i].replace("\r", "\\r")
+ "\" is parsed"); |
23 InspectorTest.addObject(wikiParser.document()); | 30 InspectorTest.addObject(wikiParser.document()); |
24 } | 31 } |
25 next(); | 32 next(); |
26 }, | 33 }, |
27 | 34 |
28 function testJS(next) | 35 function testJS(next) |
29 { | 36 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 function testInvalidInput(next) | 99 function testInvalidInput(next) |
93 { | 100 { |
94 var invalidInputTest = "{{Remarks_Section|Remarks=text ]]}}"; | 101 var invalidInputTest = "{{Remarks_Section|Remarks=text ]]}}"; |
95 var article = WebInspector.JSArticle.parse(invalidInputTest); | 102 var article = WebInspector.JSArticle.parse(invalidInputTest); |
96 InspectorTest.addResult(article); | 103 InspectorTest.addResult(article); |
97 next(); | 104 next(); |
98 }, | 105 }, |
99 | 106 |
100 function testLinkInsideCode(next) | 107 function testLinkInsideCode(next) |
101 { | 108 { |
102 var linkInsideCode = "{{Summary_Section|<code> [[google.com|GOOGLE!]
] < /code>}}"; | 109 var linkInsideCode = "{{Summary_Section|<code> [[google.com|GOOGLE!]
] </code >}}"; |
103 var article = WebInspector.JSArticle.parse(linkInsideCode); | 110 var article = WebInspector.JSArticle.parse(linkInsideCode); |
104 InspectorTest.addObject(article); | 111 InspectorTest.addObject(article); |
105 next(); | 112 next(); |
106 }, | 113 }, |
107 | 114 |
108 function testExamples(next) | 115 function testExamples(next) |
109 { | 116 { |
110 var examplesTest = "{{Examples_Section\n|Not_required=No\n|Examples=
{{Single Example\n|Language=HTML\n|Description=The following example shows how t
o use the '''insertBefore''' method to insert a new item into an existing list.\
n|Code=<!doctype html>\n<html>\n<head>\n<script type{{=}}\"
application/javascript\">\n function insertElement()\n {\n var n
od{{=}}document.createElement(\"li\");\n document.getElementById(\"oUL1\"
).insertBefore(nod, document.getElementById(\"oLIYellow\"));\n nod.textCo
ntet{{=}}\"Orange\";\n }\n</script>\n</head>\n<body>\n &
lt;p onclick{{=}}\"insertElement()\">Click <strong>HERE</strong>
to add an item to the following list.</p>\n <ul id{{=}}\"oUL1\">\
n <li id{{=}}\"oLIRed\">Red</li>\n <li id{{=}}\"oLI
Yellow\">Yellow</li>\n <li id{{=}}\"oLIBlue\">Blue</li&
gt;\n </ul>\n</body>\n</html>\n|LiveURL=http://samples.msdn
.microsoft.com/workshop/samples/author/dhtml/refs/insertBefore.htm\n}}\n}}"; | 117 var examplesTest = "{{Examples_Section\n|Not_required=No\n|Examples=
{{Single Example\n|Language=HTML\n|Description=The following example shows how t
o use the '''insertBefore''' method to insert a new item into an existing list.\
n|Code=<!doctype html>\n<html>\n<head>\n<script type{{=}}\"
application/javascript\">\n function insertElement()\n {\n var n
od{{=}}document.createElement(\"li\");\n document.getElementById(\"oUL1\"
).insertBefore(nod, document.getElementById(\"oLIYellow\"));\n nod.textCo
ntet{{=}}\"Orange\";\n }\n</script>\n</head>\n<body>\n &
lt;p onclick{{=}}\"insertElement()\">Click <strong>HERE</strong>
to add an item to the following list.</p>\n <ul id{{=}}\"oUL1\">\
n <li id{{=}}\"oLIRed\">Red</li>\n <li id{{=}}\"oLI
Yellow\">Yellow</li>\n <li id{{=}}\"oLIBlue\">Blue</li&
gt;\n </ul>\n</body>\n</html>\n|LiveURL=http://samples.msdn
.microsoft.com/workshop/samples/author/dhtml/refs/insertBefore.htm\n}}\n}}"; |
111 var article = WebInspector.JSArticle.parse(examplesTest); | 118 var article = WebInspector.JSArticle.parse(examplesTest); |
112 InspectorTest.addObject(article); | 119 InspectorTest.addObject(article); |
113 next(); | 120 next(); |
114 }, | 121 }, |
115 | 122 |
116 function testJsMethod(next) | 123 function testJsMethod(next) |
117 { | 124 { |
118 var jsMethodTest = "{{API_Object_Method\n|Parameters={{Method Parame
ter\n|Name=newNode\n|Data type=DOM Node\n|Description=The new node to be inserte
d.\n|Optional=No\n}}{{Method Parameter\n|Name=refChild\n|Data type=DOM Node\n|De
scription=Supplies the placement of the new node. If this parameter is specified
, the new element will be inserted immediately before this existing child node.
If not, it will be added after the last child node.\n|Optional=Yes\n}}\n|Method_
applies_to=dom/Node\n|Example_object_name=node\n|Return_value_name=insertedNode\
n|Javascript_data_type=DOM Node\n|Return_value_description=The inserted node.\n}
}\n"; | 125 var jsMethodTest = "{{API_Object_Method\n|Parameters={{Method Parame
ter\n|Name=newNode\n|Data type=DOM Node\n|Description=The new node to be inserte
d.\n|Optional=No\n}}{{Method Parameter\n|Name=refChild\n|Data type=DOM Node\n|De
scription=Supplies the placement of the new node. If this parameter is specified
, the new element will be inserted immediately before this existing child node.
If not, it will be added after the last child node.\n|Optional=Yes\n}}\n|Method_
applies_to=dom/Node\n|Example_object_name=node\n|Return_value_name=insertedNode\
n|Javascript_data_type=DOM Node\n|Return_value_description=The inserted node.\n}
}\n"; |
119 var article = WebInspector.JSArticle.parse(jsMethodTest); | 126 var article = WebInspector.JSArticle.parse(jsMethodTest); |
120 InspectorTest.addObject(article); | 127 InspectorTest.addObject(article); |
121 next(); | 128 next(); |
122 }, | 129 }, |
123 | 130 |
124 function testLinkWithoutSpace(next) | 131 function testLinkWithoutSpace(next) |
125 { | 132 { |
126 var linkWithoutSpaceTest = "{{Summary_Section|[[http://wrong.com|WRO
NG_LINK]]}}"; | 133 var linkWithoutSpaceTest = "{{Summary_Section|[[http://wrong.com|WRO
NG_LINK]]}}"; |
127 var article = WebInspector.JSArticle.parse(linkWithoutSpaceTest); | 134 try { |
128 InspectorTest.addObject(article); | 135 var article = WebInspector.JSArticle.parse(linkWithoutSpaceTest)
; |
| 136 InspectorTest.addObject(article); |
| 137 } catch (error) { |
| 138 InspectorTest.addResult("Expected error: " + error); |
| 139 } |
129 next(); | 140 next(); |
130 } | 141 } |
131 ]); | 142 ]); |
132 } | 143 } |
133 | |
134 </script> | 144 </script> |
135 </head> | 145 </head> |
136 | 146 |
137 <body onload="runTest()"> | 147 <body onload="runTest()"> |
138 | 148 |
139 </body> | 149 </body> |
140 </html> | 150 </html> |
OLD | NEW |