Bug 1625744 [wpt PR 22515] - Add two more FCP tests, based on new spec changes, a=testonly

Automatic update from web-platform-tests
Add two more FCP tests, based on new spec changes (#22515)

Co-authored-by: Noam Rosenthal <noam@webkit.org>
--

wpt-commits: 5721f7843f406054b8e02b0e33ff8e733830cc3d
wpt-pr: 22515
This commit is contained in:
Noam Rosenthal 2020-03-31 12:25:16 +00:00 committed by moz-wptsync-bot
parent 71d0d4d060
commit 6e12001459
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<head>
<title>Performance Paint Timing Test: FCP due for non-empty text input</title>
</head>
<body>
<script src="../resources/utils.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input id="input" type="text" />
<script>
promise_test(async t => {
assert_precondition(window.PerformancePaintTiming, "Paint Timing isn't supported.");
await new Promise(r => window.addEventListener('load', r));
await assertNoFirstContentfulPaint();
const input = document.getElementById('input');
input.setAttribute('value', ' ');
await assertNoFirstContentfulPaint();
input.setAttribute('value', 'value');
await assertFirstContentfulPaint();
}, 'Text input should become contentful when its value is non-empty');
</script>
</body>
</html>

View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<head>
<title>Performance Paint Timing Test: FCP should not fire when all text is hidden due to typographic pseudo-elements</title>
<style>
#main {
position: relative;
width: 100px;
height: 100px;
}
#main *::first-letter {
opacity: 0;
}
/* contentful class is defined in test_fcp script. */
#main.contentful *::first-letter {
opacity: 1;
}
</style>
</head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
<div id="main">
<div>A</div>
</div>
<script>
test_fcp("First contentful paint fires only when some of the text is visible, considering ::first-letter.")
</script>
</body>
</html>