Automatic update from web-platform-tests [mathml] Implement target and hyperlinkutils for MathML a element Adds wpt tests for href and target attributes Adds wpt tests for HyperlinkUtils mixin for mathml a element Bug: 510487697 Change-Id: I1cede1a6d1c76f25562f696454cd977673e58b85 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7970997 Reviewed-by: Fredrik Söderquist <fs@opera.com> Reviewed-by: Frédéric Wang Nélar <fwang@igalia.com> Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com> Cr-Commit-Position: refs/heads/main@{#1652445} -- wpt-commits: 6f870302908fb5a3b9e40e865c049ece2a29a557 wpt-pr: 60892
65 lines
3.0 KiB
HTML
65 lines
3.0 KiB
HTML
<!doctype html>
|
|
<meta charset="utf-8">
|
|
<title>MathMLAnchorElement getters and setters</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<math>
|
|
<a>anchor</a>
|
|
</math>
|
|
<script>
|
|
// Elements for each test: [property, oldresult, newvalue, newresult, oldurl, newurl]
|
|
// [0] [1] [2] [3] [4] [5]
|
|
tests = [
|
|
["hash", "#somehash", "someother", "#someother",
|
|
"http://google.com/index.html#somehash",
|
|
"http://google.com/index.html#someother"],
|
|
["hash", "#somehash", "#someother", "#someother",
|
|
"http://google.com/index.html#somehash",
|
|
"http://google.com/index.html#someother"],
|
|
["host", "google.com:1234", "github.com:4444", "github.com:4444",
|
|
"http://google.com:1234/somedir",
|
|
"http://github.com:4444/somedir"],
|
|
["hostname", "google.com", "github.com", "github.com",
|
|
"http://google.com:1234/somedir",
|
|
"http://github.com:1234/somedir"],
|
|
["href", "http://google.com:1234/somedir", "http://goo-gle.com:1234/other/x.html", "http://goo-gle.com:1234/other/x.html",
|
|
"http://google.com:1234/somedir",
|
|
"http://goo-gle.com:1234/other/x.html"],
|
|
["password", "flabada", "blubb", "blubb",
|
|
"https://anonymous:flabada@developer.mozilla.org/en-US/docs/",
|
|
"https://anonymous:blubb@developer.mozilla.org/en-US/docs/"],
|
|
["pathname", "/somedir/someotherdir/index.html", "/newpath/x.txt", "/newpath/x.txt",
|
|
"http://google.com:1234/somedir/someotherdir/index.html",
|
|
"http://google.com:1234/newpath/x.txt"],
|
|
["port", "1234", "4444", "4444", "http://google.com:1234/somedir", "http://google.com:4444/somedir"],
|
|
["protocol", "http:", "ftp:", "ftp:", "http://google.com/somedir", "ftp://google.com/somedir"],
|
|
["protocol", "http:", "ftp", "ftp:", "http://google.com/somedir", "ftp://google.com/somedir"],
|
|
["search", "?ho", "?hi", "?hi", "http://google.com/q.php?ho", "http://google.com/q.php?hi"],
|
|
["search", "?ho", "hi", "?hi", "http://google.com/q.php?ho", "http://google.com/q.php?hi"],
|
|
["search", "?ho", "?hi", "?hi", "http://google.com/?ho", "http://google.com/?hi"],
|
|
["search", "?ho", "hi", "?hi", "http://google.com/?ho", "http://google.com/?hi"],
|
|
["username", "anonymous", "wellknown", "wellknown",
|
|
"https://anonymous:pwd@developer.mozilla.org:1234/en-US/",
|
|
"https://wellknown:pwd@developer.mozilla.org:1234/en-US/"]
|
|
];
|
|
|
|
for (var i = 0; i < tests.length; i++) {
|
|
test(function (t) {
|
|
const [property, oldresult, newval, newresult, oldurl, newurl] = tests[i]
|
|
var a = document.querySelector('a');
|
|
|
|
t.add_cleanup(() => {
|
|
a.href = "";
|
|
});
|
|
|
|
a.href = oldurl;
|
|
var r1 = a[property];
|
|
assert_equals(r1, oldresult);
|
|
a[property] = newval;
|
|
var r2 = a[property];
|
|
assert_equals(r2, newresult);
|
|
var r3 = a.href;
|
|
assert_equals(r3, newurl);
|
|
}, `Getter and setter for attribute of anchor element(${i}): ${tests[i][0]}`);
|
|
}
|
|
</script> |