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

Unified Diff: third_party/WebKit/LayoutTests/editing/input/keyboard-ctrl-enter-no-newline.html

Issue 1942683004: Ctrl/Alt+Enter shouldn't insert newline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix existing tests for Ctrl/Alt Enter Created 4 years, 8 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/editing/input/keyboard-ctrl-enter-no-newline.html
diff --git a/third_party/WebKit/LayoutTests/editing/input/keyboard-ctrl-enter-no-newline.html b/third_party/WebKit/LayoutTests/editing/input/keyboard-ctrl-enter-no-newline.html
new file mode 100644
index 0000000000000000000000000000000000000000..8ce0ca402095b6149c301b4c1c8be02536832758
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/input/keyboard-ctrl-enter-no-newline.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Ctrl+Enter shouldn't insert newline</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<textarea id="txt"></textarea>
+<script>
+test(function() {
+ if (!window.eventSender) {
+ document.write('This test requires eventSender');
yosin_UTC9 2016/05/09 03:52:51 nit: Use |return| to avoid else-clauses to reduce
chongz 2016/05/09 21:21:01 Done.
+ } else {
+ var txt = document.getElementById('txt');
+ txt.focus();
+ // Ctrl+Enter shouldn't insert new line.
+ txt.value = '';
+ eventSender.keyDown('\n', ['ctrlKey']);
+ assert_equals(txt.value, '');
+ // Alt+Enter shouldn't insert new line.
+ txt.value = '';
+ eventSender.keyDown('\n', ['altKey']);
+ assert_equals(txt.value, '');
+ // Alt+Shift+Enter shouldn't insert new line.
+ txt.value = '';
+ eventSender.keyDown('\n', ['altKey', 'shiftKey']);
+ assert_equals(txt.value, '');
+ // Enter should insert new line.
+ txt.value = '';
+ eventSender.keyDown('\n', []);
+ assert_equals(txt.value, '\n');
+ // Shift+Enter should insert line break.
+ txt.value = '';
+ eventSender.keyDown('\n', ['shiftKey']);
+ assert_equals(txt.value, '\n');
+ }
+}, 'Testing Ctrl+Enter shouldn\'t insert newline');
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698