Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Test: Styling</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#styling">
<link id="style1" rel="text" title="Intel" href="./support/unmatch.css">
<link id="style2" rel="alternate stylesheet" type="text/css" title="" href="./support/emptytitle.css">
<link id="style3" rel="alternate stylesheet" type="text/css" href="./support/notitle.css">
<link id="style5" rel="stylesheet" type="text/css" href="./support/normal.css">
<link id="style6" rel="alternate stylesheet" type="text/css" href="./support/normal.css" title="./support/alternate.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="style4" type="text/html">
#test {
height: 100px;
width: 100px;
}
</style>
<style id="style7" type="text/css" media="all" title="./support/alternate.css">
#test {
background-color: green;
}
</style>
</head>
<body>
<div id="log"></div>
<div id="test" style="display:none">STYLING TEST</div>
<script>
test(function() {
var style = null,
i;
for (i = 1; i < 5; i++) {
style = document.getElementById("style" + i);
assert_equals(style.sheet, null, "The sheet attribute of style" + i + " should be null.");
assert_false(style.disabled, "The disabled attribute of style" + i + " should be false.");
}
}, "The LinkStyle interface's sheet attribute must return null; the disabled attribute must be false");
test(function() {
var style = document.createElement("style"),
link = document.createElement("link");
assert_equals(style.sheet, null, "The sheet attribute of the style element not in a document should be null.");
assert_equals(link.sheet, null, "The sheet attribute of the link element not in a document should be null.");
}, "The LinkStyle interface's sheet attribute must return null if the corresponding element is not in a Document");
test(function() {
var style = null,
i;
for (i = 5; i < 8; i++) {
style = document.getElementById("style" + i);
assert_true(style.sheet instanceof StyleSheet, "The sheet attribute of style" + i + " should be a StyleSheet object.");
assert_equals(style.disabled, style.sheet.disabled, "The disabled attribute of style" + i + " should equal to the same attribute of StyleSheet.");
}
}, "The LinkStyle interface's sheet attribute must return StyleSheet object; the disabled attribute must be same as the StyleSheet's disabled attribute");
test(function() {
assert_equals(document.getElementById("style2").title, "", "The title attribute of style2 is incorrect.");
assert_equals(document.getElementById("style5").title, "", "The title attribute of style5 is incorrect.");
assert_equals(document.getElementById("style6").title, "./support/alternate.css", "The title attribute of style6 is incorrect.");
assert_equals(document.getElementById("style7").title, "./support/alternate.css", "The title attribute of style7 is incorrect.");
}, "The title must be the same as the value of the element's title content attribute");
test(function() {
assert_equals(document.getElementById("style5").media, "", "The media attribute of style5 is incorrect.");
assert_equals(document.getElementById("style7").media, "all", "The media attribute of style7 is incorrect.");
}, "The media must be the same as the value of the element's media content attribute, or the empty string if it is omitted");
</script>
</body>
</html>

View file

@ -0,0 +1,7 @@
#test {
color: yellow;
background-color: blue;
width: 100px;
height: 50px;
font-size: .5em;
}

View file

@ -0,0 +1,4 @@
#test {
width: 100px;
height: 100px;
}

View file

@ -0,0 +1,5 @@
#test {
width: 100px;
height: 50px;
font-size: 10px;
}

View file

@ -0,0 +1,4 @@
#test {
width: 100px;
height: 100px;
}

View file

