Update web-platform-tests to revision 7f2f85a88f434798e9d643427b34b05fab8278c6

This commit is contained in:
Ms2ger 2016-02-01 09:19:46 +01:00
parent 6b1a08c051
commit 73bc5cf1b8
180 changed files with 5807 additions and 169 deletions

View file

@ -0,0 +1,47 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLAreaElement coords parsing</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0 }
</style>
<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
<map name=x><area id=area></map>
<script src=support/hit-test.js></script>
<script>
tests = [
{desc: 'COMMA', shape: 'rect', coords: "2,2,10,10", hit: hitRect},
{desc: 'SEMICOLON', shape: 'rect', coords: "2;2;10;10", hit: hitRect},
{desc: 'SPACE', shape: 'rect', coords: "2 2 10 10", hit: hitRect},
{desc: 'TAB', shape: 'rect', coords: "2\t2\t10\t10", hit: hitRect},
{desc: 'FORM FEED', shape: 'rect', coords: "2\f2\f10\f10", hit: hitRect},
{desc: 'LINE FEED', shape: 'rect', coords: "2\n2\n10\n10", hit: hitRect},
{desc: 'CARRIGAGE RETURN', shape: 'rect', coords: "2\r2\r10\r10", hit: hitRect},
{desc: 'LINE TABULATION', shape: 'rect', coords: "2\u000b2\u000b10\u000b10", hit: hitNone},
{desc: 'LINE NEXT', shape: 'rect', coords: "2\u00852\u008510\u008510", hit: hitNone},
{desc: 'EN QUAD', shape: 'rect', coords: "2\u20002\u200010\u200010", hit: hitNone},
{desc: 'abc between numbers', shape: 'rect', coords: "2a2b20c20,2,10,10", hit: hitRect},
{desc: 'COLON between numbers', shape: 'rect', coords: "2:2:20:20,2,10,10", hit: hitRect},
{desc: 'U+0000 between numbers', shape: 'rect', coords: "2\u00002\u000020\u000020,2,10,10", hit: hitRect},
{desc: 'leading COMMA', shape: 'rect', coords: ",2,2,10,10", hit: hitRect},
{desc: 'leading SPACE', shape: 'rect', coords: " 2,2,10,10", hit: hitRect},
{desc: 'leading SEMICOLON', shape: 'rect', coords: ";2,2,10,10", hit: hitRect},
{desc: 'trailing COMMA', shape: 'rect', coords: "2,2,10,", hit: hitNone},
{desc: 'trailing SPACE', shape: 'rect', coords: "2,2,10 ", hit: hitNone},
{desc: 'trailing SEMICOLON', shape: 'rect', coords: "2,2,10;", hit: hitNone},
{desc: 'PERCENT', shape: 'rect', coords: "2%,2%,10%,10%", hit: hitRect},
{desc: 'CSS units', shape: 'rect', coords: "2in,2in,10cm,10cm", hit: hitRect},
{desc: 'float', shape: 'rect', coords: "1.4,1.4,10,10", hit: hitRect},
{desc: 'number starting with PERIOD', shape: 'rect', coords: ".4,.4,10,10", hit: [[area, 1, 1], [img, 0, 0]]},
{desc: 'sci-not', shape: 'rect', coords: "2,2,1e1,1e1", hit: hitRect},
{desc: 'leading/trailing garbage', shape: 'rect', coords: "='2,2,10,10' ", hit: hitRect},
{desc: 'non-ascii garbage', shape: 'rect', coords: "“2,2,10,10\"", hit: hitRect},
{desc: 'URL garbage with number', shape: 'rect', coords: "2,2,10ls/spain/holidays/regions/10/Canary+Islands/Canary+Islands.html", hit: hitNone},
{desc: 'consecutive COMMAs', shape: 'rect', coords: "2,,10,10", hit: hitNone},
{desc: 'consecutive SPACEs', shape: 'rect', coords: "2 10,10", hit: hitNone},
{desc: 'consecutive SEMICOLONs', shape: 'rect', coords: "2;;10,10", hit: hitNone},
{desc: 'several consecutive separators', shape: 'rect', coords: ",,2;,;2,;,10 \t\r\n10;;", hit: hitRect},
{desc: 'one too many numbers, trailing COMMA', shape: 'poly', coords: "100,100,120,100,100,120,300,", hit: hitPoly},
];
</script>

