gecko-dev/testing/web-platform/tests/css/css-grid/alignment/grid-alignment-style-changes-007.html
Carlos Alberto Lopez Perez ccd291baa1 Bug 1623813 [wpt PR 22347] - css-grid: Use documents.font.ready() for tests with Ahem font., a=testonly
Automatic update from web-platform-tests
css-grid: Wait for documents.font.ready() for tests with Ahem font (#22347)

web-fonts may not be ready when the window.onload signal is triggered,
so to avoid flakiness or unexpected failures on the css-grid tests that
use the Ahem font we should wait for the fonts to be ready before
starting the test.

However, that is not enough, we should also waiting for window.load
before starting the tests because some tests depend on the document
images to load (which may happen before or after the fonts are ready)

So this patch changes the tests using Ahem to start after the load
event has fired and after the fonts are ready.

The tests now need to use "explicit_done: true" to avoid race conditions,
so this commit also sets this tests to be explicit about when they finish.

--

wpt-commits: ea0533fc00ee855b02231c8e392c3ddadb943b0f
wpt-pr: 22347
2020-03-31 11:30:42 +00:00

68 lines
2.4 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Changing the value of Self-Alignment properties</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property">
<link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position">
<meta name="assert" content="Changing the 'align-self' property's value of a grid item from 'baseline' will exclude such item from its baseline context, which implies recomputing all the baseline offsets and aligning the items left in such context.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
#container {
position: relative;
display: inline-grid;
grid: 50px 50px 50px / 100px;
background: grey;
justify-items: baseline;
font-family: Ahem;
text-orientation: sideways;
line-height: 1;
}
#container > div { writing-mode: vertical-lr; }
#item1 {
font-size: 20px;
background: blue;
}
#item2 {
font-size: 40px;
background: green;
}
#item3 {
font-size: 30px;
background: red;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script src="support/style-change.js"></script>
<script>
setup({ explicit_done: true });
function runTest() {
let before = {
item1: {"data-offset-x": 4 },
item2: {"data-offset-x": 0 },
item3: {"data-offset-x": 2 }
}
let after = {
item1: {"data-offset-x": 2 },
item2: {"data-offset-x": 60 },
item3: {"data-offset-x": 0 }
}
evaluateStyleChangeMultiple("before", before);
item2.style.justifySelf = "end";
evaluateStyleChangeMultiple("after", after);
done();
}
</script>
<body onload="document.fonts.ready.then(() => { runTest(); })">
<div id="container">
<div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0">É</div>
<div id="item2" data-expected-width="40" data-expected-height="50" data-offset-y="50">É</div>
<div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100">É</div>
</div>
<div id="log"></div>
</body>