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