View file

@ -0,0 +1,32 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLAreaElement processing</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0 }
</style>
<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
<map name=x><area id=area></map>
<script src=support/hit-test.js></script>
<script>
var tests = [
{desc: 'too few numbers', shape: 'rect', coords: "2,2,10", hit: hitNone},
{desc: 'negative', shape: 'rect', coords: "-10,-10,10,10", hit: [[area, 1, 1], [img, 299, 299]]},
{desc: 'empty string', shape: 'rect', coords: "", hit: hitNone},
{desc: 'omitted coords', shape: 'rect', coords: null, hit: hitNone},
{desc: 'first > third', shape: 'rect', coords: "10,2,2,10", hit: hitRect},
{desc: 'second > fourth', shape: 'rect', coords: "2,10,10,2", hit: hitRect},
{desc: 'first > third, second > fourth', shape: 'rect', coords: "10,10,2,2", hit: hitRect},
{desc: 'negative', shape: 'default', coords: "-10,-10,-10,-10", hit: hitAll},
{desc: 'too few numbers', shape: 'circle', coords: "20,40", hit: hitNone},
{desc: 'negative radius', shape: 'circle', coords: "20,40,-10", hit: hitNone},
{desc: 'zero radius', shape: 'circle', coords: "20,40,0", hit: hitNone},
{desc: 'too few numbers', shape: 'poly', coords: "100,100,120,100,100", hit: hitNone},
{desc: 'one too many numbers', shape: 'poly', coords: "100,100,120,100,100,120,300", hit: hitPoly},
{desc: 'even-odd rule', shape: 'poly', coords: "100,100,200,100,100,200,150,50,200,200", hit: hitStar},
];
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLAreaElement shape</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0 }
</style>
<img src=/images/threecolors.png usemap=#x id=img width=300 height=300>
<map name=x><area id=area></map>
<script src=support/hit-test.js></script>
<script>
var tests = [
{desc: 'missing value default', shape: null, coords: "2,2,10,10", hit: hitRect},
{desc: 'missing value default', shape: null, coords: "20,40,10", hit: hitNone},
{desc: 'missing value default', shape: null, coords: null, hit: hitNone},
{desc: 'invalid value default', shape: 'foobar invalid', coords: "2,2,10,10", hit: hitRect},
{desc: 'invalid value default', shape: '', coords: "2,2,10,10", hit: hitRect},
{desc: 'empty string', shape: 'default', coords: "", hit: hitAll},
{desc: 'omitted coords', shape: 'DEFAULT', coords: null, hit: hitAll},
{desc: 'simple', shape: 'circle', coords: "20,40,10", hit: hitCircle},
{desc: 'simple', shape: 'circ', coords: "20,40,10", hit: hitCircle},
{desc: 'simple', shape: 'CIRCLE', coords: "20,40,10", hit: hitCircle},
{desc: 'simple', shape: 'CIRC', coords: "20,40,10", hit: hitCircle},
{desc: 'LATIN CAPITAL LETTER I WITH DOT ABOVE', shape: 'C\u0130RCLE', coords: "20,40,10", hit: hitNone},
{desc: 'LATIN SMALL LETTER DOTLESS I', shape: 'c\u0131rcle', coords: "20,40,10", hit: hitNone},
{desc: 'simple', shape: 'poly', coords: "100,100,120,100,100,120", hit: hitPoly},
{desc: 'simple', shape: 'polygon', coords: "100,100,120,100,100,120", hit: hitPoly},
];
</script>

View file

@ -1,18 +0,0 @@
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>AREA - NOREF</title>
</head>
<body>
<p>Test for <b>nohref</b> attribute on <b>area</b> </p>
<p>Hover over the Blue Square below. The square is not clickable but the area around it should be.</p>
<p>The test passes if clicking on the square doesn't do anything. Clicking on the area around the square should take you to another page.</p>
<img src="../../../../images/blue-area.png" height="180" width="228" usemap="#square" border="0"/>
<map name="square">
<area alt="Blue Square" coords="43,29,176,135" nohref=""/>
<area shape="rect" alt="White Space" coords="0,0,227,179" href="test-area.xhtml"/>
</map>
<p>
<i>Note - This test checks for User Agent requirement as per HTML5 spec NOT the author requirement</i>
</p>
</body>
</html>

