| Index: third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html b/third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html
|
| index b4f6e453872888822a8e9ba20acf3c20c2375225..22d8d914dd857a63b26f96fc4c5c89a8cdd9e97d 100644
|
| --- a/third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html
|
| +++ b/third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html
|
| @@ -11,13 +11,15 @@ function test()
|
| {
|
| var textEditor = InspectorTest.createTestEditor();
|
| textEditor.setMimeType("text/javascript");
|
| - textEditor.setReadOnly(false);
|
| + textEditor.setReadOnly(true);
|
| textEditor.element.focus();
|
| InspectorTest.evaluateInPage("codeSnippet();", onCodeSnippet);
|
|
|
| + var codeLines;
|
| +
|
| function onCodeSnippet(result)
|
| {
|
| - var codeLines = result.value;
|
| + codeLines = result.value;
|
| textEditor.setText(codeLines);
|
| InspectorTest.runTestSuite(testSuite);
|
| }
|
| @@ -25,12 +27,13 @@ function test()
|
| function nextOccurrence(times)
|
| {
|
| for (var i = 0; i < times; ++i)
|
| - textEditor._selectNextOccurrenceController.selectNextOccurrence();
|
| + InspectorTest.fakeKeyEvent(textEditor, "D", ["ctrlKey"]);
|
| }
|
|
|
| - function undoLastSelection()
|
| + function undoLastSelection(times)
|
| {
|
| - textEditor._selectNextOccurrenceController.undoLastSelection();
|
| + for (var i = 0; i < times; ++i)
|
| + InspectorTest.fakeKeyEvent(textEditor, "U", ["ctrlKey"]);
|
| }
|
|
|
| function lineSelection(line, from, to)
|
| @@ -71,7 +74,27 @@ function test()
|
| {
|
| lineSelection(2, 13);
|
| nextOccurrence(3);
|
| - undoLastSelection();
|
| + undoLastSelection(1);
|
| + InspectorTest.dumpSelectionStats(textEditor);
|
| + next();
|
| + },
|
| +
|
| + function testUndoAllAddedSelections(next)
|
| + {
|
| + lineSelection(2, 13);
|
| + nextOccurrence(3);
|
| + undoLastSelection(3);
|
| + InspectorTest.dumpSelectionStats(textEditor);
|
| + next();
|
| + },
|
| +
|
| + function testUndoToPreviousSelectionGroup(next)
|
| + {
|
| + lineSelection(2, 13);
|
| + nextOccurrence(2);
|
| + lineSelection(2, 51);
|
| + nextOccurrence(2);
|
| + undoLastSelection(4);
|
| InspectorTest.dumpSelectionStats(textEditor);
|
| next();
|
| },
|
| @@ -80,7 +103,7 @@ function test()
|
| {
|
| lineSelection(2, 51);
|
| nextOccurrence(3);
|
| - undoLastSelection();
|
| + undoLastSelection(1);
|
| nextOccurrence(1);
|
| InspectorTest.dumpSelectionStats(textEditor);
|
| var lastSelection = textEditor.selections().pop();
|
| @@ -92,7 +115,7 @@ function test()
|
| {
|
| lineSelection(2, 48, 52);
|
| nextOccurrence(2);
|
| - undoLastSelection();
|
| + undoLastSelection(1);
|
| nextOccurrence(1);
|
| InspectorTest.dumpSelectionStats(textEditor);
|
| var lastSelection = textEditor.selections().pop();
|
| @@ -107,6 +130,21 @@ function test()
|
| InspectorTest.dumpSelectionStats(textEditor);
|
| next();
|
| },
|
| +
|
| + function testReadOnlyIsPreserved(next)
|
| + {
|
| + lineSelection(2, 13);
|
| + nextOccurrence(3);
|
| + undoLastSelection(1);
|
| + InspectorTest.fakeKeyEvent(textEditor, "enter", []);
|
| +
|
| + InspectorTest.evaluateInPage("codeSnippet();", function(result) {
|
| +
|
| + InspectorTest.assertTrue(result.value === codeLines);
|
| + InspectorTest.dumpSelectionStats(textEditor);
|
| + next();
|
| + });
|
| + }
|
| ];
|
| }
|
|
|
| @@ -115,7 +153,7 @@ function test()
|
|
|
| <body onload="runTest();">
|
| <p>
|
| -This test verifies Ctrl-D functionality, which selects next occurrence of word.
|
| +This test verifies Ctrl-D functionality, which selects next occurrence of word, and Ctrl-U functionality, which undos the last selection.
|
| </p>
|
|
|
| <pre id="codeSnippet">
|
|
|