Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html |
| diff --git a/third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html b/third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33a522e840aa86e4a31a82127de3d850dabbab34 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html |
| @@ -0,0 +1,91 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<style> |
| +div { |
| + border: 2px solid red; |
| + padding: 12px; |
| + line-height: 1.66666667; |
| + width: 140px; |
| +} |
| +</style> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +</head> |
| +<body> |
| + <div contenteditable id="test1"> |
| + The caret height |
| + should <span id="line2">be the same for each line.</span> |
| + </div> |
| + <div contenteditable id="test2"> |
| + The <span id="large_font" style="font-size: 150%">caret</span> height should be obtained from a font of character before caret for LTR. |
| + </div> |
| + <div contenteditable id="test3" style="direction: RTL">גובה<span id="large_font_rtl" style="font-size: 150%">עבו</span> תו יש לקבל תו אחרי תו עבור RTL |
| + </div> |
| +<script> |
| +test(function () { |
| + var editor = document.getElementById('test1'); |
|
yosin_UTC9
2017/01/05 07:31:31
%s/var/const/ or using |let|
joone
2017/01/06 20:40:43
Acknowledged.
|
| + editor.focus(); |
| + |
| + var caretHeight1 = window.internals.absoluteCaretBounds().height; |
|
yosin_UTC9
2017/01/05 07:31:31
Please add assertion for availability of window.in
joone
2017/01/06 20:40:43
Acknowledged.
|
| + var sel = window.getSelection(); |
| + sel.collapse(line2, 0); |
| + var caretHeight2 = window.internals.absoluteCaretBounds().height; |
| + |
| + assert_equals(caretHeight1, caretHeight2); |
| +}, 'The caret height should be the same in every line'); |
| + |
| +test(function () { |
| + var editor = document.getElementById('test2'); |
| + editor.focus(); |
| + |
| + var caretHeight1 = window.internals.absoluteCaretBounds().height; |
| + var sel = window.getSelection(); |
| + sel.collapse(large_font, 0); |
| + var caretHeight2 = window.internals.absoluteCaretBounds().height; |
| + |
| + assert_equals(caretHeight1, caretHeight2); |
| +}, 'The caret height at the front of word(150%) should be the same as the caret height in other words(100%).'); |
| + |
| +test(function () { |
| + var editor = document.getElementById('test2'); |
| + editor.focus(); |
| + |
| + var sel = window.getSelection(); |
| + sel.collapse(large_font, 0); |
| + sel.modify("move", "right", "character"); |
| + var caretHeight1 = window.internals.absoluteCaretBounds().height; |
| + sel.collapse(large_font, 1); |
| + var caretHeight2 = window.internals.absoluteCaretBounds().height; |
| + |
| + assert_equals(caretHeight1, caretHeight2); |
| +}, 'The caret height at the end of word should be the same as the caret height in the word.'); |
| + |
| +test(function () { |
| + var editor = document.getElementById('test3'); |
| + editor.focus(); |
| + |
| + var caretHeight1 = window.internals.absoluteCaretBounds().height; |
| + var sel = window.getSelection(); |
| + sel.collapse(large_font_rtl, 0); |
| + var caretHeight2 = window.internals.absoluteCaretBounds().height; |
| + |
| + assert_equals(caretHeight1, caretHeight2); |
| +}, 'In case of RTL, the caret height at the front of word(150%) should be the same as the caret height in other words(100%).'); |
| + |
| +test(function () { |
| + var editor = document.getElementById('test3'); |
| + editor.focus(); |
| + |
| + var sel = window.getSelection(); |
| + sel.collapse(large_font_rtl, 0); |
| + sel.modify("move", "left", "character"); |
|
yosin_UTC9
2017/01/05 07:31:31
Please use single-quote since other parts of scrip
joone
2017/01/06 20:40:43
Acknowledged.
|
| + var caretHeight1 = window.internals.absoluteCaretBounds().height; |
| + sel.collapse(large_font_rtl, 1); |
| + var caretHeight2 = window.internals.absoluteCaretBounds().height; |
| + |
| + assert_equals(caretHeight1, caretHeight2); |
| +}, 'In case of RTL, the caret height at the end of word should be the same as the caret height in the word.'); |
| +</script> |
| +</body> |
| +</html> |