blob: 92f27cf70c2d902e531d1bbe19589c7ac33a100c [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// Variations:
// 1. Whether in the first or second line
// 2. Whether at (logical) start or end of the line
// 3. Moving left or right
// 4. Resolved direction of the inline block in the parent context
// 5. Direction of the first line text inside the inline block
// 6. Direction of the last line text inside the inline block
// Generated by: https://jsfiddle.net/z63vdhfe/
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|bar<br>qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>fo|o<span style="display:inline-block">bar<br>qux</span>baz</div>',
'Start of line 1, move left, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|bar<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>fo|o<span style="display:inline-block">bar<br>יךכ</span>baz</div>',
'Start of line 1, move left, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|אבג<br>qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>fo|o<span style="display:inline-block">אבג<br>qux</span>baz</div>',
'Start of line 1, move left, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|אבג<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>fo|o<span style="display:inline-block">אבג<br>יךכ</span>baz</div>',
'Start of line 1, move left, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|bar<br>qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">b|ar<br>qux</span>זחט</div>',
'Start of line 1, move left, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|bar<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">b|ar<br>יךכ</span>זחט</div>',
'Start of line 1, move left, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|אבג<br>qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">א|בג<br>qux</span>זחט</div>',
'Start of line 1, move left, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|אבג<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">א|בג<br>יךכ</span>זחט</div>',
'Start of line 1, move left, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|bar<br>qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">b|ar<br>qux</span>baz</div>',
'Start of line 1, move right, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|bar<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">b|ar<br>יךכ</span>baz</div>',
'Start of line 1, move right, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|אבג<br>qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">א|בג<br>qux</span>baz</div>',
'Start of line 1, move right, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">|אבג<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">א|בג<br>יךכ</span>baz</div>',
'Start of line 1, move right, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|bar<br>qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דה|ו<span style="display:inline-block">bar<br>qux</span>זחט</div>',
'Start of line 1, move right, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|bar<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דה|ו<span style="display:inline-block">bar<br>יךכ</span>זחט</div>',
'Start of line 1, move right, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|אבג<br>qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דה|ו<span style="display:inline-block">אבג<br>qux</span>זחט</div>',
'Start of line 1, move right, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">|אבג<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דה|ו<span style="display:inline-block">אבג<br>יךכ</span>זחט</div>',
'Start of line 1, move right, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar|<br>qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">ba|r<br>qux</span>baz</div>',
'End of line 1, move left, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar|<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">ba|r<br>יךכ</span>baz</div>',
'End of line 1, move left, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אב|ג<br>qux</span>baz</div>',
'End of line 1, move left, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אב|ג<br>יךכ</span>baz</div>',
'End of line 1, move left, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|qux</span>זחט</div>',
'End of line 1, move left, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|יךכ</span>זחט</div>',
'End of line 1, move left, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|qux</span>זחט</div>',
'End of line 1, move left, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|יךכ</span>זחט</div>',
'End of line 1, move left, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar|<br>qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>|qux</span>baz</div>',
'End of line 1, move right, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar|<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>|יךכ</span>baz</div>',
'End of line 1, move right, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|qux</span>baz</div>',
'End of line 1, move right, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|יךכ</span>baz</div>',
'End of line 1, move right, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">ba|r<br>qux</span>זחט</div>',
'End of line 1, move right, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">ba|r<br>יךכ</span>זחט</div>',
'End of line 1, move right, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אב|ג<br>qux</span>זחט</div>',
'End of line 1, move right, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אב|ג<br>יךכ</span>זחט</div>',
'End of line 1, move right, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>|qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar|<br>qux</span>baz</div>',
'Start of line 2, move left, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>|יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar|<br>יךכ</span>baz</div>',
'Start of line 2, move left, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|qux</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>qux</span>baz</div>',
'Start of line 2, move left, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|יךכ</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג|<br>יךכ</span>baz</div>',
'Start of line 2, move left, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>q|ux</span>זחט</div>',
'Start of line 2, move left, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>י|ךכ</span>זחט</div>',
'Start of line 2, move left, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|qux</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>q|ux</span>זחט</div>',
'Start of line 2, move left, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|יךכ</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>י|ךכ</span>זחט</div>',
'Start of line 2, move left, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>|qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>q|ux</span>baz</div>',
'Start of line 2, move right, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>|יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>י|ךכ</span>baz</div>',
'Start of line 2, move right, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|qux</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>q|ux</span>baz</div>',
'Start of line 2, move right, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>|יךכ</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>י|ךכ</span>baz</div>',
'Start of line 2, move right, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>qux</span>זחט</div>',
'Start of line 2, move right, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>|יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar|<br>יךכ</span>זחט</div>',
'Start of line 2, move right, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|qux</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>qux</span>זחט</div>',
'Start of line 2, move right, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>|יךכ</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג|<br>יךכ</span>זחט</div>',
'Start of line 2, move right, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>qux|</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>qu|x</span>baz</div>',
'End of line 2, move left, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>יךכ|</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>יך|כ</span>baz</div>',
'End of line 2, move left, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>qux|</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>qu|x</span>baz</div>',
'End of line 2, move left, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>יךכ|</span>baz</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>יך|כ</span>baz</div>',
'End of line 2, move left, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>qux|</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>qux</span>ז|חט</div>',
'End of line 2, move left, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>יךכ|</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>יךכ</span>ז|חט</div>',
'End of line 2, move left, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>qux|</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>qux</span>ז|חט</div>',
'End of line 2, move left, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>יךכ|</span>זחט</div>',
selection => selection.modify('move', 'left', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>יךכ</span>ז|חט</div>',
'End of line 2, move left, RTL resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>qux|</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>qux</span>b|az</div>',
'End of line 2, move right, LTR resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">bar<br>יךכ|</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">bar<br>יךכ</span>b|az</div>',
'End of line 2, move right, LTR resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>qux|</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>qux</span>b|az</div>',
'End of line 2, move right, LTR resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable>foo<span style="display:inline-block">אבג<br>יךכ|</span>baz</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable>foo<span style="display:inline-block">אבג<br>יךכ</span>b|az</div>',
'End of line 2, move right, LTR resolved direction, RTL/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>qux|</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>qu|x</span>זחט</div>',
'End of line 2, move right, RTL resolved direction, LTR/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>יךכ|</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">bar<br>יך|כ</span>זחט</div>',
'End of line 2, move right, RTL resolved direction, LTR/RTL text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>qux|</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>qu|x</span>זחט</div>',
'End of line 2, move right, RTL resolved direction, RTL/LTR text inside');
selection_test(
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>יךכ|</span>זחט</div>',
selection => selection.modify('move', 'right', 'character'),
'<div contenteditable dir="rtl">דהו<span style="display:inline-block">אבג<br>יך|כ</span>זחט</div>',
'End of line 2, move right, RTL resolved direction, RTL/RTL text inside');
</script>