Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / editor / text-editor-search-replace.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../debugger/resources/edit-me.js"></script>
6
7 <script>
8
9 function test()
10 {
11     var textEditor;
12     var panel = WebInspector.panels.sources;
13     InspectorTest.showScriptSource("edit-me.js", didShowScriptSource);
14
15     function showReplaceField()
16     {
17         var searchableView = WebInspector.panels.sources.searchableView();
18         searchableView.showSearchField();
19         searchableView._replaceCheckboxElement.click();
20     }
21
22     function runReplaceAll(searchValue, replaceValue)
23     {
24         panel.searchableView()._searchInputElement.value = searchValue;
25         panel.searchableView()._replaceInputElement.value = replaceValue;
26         panel.searchableView()._replaceAll();
27     }
28
29     function dumpTextEditor(message)
30     {
31         InspectorTest.addResult(message);
32         InspectorTest.addResult(textEditor.text());
33     }
34
35     function didShowScriptSource(sourceFrame)
36     {
37         textEditor = sourceFrame._textEditor;
38         showReplaceField();
39
40         InspectorTest.runTestSuite([
41             function testReplaceAll(next)
42             {
43                 var source = "// var a1, a2, a3;\nconst  a1, a2, a3;\n";
44                 sourceFrame.setContent(source);
45
46                 dumpTextEditor("--- Before replace ---");
47
48                 runReplaceAll("a1", "a$$");
49                 runReplaceAll("a2", "b$&");
50                 runReplaceAll("a3", "a3 /* $0 $1 $2 $& $$ \\0 \\1 */");
51                 runReplaceAll("/\\b(const)(\\s)+/", "/** @$1 */ var$2");
52                 runReplaceAll("//", "//=");
53
54                 dumpTextEditor("--- After replace ---");
55
56                 next();
57             },
58         ]);
59     }
60 };
61
62 </script>
63
64 </head>
65
66 <body onload="runTest()">
67 <p>Tests the search replace functionality.</p>
68
69 </body>
70 </html>