View file

@ -0,0 +1,42 @@
setup({explicit_done: true});
var img = document.getElementById('img');
var area = document.getElementById('area');
var hitRect = [[area, 3, 3], [area, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]];
var hitNone = [[img, 3, 3], [img, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]];
var hitAll = [[area, 1, 1], [area, 1, 299], [area, 299, 1], [area, 299, 299], [area, 21, 41], [area, 101, 101]];
var hitCircle = [[area, 11, 40], [area, 29, 40], [area, 20, 31], [area, 20, 49], [img, 12, 32], [img, 28, 48], [img, 101, 101]];
var hitPoly = [[area, 101, 101], [area, 119, 101], [area, 101, 119], [img, 118, 118], [img, 3, 3], [img, 21, 41]];
var hitStar = [[area, 101, 101], [area, 199, 101], [area, 150, 51], [img, 150, 125], [img, 3, 3], [img, 21, 41]];
var tests;
// The test file should have `tests` defined as follows:
// tests = [
// {desc: string, shape: string?, coords: string?, hit: [[element, x, y], ...]},
// ...
// ];
onload = function() {
tests.forEach(function(t) {
test(function(t_obj) {
if (area.shape === null) {
area.removeAttribute('shape');
} else {
area.shape = t.shape;
}
if (area.coords === null) {
area.removeAttribute('coords');
} else {
area.coords = t.coords;
}
t.hit.forEach(function(arr) {
var expected = arr[0];
var x = arr[1];
var y = arr[2];
assert_equals(document.elementFromPoint(x, y), expected, 'elementFromPoint('+x+', '+y+')');
});
}, t.desc + ': ' + format_value(t.coords) + ' (' + t.shape + ')');
});
done();
};

View file

@ -1,9 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> This is a test page</title>
</head>
<body>
This is a simple xhtml page
<p><a href="area_nohref.xhtml">Click here</a> to go back to the previous page</p>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title>HTML Test: The embed element represents a document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
<meta name="assert" content="Check if the embed element represents a document when a text/html resource source is used">
<body>
<script type="application/javascript">
var childLoaded = false;
t = async_test("Test document type embedding");
addEventListener("load", t.step_func_done(function() { assert_true(childLoaded); }));
</script>
<embed src="embed-iframe.html">
</body>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script type="application/javascript">
parent.childLoaded = true;
</script>
</body>

View file

@ -83,9 +83,22 @@
checkbox5.onclick = t5.step_func(function(e) {
e.preventDefault();
assert_false(checkbox5.checked);
/*
The prevention of the click doesn't have an effect until after all the
click event handlers have been run.
*/
assert_true(checkbox5.checked);
assert_false(checkbox5.indeterminate);
t5.done();
window.setTimeout(t5.step_func(function(e) {
/*
The click event has finished being dispatched, so the checkedness and
determinateness have been toggled back by now because the event
was preventDefault-ed.
*/
assert_false(checkbox5.checked);
assert_false(checkbox5.indeterminate);
t5.done();
}), 0);
});
t5.step(function(){
@ -97,9 +110,22 @@
checkbox6.onclick = t6.step_func(function(e) {
checkbox6.indeterminate = true;
e.preventDefault();
assert_false(checkbox6.checked);
assert_false(checkbox6.indeterminate);
t6.done();
/*
The prevention of the click doesn't have an effect until after all the
click event handlers have been run.
*/
assert_true(checkbox6.checked);
assert_true(checkbox6.indeterminate);
window.setTimeout(t6.step_func(function(e) {
/*
The click event has finished being dispatched, so the checkedness and
determinateness have been toggled back by now because the event
was preventDefault-ed.
*/
assert_false(checkbox6.checked);
assert_false(checkbox6.indeterminate);
t6.done();
}), 0);
});
t6.step(function(){