Web Inspector: create helper InspectorTest method to dump editor HTML
[WebKit-https.git] / LayoutTests / inspector / editor / text-editor-highlight-regexp.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
6
7 function test()
8 {
9     InspectorTest.runTestSuite([
10         function testHighlightApi(next)
11         {
12             var text = [
13                 "foo();",
14                 "foo_1; foor; foo_;",
15                 "foo_",
16                 "global_foo",
17                 "global_foo2",
18                 "some_other_foo_X"
19             ];
20             var textEditor = InspectorTest.createTestEditor();
21             textEditor.setText(text.join("\n"));
22             InspectorTest.addResult("\nBefore highlight");
23             InspectorTest.dumpEditorHTML(textEditor, true);
24             textEditor.highlightRegex(/foo_./, "some-css-class");
25             InspectorTest.addResult("\nAdd highlight for regexp /foo_./");
26             InspectorTest.dumpEditorHTML(textEditor, true);
27             InspectorTest.addResult("\nRemove highlight for regexp /foo_./");
28             textEditor.removeRegexHighlight(/foo_./);
29             InspectorTest.dumpEditorHTML(textEditor, true);
30             next();
31         },
32     ]);
33 }
34
35 </script>
36 </head>
37
38 <body onload="runTest()">
39 <p>
40 Test editor highlight regexp API.
41 </p>
42 </body>
43 </html>