Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: LayoutTests/inspector/documentation/document-parser.html

Issue 539353004: DevTools: [Documentation] Update parser for WikiText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add method secondToken() Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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|Code= var nod{{=}}document.createElement(\"li\");\ndocument .getElementById(\"oUL1\").insertBefore(nod, document.getElementById(\"oLIYellow\ "));\nnod.textContet{{=}}\"Orange\"}}",
15 "{{A|Code={{=}} }}",
16 "{{A|B=C}}",
14 "{{A|B={{C|D=blablabla}}}}", 17 "{{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}}", 18 "{{A|B={{C|D=bla}}|x=y}}",
19 "{{CS|Init=black|Values={{CSS Property Value\n|Data Type=color\n |Description= [[css/color|CSS color value]]}}\n}}",
16 "{{A}}", 20 "{{A}}",
17 "{{A|B=bla<a=c>bla}}", 21 "{{A|B= [[google.com{{!}}Google]]}}",
18 "{{A}}", 22 "{{AbC|xyz \n\t \r}}"];
19 "{{AbC|xyz \n \t \r}}"];
20 for (var i = 0; i < testCases.length; i++) { 23 for (var i = 0; i < testCases.length; i++) {
21 var wikiParser = new WebInspector.WikiParser(testCases[i]); 24 var wikiParser = new WebInspector.WikiParser(testCases[i]);
22 InspectorTest.addResult("\"" + testCases[i].replace("\r", "\\r") + "\" is parsed"); 25 InspectorTest.addResult("\"" + testCases[i].replace("\r", "\\r") + "\" is parsed");
23 InspectorTest.addObject(wikiParser.document()); 26 InspectorTest.addObject(wikiParser.document());
24 } 27 }
25 next(); 28 next();
26 }, 29 },
27 30
28 function testJS(next) 31 function testJS(next)
29 { 32 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 { 104 {
102 var linkInsideCode = "{{Summary_Section|<code> [[google.com|GOOGLE!] ] < /code>}}"; 105 var linkInsideCode = "{{Summary_Section|<code> [[google.com|GOOGLE!] ] < /code>}}";
103 var article = WebInspector.JSArticle.parse(linkInsideCode); 106 var article = WebInspector.JSArticle.parse(linkInsideCode);
104 InspectorTest.addObject(article); 107 InspectorTest.addObject(article);
105 next(); 108 next();
106 }, 109 },
107 110
108 function testExamples(next) 111 function testExamples(next)
109 { 112 {
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=&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;script type{{=}}\" application/javascript\"&gt;\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&lt;/script&gt;\n&lt;/head&gt;\n&lt;body&gt;\n & lt;p onclick{{=}}\"insertElement()\"&gt;Click &lt;strong&gt;HERE&lt;/strong&gt; to add an item to the following list.&lt;/p&gt;\n &lt;ul id{{=}}\"oUL1\"&gt;\ n &lt;li id{{=}}\"oLIRed\"&gt;Red&lt;/li&gt;\n &lt;li id{{=}}\"oLI Yellow\"&gt;Yellow&lt;/li&gt;\n &lt;li id{{=}}\"oLIBlue\"&gt;Blue&lt;/li& gt;\n &lt;/ul&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n|LiveURL=http://samples.msdn .microsoft.com/workshop/samples/author/dhtml/refs/insertBefore.htm\n}}\n}}"; 113 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=&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;script type{{=}}\" application/javascript\"&gt;\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&lt;/script&gt;\n&lt;/head&gt;\n&lt;body&gt;\n & lt;p onclick{{=}}\"insertElement()\"&gt;Click &lt;strong&gt;HERE&lt;/strong&gt; to add an item to the following list.&lt;/p&gt;\n &lt;ul id{{=}}\"oUL1\"&gt;\ n &lt;li id{{=}}\"oLIRed\"&gt;Red&lt;/li&gt;\n &lt;li id{{=}}\"oLI Yellow\"&gt;Yellow&lt;/li&gt;\n &lt;li id{{=}}\"oLIBlue\"&gt;Blue&lt;/li& gt;\n &lt;/ul&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n|LiveURL=http://samples.msdn .microsoft.com/workshop/samples/author/dhtml/refs/insertBefore.htm\n}}\n}}";
114 debugger;
lushnikov 2014/09/08 14:08:29 remove
iliia 2014/09/08 15:20:49 Done.
111 var article = WebInspector.JSArticle.parse(examplesTest); 115 var article = WebInspector.JSArticle.parse(examplesTest);
112 InspectorTest.addObject(article); 116 InspectorTest.addObject(article);
113 next(); 117 next();
114 }, 118 },
115 119
116 function testJsMethod(next) 120 function testJsMethod(next)
117 { 121 {
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"; 122 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); 123 var article = WebInspector.JSArticle.parse(jsMethodTest);
120 InspectorTest.addObject(article); 124 InspectorTest.addObject(article);
121 next(); 125 next();
122 }, 126 },
123 127
124 function testLinkWithoutSpace(next) 128 function testLinkWithoutSpace(next)
125 { 129 {
126 var linkWithoutSpaceTest = "{{Summary_Section|[[http://wrong.com|WRO NG_LINK]]}}"; 130 var linkWithoutSpaceTest = "{{Summary_Section|[[http://wrong.com|WRO NG_LINK]]}}";
127 var article = WebInspector.JSArticle.parse(linkWithoutSpaceTest); 131 try {
128 InspectorTest.addObject(article); 132 var article = WebInspector.JSArticle.parse(linkWithoutSpaceTest) ;
133 InspectorTest.addObject(article);
134 } catch (error) {
135 InspectorTest.addResult(error);
lushnikov 2014/09/08 14:08:29 prepend with "Expected error: "
iliia 2014/09/08 15:20:49 Done.
136 }
129 next(); 137 next();
130 } 138 }
131 ]); 139 ]);
132 } 140 }
133
134 </script> 141 </script>
135 </head> 142 </head>
136 143
137 <body onload="runTest()"> 144 <body onload="runTest()">
138 145
139 </body> 146 </body>
140 </html> 147 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698