diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html')
-rw-r--r-- | testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html new file mode 100644 index 0000000000..0bb149f00e --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta charset="utf-8"> +<title>Soft navigation visited link paint tests.</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/soft-navigation-helper.js"></script> +</head> +<body> + <main id=main> + <a id=link>Click me!</a> + <a id=visited>link that is really long so it is the LCP</a> + </main> + <script> + const visited = document.getElementById("visited"); + const fake_url = "./fake_" + Math.random(); + visited.href = fake_url; + const visitFakeURLAndAddInvisibleText = () => { + requestAnimationFrame(() => requestAnimationFrame(() => { + history.replaceState({}, "", fake_url); + })); + const main = document.getElementById("main"); + const div = document.createElement("div"); + const text = document.createTextNode("Lorem Ipsum"); + div.appendChild(text); + main.appendChild(div); + } + const link = document.getElementById("link"); + testSoftNavigation({ + addContent: async () => { + await visitFakeURLAndAddInvisibleText(); + }, + link: link, + validate: async () => { + await new Promise(r => step_timeout(r, 100)); + const postVisitedLcp = await getLcpEntries(); + assert_not_equals(postVisitedLcp[postVisitedLcp.length - 1].id, + "visited", + "Soft Nav LCP ID should not be visited"); + }, + test: "Test that a visited link doesn't trigger LCP after a soft " + + "navigation is detected"}); + </script> +</body> +</html> |