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