Commit 64f6ee67 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in...

Utilize selection_test() in "editing/selection/modify_move/move_forward_sentence_empty_line_break.html"

This patch changes "move_forward_sentence_empty_line_break.html" to utilize
|selection_test()| for ease of maintenance.

Bug: 679977
Change-Id: Id068b0544eb17e5b2ba4ad184f9011b1481c5000
Reviewed-on: https://chromium-review.googlesource.com/989388Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547596}
parent 551f1e3a
<!doctype html> <!doctype html>
<script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/testharnessreport.js"></script>
<p>This tests for sentence boundary when there are empty line break between <script src="../../assert_selection.js"></script>
lines of text.<p>
<div id="sample" contenteditable>foo<div id="empty"><br></div>bar</div>
<div id="log"></idv> <div id="log"></idv>
<script> <script>
test(function() { // This tests for sentence boundary when there are empty line break between
var selection = window.getSelection(); // lines of text.
var sample = document.getElementById('sample'); selection_test(
selection.collapse(sample, 1); '<div contenteditable>foo|<div><br></div>bar</div>',
selection.modify('move', 'forward', 'sentence'); selection => selection.modify('move', 'forward', 'sentence'),
'<div contenteditable>foo<div>|<br></div>bar</div>',
'1 move forward sentence to empty line break');
var anchor = document.getElementById('empty'); selection_test(
assert_equals(selection.anchorNode, anchor, 'anchorNode'); '<div contenteditable>foo<div>|<br></div>bar</div>',
assert_equals(selection.anchorOffset, 0, 'anchorOffset'); selection => selection.modify('move', 'forward', 'sentence'),
assert_equals(selection.focusNode, anchor, 'focusNode'); '<div contenteditable>foo<div><br></div>|bar</div>',
assert_equals(selection.focusOffset, 0, 'focusOffset'); '2 move forward sentence from empty line break');
}, 'to empty line break');
test(function() {
var selection = window.getSelection();
var empty = document.getElementById('empty');
selection.collapse(empty, 0);
selection.modify('move', 'forward', 'sentence');
var anchor = sample.lastChild;
assert_equals(selection.anchorNode, anchor, 'anchorNode');
assert_equals(selection.anchorOffset, 0, 'anchorOffset');
assert_equals(selection.focusNode, anchor, 'focusNode');
assert_equals(selection.focusOffset, 0, 'focusOffset');
}, 'from empty line break');
</script> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment