Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / editor / text-editor-ctrl-d-2.html
blobd328986aa0891217c75ea395d58a18ab7818914b
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
6 function codeSnippet() {
7 return document.getElementById("codeSnippet").textContent;
10 function test()
12 var textEditor = InspectorTest.createTestEditor();
13 textEditor.setMimeType("text/javascript");
14 textEditor.setReadOnly(false);
15 textEditor.element.focus();
16 InspectorTest.evaluateInPage("codeSnippet();", onCodeSnippet);
18 function onCodeSnippet(result)
20 var codeLines = result.value;
21 textEditor.setText(codeLines);
22 InspectorTest.runTestSuite(testSuite);
25 function nextOccurrence(times)
27 for (var i = 0; i < times; ++i)
28 textEditor._selectNextOccurrenceController.selectNextOccurrence();
31 function undoLastSelection()
33 textEditor._selectNextOccurrenceController.undoLastSelection();
36 function lineSelection(line, from, to)
38 if (typeof to !== "number")
39 to = from;
40 InspectorTest.setLineSelections(textEditor, [
41 { line: line, from: from, to: to }
42 ]);
45 var testSuite = [
46 function testCursorInTheWordStart(next)
48 lineSelection(8, 0);
49 nextOccurrence(1);
50 InspectorTest.dumpSelectionStats(textEditor);
51 next();
54 function testCursorInTheWordEnd(next)
56 lineSelection(8, 8);
57 nextOccurrence(1);
58 InspectorTest.dumpSelectionStats(textEditor);
59 next();
62 function testNonWordSelection(next)
64 lineSelection(18, 12, 14);
65 nextOccurrence(8);
66 InspectorTest.dumpSelectionStats(textEditor);
67 next();
70 function testNonWordSelection2(next)
72 lineSelection(17, 30, 33);
73 nextOccurrence(8);
74 InspectorTest.dumpSelectionStats(textEditor);
75 next();
78 function testNonWordSelection3(next)
80 InspectorTest.setLineSelections(textEditor, [
81 { line: 14, from: 15, to: 25 },
82 { line: 16, column: 21 },
83 { line: 17, from: 42, to: 47 },
84 ]);
85 var selections = textEditor.selections();
86 nextOccurrence(3);
87 InspectorTest.dumpSelectionStats(textEditor);
88 next();
91 function testNonWordSelection4(next)
93 InspectorTest.setLineSelections(textEditor, [
94 { line: 14, from: 15, to: 25 },
95 { line: 16, from: 21, to: 23 },
96 { line: 17, from: 42, to: 47 },
97 ]);
98 var selections = textEditor.selections();
99 nextOccurrence(3);
100 InspectorTest.dumpSelectionStats(textEditor);
101 next();
104 function testTriggerWordSearchInMixedCase(next)
106 InspectorTest.setLineSelections(textEditor, [
107 { line: 9, from: 10, to: 25 },
108 { line: 14, column: 33 }
110 nextOccurrence(5);
111 InspectorTest.dumpSelectionStats(textEditor);
112 next();
117 </script>
118 </head>
120 <body onload="runTest();">
122 This test verifies Ctrl-D functionality, which selects next occurrence of word.
123 </p>
125 <pre id="codeSnippet">
126 function wordData() {
127 return {
128 original: $(".entry.original > .input").text(),
129 translation: $(".entry.translation > .input").text(),
130 tags: $(".active-tags > .tagcloud > .tag").toArray().map(function(value) { return value.textContent; })
134 function submitWord(url) {
135 var stub = new App.Stub($(".content"));
136 $.post(url, wordData())
137 .done(function() {
138 var callback = $("meta[data-callback]").attr("data-callback");
139 if (callback) {
140 window.location = callback;
141 } else {
142 stub.success();
143 $(".entry.original > .input").text("").focus();
144 $(".entry.translation > .input").text("");
147 .fail(function(obj, err, errDescr) {
148 stub.failure("Error: " + errDescr);
151 </pre>
153 </body>
154 </html>