@ -0,0 +1,4 @@
#test {
width: 100px;
height: 100px;
}

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: base_href_empty</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-base-element">
<base id="base" href="" target="_blank">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<img id="test" src="/images/blue-100x100.png" style="display:none">
<script>
var testElement,
baseElement;
setup(function() {
testElement = document.getElementById("test");
baseElement = document.getElementById("base");
});
test(function() {
assert_equals(baseElement.href, document.location.href, "The href of base element is incorrect.");
}, "The value of the href attribute must be the document's address if it is empty");
test(function() {
var exp = testElement.src.substring(0, testElement.src.lastIndexOf("/images/blue-100x100.png") + 1);
assert_true(baseElement.href.indexOf(exp) != -1, "The src of img element is incorrect.");
}, "The src attribute of the img element must relative to document's address");
</script>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: base_href_specified</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-base-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<base id="base" href="http://{{domains[www]}}:{{ports[http][0]}}">
<div id="log"></div>
<img id="test" src="test.ico" style="display:none">
<script>
var testElement;
var baseElement;
setup(function() {
testElement = document.getElementById("test");
baseElement = document.getElementById("base");
});
test(function() {
assert_equals(baseElement.href, "http://{{domains[www]}}:{{ports[http][0]}}/", "The href attribute of the base element is incorrect.");
}, "The href attribute of the base element is specified");
test(function() {
assert_equals(testElement.src, "http://{{domains[www]}}:{{ports[http][0]}}/test.ico", "The src attribute of the img element is incorrect.");
}, "The src attribute of the img element must relative to the href attribute of the base element");
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: base_href_unspecified</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-base-element">
<base id="base" target="_blank">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<img id="test" src="/images/blue-100x100.png" style="display:none">
<script>
var testElement,
baseElement;
setup(function () {
testElement = document.getElementById("test");
baseElement = document.getElementById("base");
});
test(function() {
assert_equals(baseElement.href, document.location.href, "Return the document base URL if the base element has no href content attribute.");
}, "The value of the href attribute must be the document's address if it is unspecified");
test(function() {
var exp = testElement.src.substring(0, testElement.src.lastIndexOf("/images/blue-100x100.png") + 1);
assert_true(baseElement.href.indexOf(exp) != -1, "The src attribute of the img element is incorrect.");
}, "The src attribute of the img element must relative to document's address");
</script>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: base_multiple</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-base-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body onload="on_load()">
<div id="log"></div>
<iframe id="test1" src="example.html" style="width:0;height:0" frameborder="0"></iframe>
<iframe id="test2" src="example.html" name="targetWin" style="width:0;height:0" frameborder="0"></iframe>
<script>
var t = async_test("The attributes of the a element must be affected by the first base element"),
doc1,
fr2,
a1;
function on_load() {
setup(function (){
doc1 = document.getElementById("test1").contentDocument;
fr2 = document.getElementById("test2");
a1 = doc1.getElementById("a1");
});
fr2.addEventListener("load", function () {
t.step(function () {
var doc2 = fr2.contentDocument;
assert_not_equals(doc2.location.href.indexOf("example2.html"), -1, "The target attribute does not impact the a element.");
assert_equals(doc2.getElementById("d1").innerHTML, "PASS", "The opend page should be the example2.html.");
});
t.done();
}, true);
a1.click();
}
</script>
</body>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Example</title>
<base target="targetWin" href="">
<base target="_self" href="http://www.example.com/">
<link rel="author" title="Intel" href="http://www.intel.com/">
<a id="a1" href="example2.html" target="">click me</a>

