blob: a4768056029545e548894a97b32024f1ed8c0208 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>
Should see "foo" centered in its own box, followed by left-aligned two lines, "bar" and "baz", in their own red box.
</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');
assert_equals(sample.innerHTML, '<div style="text-align: center;">foo</div>bar<br>baz', 'innerHTML');
assert_true(selection.isCollapsed, 'isCollapsed');
assert_equals(selection.anchorNode, sample.firstChild.firstChild, 'anchorNode');
assert_equals(selection.anchorOffset, 0, 'anchorOffset');
});
</script>