3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/debugger-test.js"></script>
5 <script src=
"../sources/debugger/resources/edit-me.js"></script>
12 var panel
= WebInspector
.panels
.sources
;
13 InspectorTest
.showScriptSource("edit-me.js", didShowScriptSource
);
15 function showReplaceField()
17 var searchableView
= WebInspector
.panels
.sources
.searchableView();
18 searchableView
.showSearchField();
19 searchableView
._replaceCheckboxElement
.click();
22 function runReplaceAll(searchValue
, replaceValue
)
24 panel
.searchableView()._searchInputElement
.value
= searchValue
;
25 panel
.searchableView()._replaceInputElement
.value
= replaceValue
;
26 panel
.searchableView()._replaceAll();
29 function dumpTextEditor(message
)
31 InspectorTest
.addResult(message
);
32 InspectorTest
.addResult(textEditor
.text());
35 function didShowScriptSource(sourceFrame
)
37 textEditor
= sourceFrame
._textEditor
;
40 InspectorTest
.runTestSuite([
41 function testReplaceAll(next
)
43 var source
= "// var a1, a2, a3;\nconst a1, a2, a3;\n";
44 sourceFrame
.setContent(source
);
46 dumpTextEditor("--- Before replace ---");
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("//", "//=");
54 dumpTextEditor("--- After replace ---");
66 <body onload=
"runTest()">
67 <p>Tests the search replace functionality.
</p>