blob: 5afa862eab3c5f83d4bc4b7ba7ca2e6303717ba2 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>Should see the "baz" line centered in its red box inside the box containing
"bar". The "foo" and "bar" lines should not be centered.</p>
<div id="sample" contenteditable>foo<div>bar<br>baz</div></div>
<div id="log"></div>
<script>
test(function() {
var selection = window.getSelection();
var sample = document.getElementById('sample');
selection.collapse(sample.childNodes[1].lastChild, 0);
document.execCommand('justifyCenter');
assert_equals(sample.innerHTML, 'foo<div>bar<br><div style="text-align: center;">baz</div></div>', 'innerHTML');
assert_true(selection.isCollapsed, 'isCollapsed');
assert_equals(selection.anchorNode, sample.childNodes[1].lastChild.firstChild, 'anchorNode');
assert_equals(selection.anchorOffset, 0, 'anchorOffset');
});
</script>