chromium/third_party/blink/web_tests/editing/selection/modify_move/move_by_word_with_underscore.html

<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// Regression tests for crbug.com/447339
test(() => assert_selection(
    'foo_ _bar|',
    selection => selection.modify('move', 'backward', 'word'),
    'foo_ |_bar'), 'Backward move by word should work with underscore.');

['mac', 'unix', 'android', 'win'].forEach(platform => test(() => {
    assert_not_equals(window.internals, undefined, 'window.internals is required to set platform-dependent editing behavior.');
    internals.settings.setEditingBehavior(platform);
    assert_selection(
        '|foo_ _bar',
        selection => selection.modify('move', 'forward', 'word'),
        // Windows skips the trailing space when moving/extending selection forwards by word.
        platform === 'win' ? 'foo_ |_bar' : 'foo_| _bar');
    }, 'Forward move by word should work with underscore in ' + platform));
</script>