Chromium Code Reviews| 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> |