mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update web-platform-tests to revision a89693b62066da0e4808c0bc76c581188398e73d
This commit is contained in:
parent
1e79f27cd4
commit
7ddb44a302
102 changed files with 1119 additions and 421 deletions
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset={{GET[encoding]}}> <!-- ends up as <meta charset> by default which is windows-1252 -->
|
||||
<meta name=variant content="?encoding=x-cp1251">
|
||||
<meta name=variant content="?encoding=utf8">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<link rel=help href=https://html.spec.whatwg.org/multipage/rendering.html#the-page>
|
||||
<link rel=help href=https://html.spec.whatwg.org/multipage/rendering.html#tables-2>
|
||||
<link rel=help href=https://html.spec.whatwg.org/multipage/#reflecting-content-attributes-in-idl-attributes>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function expected(encoding) {
|
||||
return "?" + {
|
||||
"UTF-8": "%C3%BF",
|
||||
"windows-1251": "%26%23255%3B",
|
||||
"windows-1252": "%FF"
|
||||
}[encoding];
|
||||
}
|
||||
|
||||
function assert_ends_with(input, endsWith) {
|
||||
assert_true(input.endsWith(endsWith), input + " did not end with " + endsWith);
|
||||
}
|
||||
|
||||
"body table thead tbody tfoot tr td th".split(" ").forEach(localName => {
|
||||
test(t => {
|
||||
const elm = document.createElement(localName);
|
||||
document.body.appendChild(elm);
|
||||
t.add_cleanup(() => document.body.removeChild(elm));
|
||||
elm.setAttribute("background", "?\u00FF");
|
||||
assert_ends_with(getComputedStyle(elm).backgroundImage, expected(document.characterSet) + "\")");
|
||||
}, "getComputedStyle <" + localName + " background>");
|
||||
});
|
||||
|
||||
function test_url_reflecting(localName, attr, idlAttr) {
|
||||
idlAttr = idlAttr || attr;
|
||||
test(() => {
|
||||
let input = "?\u00FF";
|
||||
const elm = document.createElement(localName);
|
||||
assert_true(idlAttr in elm, idlAttr + " is not supported");
|
||||
elm.setAttribute(attr, input);
|
||||
assert_ends_with(elm[idlAttr], expected(document.characterSet));
|
||||
}, "Getting <" + localName + ">." + idlAttr);
|
||||
}
|
||||
|
||||
("iframe src, a href, area href, base href, link href, img src, embed src, object data, " +
|
||||
"track src, video src, audio src, input src, form action, input formaction formAction, " +
|
||||
"button formaction formAction, script src").split(", ").forEach(str => {
|
||||
const arr = str.split(" ");
|
||||
test_url_reflecting(arr[0], arr[1], arr[2]);
|
||||
});
|
||||
|
||||
function test_string_reflecting(localName, attr) {
|
||||
test(() => {
|
||||
let input = "?\u00FF ?\u00FF";
|
||||
const elm = document.createElement(localName);
|
||||
assert_true(attr in elm, attr + " is not supported");
|
||||
elm.setAttribute(attr, input);
|
||||
assert_equals(elm[attr], input);
|
||||
}, "Getting <" + localName + ">." + attr);
|
||||
}
|
||||
|
||||
"a ping, area ping".split(", ").forEach(str => {
|
||||
const arr = str.split(" ");
|
||||
test_string_reflecting(arr[0], arr[1]);
|
||||
});
|
||||
</script>
|
|
@ -49,55 +49,6 @@ onload = function() {
|
|||
test_obj.step_timeout(poll, 200);
|
||||
}
|
||||
|
||||
// background attribute, check with getComputedStyle
|
||||
function test_background(tag) {
|
||||
var spec_url = 'https://html.spec.whatwg.org/multipage/rendering.html';
|
||||
spec_url += tag == 'body' ? '#the-page' : '#tables';
|
||||
test(function() {
|
||||
var elm = document.createElement(tag);
|
||||
document.body.appendChild(elm);
|
||||
this.add_cleanup(function() {
|
||||
document.body.removeChild(elm);
|
||||
});
|
||||
elm.setAttribute('background', input_url_png);
|
||||
var got = getComputedStyle(elm).backgroundImage;
|
||||
assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got));
|
||||
}, 'getComputedStyle <'+tag+' background>',
|
||||
{help:spec_url});
|
||||
}
|
||||
|
||||
'body, table, thead, tbody, tfoot, tr, td, th'.split(', ').forEach(function(str) {
|
||||
test_background(str);
|
||||
});
|
||||
|
||||
// get a reflecting IDL attributes whose content attribute takes a URL or a list of space-separated URLs
|
||||
function test_reflecting(tag, attr, idlAttr, multiple) {
|
||||
idlAttr = idlAttr || attr;
|
||||
var input = input_url_html;
|
||||
if (multiple) {
|
||||
input += ' ' + input;
|
||||
}
|
||||
test(function() {
|
||||
var elm = document.createElement(tag);
|
||||
assert_true(idlAttr in elm, idlAttr + ' is not supported');
|
||||
elm.setAttribute(attr, input);
|
||||
var got = elm[idlAttr];
|
||||
assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got));
|
||||
}, 'Getting <'+tag+'>.'+idlAttr + (multiple ? ' (multiple URLs)' : ''),
|
||||
{help:'https://html.spec.whatwg.org/multipage/#reflecting-content-attributes-in-idl-attributes'});
|
||||
}
|
||||
|
||||
('iframe src, a href, base href, link href, img src, embed src, object data, track src, video src, audio src, input src, form action, ' +
|
||||
'input formaction formAction, button formaction formAction, script src').split(', ').forEach(function(str) {
|
||||
var arr = str.split(' ');
|
||||
test_reflecting(arr[0], arr[1], arr[2]);
|
||||
});
|
||||
|
||||
'a ping'.split(', ').forEach(function(str) {
|
||||
var arr = str.split(' ');
|
||||
test_reflecting(arr[0], arr[1], arr[2], true);
|
||||
});
|
||||
|
||||
function setup_navigation(elm, iframe, id, test_obj) {
|
||||
iframe.name = id;
|
||||
elm.target = id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue