chromium/third_party/blink/web_tests/fast/dom/Range/getClientRects-leading-trailing-whitespaces.html

<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="target">   abc   </div>
<div id="log"></div>
<script>
var target = document.getElementById('target').firstChild;
function clientRectLeftOfNodeOffsetAt(offset) {
    var range = document.createRange();
    range.setStart(target, offset);
    var rects = range.getClientRects();
    return rects.length ? rects[0].left : 'no rects';
}
test(function() {
    assert_equals(clientRectLeftOfNodeOffsetAt(0), clientRectLeftOfNodeOffsetAt(3), '0');
    assert_equals(clientRectLeftOfNodeOffsetAt(1), clientRectLeftOfNodeOffsetAt(3), '1');
    assert_equals(clientRectLeftOfNodeOffsetAt(2), clientRectLeftOfNodeOffsetAt(3), '2');
}, 'leading whitespaces');

test(function() {
    assert_greater_than(clientRectLeftOfNodeOffsetAt(6), clientRectLeftOfNodeOffsetAt(5), '6');
    assert_equals(clientRectLeftOfNodeOffsetAt(7), clientRectLeftOfNodeOffsetAt(6), '7');
    assert_equals(clientRectLeftOfNodeOffsetAt(8), clientRectLeftOfNodeOffsetAt(6), '8');
}, 'trailing whitespaces');
</script>