View file

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Example</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<div id="d1">PASS</div>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>link.relList: non-string contains</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#domtokenlist">
<link rel="help" href="https://heycam.github.io/webidl/#ecmascript-binding">
<link rel="help" href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf#page=57">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link id="link" rel="undefined null 0 NaN Infinity">
<div id="log"></div>
<script>
test(function() {
var list = document.getElementById("link").relList;
assert_equals(list.contains(undefined), true); //"undefined"
assert_equals(list.contains(null), true); //"null"
assert_equals(list.contains(-0), true); //"0"
assert_equals(list.contains(+0), true); //"0"
assert_equals(list.contains(NaN), true); //"NaN"
assert_equals(list.contains(+Infinity), true); //"Infinity"
assert_equals(list.contains(-Infinity), false); //"-Infinity"
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title>link: error events</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<script>
//var t404 = async_test("Should get an error event for a 404 error.")
//t404.step(function() {
// var elt = document.createElement("link");
// elt.onerror = t404.step_func(function() {
// assert_true(true, "Got error event for 404 error.")
// t404.done()
// })
// elt.rel = "stylesheet";
// elt.href = 404 error;
// document.getElementsByTagName("head")[0].appendChild(elt);
//})
var tText = async_test("Should get an error event for a text/plain response.")
tText.step(function() {
var elt = document.createElement("link");
elt.onerror = tText.step_func(function() {
assert_true(true, "Got error event for 404 error.")
tText.done()
})
elt.rel = "stylesheet";
elt.href = "../../../../../common/css-red.txt";
document.getElementsByTagName("head")[0].appendChild(elt);
})
</script>

View file

@ -0,0 +1,22 @@
[
{
"id": "standard-metadata-names",
"original_id": "standard-metadata-names"
},
{
"id": "other-metadata-names",
"original_id": "other-metadata-names"
},
{
"id": "pragma-directives",
"original_id": "pragma-directives"
},
{
"id": "other-pragma-directives",
"original_id": "other-pragma-directives"
},
{
"id": "charset",
"original_id": "charset"
}
]

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-Language" content="ko,zh,ja" >
<title>Multiple languages in Content-Language meta element</title>
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
<link rel='help' href='https://html.spec.whatwg.org/multipage/#pragma-directives'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta name='flags' content='dom'>
<style type='text/css'>
#colonlangcontroltest { color: red; font-weight: bold; width: 400px; }
#colonlangcontroltest:lang(xx) { display:none; }
.test div { width: 50px; }
#box:lang(ko) { width: 100px; }
#box:lang(zh) { width: 100px; }
#box:lang(ja) { width: 100px; }
/* styling for debugging related notes */
.notes span:lang(ko) { background-color: #0000FF; color: white; padding: 0 5px; }
.notes span:lang(zh) { background-color: #0000FF; color: white; padding: 0 5px; }
.notes span:lang(ja) { background-color: #0000FF; color: white; padding: 0 5px; }
</style>
</head>
<body>
<div class="test"><div id="box">&#xA0;</div></div>
<p lang='xx' id='colonlangcontroltest'>This test failed because it relies on :lang for results, but :lang is not supported by this browser.</p>
<!--Notes:
This test uses :lang to detect whether the language has been set. If :lang is not supported, a message will appear and the test will fail.
-->
<script>
test(function() {
assert_equals(document.getElementById('colonlangcontroltest').offsetWidth, 0)
assert_equals(document.getElementById('box').offsetWidth, 50);
}, "The UA will not recognize a language declaration in the Content-Language meta element when more than one language is declared.");
</script>
<div id='log'></div>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>[style] Reference file</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<style>
h4 {
color: green;
}
</style>
<body>
<p>
This page tests that Style written inside HTML comment is not applied
</p>
This test passes if the text below is <b>Green. NOT Red.</b>
<h4>
This is some text.
</h4>
</body>

View file

@ -0,0 +1,18 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="match" href="html_style_in_comment-ref.html"/>
<style type="text/css">
h4 {color: green}
<!--
h4 {color: red}
-->
</style>
</head>
<body>
<p> This page tests that Style written inside HTML comment is not applied</p>
This test passes if the text below is <b>Green. NOT Red.</b>
<h4>
This is some text.
</h4>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title>style: error events</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<script>
//var t404 = async_test("Should get an error event for a 404 error.")
//t404.step(function() {
// var elt = document.createElement("style");
// elt.onerror = t404.step_func(function() {
// assert_true(true, "Got error event for 404 error.")
// t404.done()
// })
// elt.appendChild(
// document.createTextNode('@import 404 error;'));
// document.getElementsByTagName("head")[0].appendChild(elt);
//})
var tText = async_test("Should get an error event for a text/plain response.")
tText.step(function() {
var elt = document.createElement("style");
elt.onerror = tText.step_func(function() {
assert_true(true, "Got error event for 404 error.")
tText.done()
})
elt.appendChild(
document.createTextNode('@import "../../../../common/css-red.txt";'));
document.getElementsByTagName("head")[0].appendChild(elt);
})
</script>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Test: The style should not be applied if it is disabled</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#test {
width: 100px;
}
</style>
<style id="style">
#test {
width: 50px;
}
</style>
</head>
<body>
<div id="log"></div>
<div id="test"></div>
<script>
test(function() {
var testElement = document.getElementById("test");
var style = document.getElementById("style");
var width1, width2;
width1 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width1, "50px", "The style should be applied.");
style.disabled = true;
width2 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width2, "100px", "The style should not be applied.");
}, "The style is not applied when it is disabled");
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Test: The style events</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var tLoad = async_test("If the style is loaded successfully, the 'load' event must be fired");
var tError = async_test("If the style is loaded unsuccessfully, the 'error' event must be fired");
function onstyleload(e) {
tLoad.done();
}
function onstyleerror(e) {
tError.done();
}
</script>
<style onload="onstyleload()">
#test {
height: 100px;
width: 100px;
}
</style>
<style onerror="onstyleerror()">
@import url(nonexistent.css);
</style>
</head>
<body>
<div id="log"></div>
<div id="test"></div>
</body>
</html>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Test: The style information must be applied to the environment specified by the media attribute</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-style-media">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#test {
width: 100px;
}
</style>
<style id="style">
#test {
width: 50px;
}
</style>
</head>
<body>
<div id="log"></div>
<div id="test"></div>
<script>
test(function() {
var testElement = document.getElementById("test");
var style = document.getElementById("style");
var width1, width2;
width1 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width1, "50px", "The style should be applied.");
style.media = "print";
width2 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width2, "100px", "The style should not be applied.");
}, "The style information must be applied to the environment specified by the media attribute");
</script>
</body>
</html>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Test: The scoped attribute must apply the style information only to its parent element</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-style-scoped">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#test {
width: 50px;
}
</style>
</head>
<body>
<div id="log"></div>
<div id="test"></div>
<div>
<style id="style">
#test {
width: 100px;
}
</style>
<div>
<script>
test(function() {
var testElement = document.getElementById("test");
var style = document.getElementById("style");
var width1, width2;
width1 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width1, "100px", "The style 'width' should be applied.");
style.scoped = true;
width2 = window.getComputedStyle(testElement, false)["width"];
assert_equals(width2, "50px", "The width should not be applied.");
}, "The scoped attribute is present, the style information must be applied only to its parent element");
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>title.text with comment and element children.</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
try {
var title = document.getElementsByTagName("title")[0];
while (title.childNodes.length)
title.removeChild(title.childNodes[0]);
title.appendChild(document.createComment("COMMENT"));
title.appendChild(document.createTextNode("TEXT"));
title.appendChild(document.createElement("a"))
.appendChild(document.createTextNode("ELEMENT"))
} catch (e) {
}
</script>
<script>
test(function() {
assert_equals(title.text, "TEXT");
assert_equals(title.textContent, "TEXTELEMENT");
})
</script>

