Bug 1744799 [wpt PR 31935] - [block-in-inline] Add more test for r948826, a=testonly

Automatic update from web-platform-tests
[block-in-inline] Add more test for r948826

r948826 crrev.com/c/3318676 fixed a test:
  tables/mozilla/bugs/bug113235-1.html
when BlockInInline is enabled, but the test relies on the
parser to chunk at the specific timing.

This patch adds a test that always hit the condition by using
the `insertBefore` function.

Bug: 716930
Change-Id: I1c8ee5d197801d02749d75ec7e03a773207716e5

--

wpt-commits: ad5d26e64d54cd45787df6bcc2d6fc4fcaa77d50
wpt-pr: 31935
This commit is contained in:
Koji Ishii 2021-12-09 16:14:21 +00:00 коммит произвёл moz-wptsync-bot
Родитель 4acd157914
Коммит cda9a19f46
1 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta name="assert" content="Test inserting a block-in-inline in the middle of existing block-in-inline">
<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level" />
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div>1</div>
<span>
<div id="b2">2</div>
<div id="b4">4</div>
</span>
<script>
document.body.offsetTop;
// Both "2" and "4" are block-in-inline children.
// Insert a block child "3" between them.
const b3 = document.createElement('div');
b3.appendChild(document.createTextNode('3'));
b4.parentElement.insertBefore(b3, b4);
// Check if "3" is between "2" and "4".
test(() => {
assert_greater_than(b3.offsetTop, b2.offsetTop);
assert_less_than(b3.offsetTop, b4.offsetTop);
});
</script>
</body>