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

Unified Diff: LayoutTests/inspector/editor/text-editor-auto-whitespace-removing.html

Issue 402433007: DevTools: [CodeMirror] remove auto-inserted whitespaces (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline inspector/editor/text-editor-formatter.html Created 6 years, 5 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
« no previous file with comments | « no previous file | LayoutTests/inspector/editor/text-editor-auto-whitespace-removing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector/editor/text-editor-auto-whitespace-removing.html
diff --git a/LayoutTests/inspector/editor/text-editor-auto-whitespace-removing.html b/LayoutTests/inspector/editor/text-editor-auto-whitespace-removing.html
new file mode 100644
index 0000000000000000000000000000000000000000..f188d00fd013bfd59cfc961d9deac667e2cccff6
--- /dev/null
+++ b/LayoutTests/inspector/editor/text-editor-auto-whitespace-removing.html
@@ -0,0 +1,117 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="editor-test.js"></script>
+<script>
+function codeSnippet() {
+ return document.getElementById("codeSnippet").textContent;
+}
+
+function test() {
+ var textEditor = InspectorTest.createTestEditor();
+ textEditor.setMimeType("text/javascript");
+ textEditor.setReadOnly(false);
+ textEditor.element.focus();
+ InspectorTest.evaluateInPage("codeSnippet();", onCodeSnippet);
+ var codeSnippetText;
+
+ function onCodeSnippet(result)
+ {
+ codeSnippetText = result.value;
+ InspectorTest.runTestSuite(testSuite);
+ }
+
+ function dumpAndNext(next)
+ {
+ function innerDumpAndNext()
+ {
+ InspectorTest.dumpTextWithSelection(textEditor, true);
+ next();
+ }
+ return innerDumpAndNext;
+ }
+
+ function doubleEnter(next)
+ {
+ function onFirstEnter()
+ {
+ InspectorTest.fakeKeyEvent(textEditor, "enter", [], dumpAndNext(next));
+ }
+
+ InspectorTest.fakeKeyEvent(textEditor, "enter", [], onFirstEnter);
+ }
+
+ var testSuite = [
+ function testCollapsedBlock(next)
+ {
+ textEditor.setText(codeSnippetText);
+ InspectorTest.setLineSelections(textEditor, [
+ {line: 0, column: 12}
+ ]);
+ doubleEnter(next);
+ },
+
+ function testOpenCurlyBrace(next)
+ {
+ textEditor.setText(codeSnippetText);
+ InspectorTest.setLineSelections(textEditor, [
+ {line: 1, column: 17}
+ ]);
+ doubleEnter(next);
+ },
+
+ function testSmartIndent(next)
+ {
+ textEditor.setText(codeSnippetText);
+ InspectorTest.setLineSelections(textEditor, [
+ {line: 1, column: 2}
+ ]);
+ doubleEnter(next);
+ },
+
+ function testMultiCursorSelection(next)
+ {
+ textEditor.setText(codeSnippetText);
+ InspectorTest.setLineSelections(textEditor, [
+ {line: 1, column: 2},
+ {line: 1, column: 4}
+ ]);
+ doubleEnter(next);
+ },
+
+ function testEditedAutoIndent(next)
+ {
+ textEditor.setText(codeSnippetText);
+ InspectorTest.setLineSelections(textEditor, [
+ {line: 1, column: 17}
+ ]);
+ InspectorTest.fakeKeyEvent(textEditor, "enter", [], onEnter);
+
+ function onEnter()
+ {
+ InspectorTest.fakeKeyEvent(textEditor, "W", [], onEditedText);
+ }
+
+ function onEditedText()
+ {
+ InspectorTest.fakeKeyEvent(textEditor, "enter", [], dumpAndNext(next));
+ }
+ },
+ ];
+}
+
+</script>
+</head>
+
+<body onload="runTest();">
+<p>
+This test verifies that auto-appended spaces are removed on consequent enters.
+</p>
+
+<pre id="codeSnippet">
+function (){}
+ if (a == b) {
+</pre>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector/editor/text-editor-auto-whitespace-removing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698