View file

@ -0,0 +1,30 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>title.text with comment and element children.</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
try {
var title = document.getElementsByTagName("title")[0];
while (title.childNodes.length)
title.removeChild(title.childNodes[0]);
title.appendChild(document.createComment("COMMENT"));
title.appendChild(document.createTextNode("TEXT"));
title.appendChild(document.createElement("a"))
.appendChild(document.createTextNode("ELEMENT"))
} catch (e) {
}
</script>
<script>
test(function() {
assert_equals(title.text, "TEXT");
assert_equals(title.textContent, "TEXTELEMENT");
})
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title> title.text and space normalization </title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_equals(document.getElementsByTagName("title")[0].text,
" title.text and space normalization ");
assert_equals(document.getElementsByTagName("title")[0].textContent,
" title.text and space normalization ");
assert_equals(document.getElementsByTagName("title")[0].firstChild.nodeValue,
" title.text and space normalization ");
}, "title.text and space normalization (markup)");
[
"one space", "two spaces",
"one\ttab", "two\t\ttabs",
"one\nnewline", "two\n\nnewlines",
"one\fform feed", "two\f\fform feeds",
"one\rcarriage return", "two\r\rcarriage returns"
].forEach(function(str) {
test(function() {
document.title = str;
var title = document.getElementsByTagName("title")[0];
assert_equals(title.text, str);
assert_equals(title.textContent, str);
assert_equals(title.firstChild.nodeValue, str);
}, "title.text and space normalization: " + format_value(str))
});
</script>

View file

@ -0,0 +1,37 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> title.text and space normalization </title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
assert_equals(document.getElementsByTagName("title")[0].text,
" title.text and space normalization ");
assert_equals(document.getElementsByTagName("title")[0].textContent,
" title.text and space normalization ");
assert_equals(document.getElementsByTagName("title")[0].firstChild.nodeValue,
" title.text and space normalization ");
}, "title.text and space normalization (markup)");
[
"one space", "two spaces",
"one\ttab", "two\t\ttabs",
"one\nnewline", "two\n\nnewlines",
"one\fform feed", "two\f\fform feeds",
"one\rcarriage return", "two\r\rcarriage returns"
].forEach(function(str) {
test(function() {
document.title = str;
var title = document.getElementsByTagName("title")[0];
assert_equals(title.text, str);
assert_equals(title.textContent, str);
assert_equals(title.firstChild.nodeValue, str);
}, "title.text and space normalization: " + format_value(str))
});
</script>
</body>
</html>