blob: 6012fcb6c8d60a51aaebd4531da8d40511199f89 [file] [log] [blame]
<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
const isMac = navigator.platform.indexOf('Mac') === 0;
const kBehaviors = window.internals ? ['mac', 'win'] : isMac ? ['mac'] : ['win'];
for (const behavior of kBehaviors) {
if (window.internals) {
internals.settings.setEditingBehavior(behavior);
internals.settings.setSelectTrailingWhitespaceEnabled(behavior !== 'mac');
}
selection_test(
'<div contenteditable dir="rtl">|\n Just\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n ^Just|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n ^Just\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-0 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n| Just\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n ^Just|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n ^Just\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-1 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n |Just\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n ^Just|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n ^Just\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-2 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n J|ust\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n J^ust|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n J^ust\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-3 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Ju|st\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Ju^st|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Ju^st\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-4 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Jus|t\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Jus^t|\n <span>testing what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Jus^t\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-5 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just|\n <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just^\n <span>testing| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just^\n| <span>testing what</span>\n ever\n</div>',
`${behavior} 15-6 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n| <span>testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>^testing| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>^testing |what</span>\n ever\n</div>',
`${behavior} 15-7 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>|testing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>^testing| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>^testing |what</span>\n ever\n</div>',
`${behavior} 15-8 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>t|esting what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>t^esting| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>t^esting |what</span>\n ever\n</div>',
`${behavior} 15-9 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>te|sting what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>te^sting| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>te^sting |what</span>\n ever\n</div>',
`${behavior} 15-10 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>tes|ting what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>tes^ting| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>tes^ting |what</span>\n ever\n</div>',
`${behavior} 15-11 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>test|ing what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>test^ing| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>test^ing |what</span>\n ever\n</div>',
`${behavior} 15-12 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testi|ng what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testi^ng| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testi^ng |what</span>\n ever\n</div>',
`${behavior} 15-13 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testin|g what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testin^g| what</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testin^g |what</span>\n ever\n</div>',
`${behavior} 15-14 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing| what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing^ what|</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing^ |what</span>\n ever\n</div>',
`${behavior} 15-15 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing |what</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing ^what|</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing ^what</span>\n| ever\n</div>',
`${behavior} 15-16 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing w|hat</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing w^hat|</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing w^hat</span>\n| ever\n</div>',
`${behavior} 15-17 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing wh|at</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing wh^at|</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing wh^at</span>\n| ever\n</div>',
`${behavior} 15-18 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing wha|t</span>\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing wha^t|</span>\n ever\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing wha^t</span>\n| ever\n</div>',
`${behavior} 15-19 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>|\n ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
behavior === 'mac'
? '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>^\n ever|\n</div>'
: '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>^\n| ever\n</div>',
`${behavior} 15-20 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n| ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ^ever|\n</div>',
`${behavior} 15-21 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n |ever\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ^ever|\n</div>',
`${behavior} 15-22 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n e|ver\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n e^ver|\n</div>',
`${behavior} 15-23 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ev|er\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ev^er|\n</div>',
`${behavior} 15-24 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n eve|r\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n eve^r|\n</div>',
`${behavior} 15-25 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever|\n</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever|\n</div>',
`${behavior} 15-26 rtl forward word`);
selection_test(
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever\n|</div>',
selection => selection.modify('extend', 'forward', 'word'),
'<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever|\n</div>',
`${behavior} 15-27 rtl forward word`);
}
</script>