Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/WebKit/LayoutTests/inspector/editor/text-editor-ctrl-d-1.html

Issue 2080603008: DevTools: allow codemirror softundo to work on readonly files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing test for preserving readOnly Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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">

Powered by Google App Engine
This is Rietveld 408576698