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,13 @@
<!DOCTYPE html>
<title>document.compatMode: Standards</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode">
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "CSS1Compat");
})
</script>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>document.compatMode: Almost standards</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode">
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "CSS1Compat");
})
</script>

View file

@ -0,0 +1,12 @@
<title>document.compatMode: Quirks</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode">
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "BackCompat");
})
</script>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>document.compatMode: Standards</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode"/>
</head>
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "CSS1Compat");
})
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>document.compatMode: Standards</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode"/>
</head>
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "CSS1Compat");
})
</script>
</body>
</html>

View file

@ -0,0 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>document.compatMode: Standards</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-compatmode"/>
</head>
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(document.compatMode, "CSS1Compat");
})
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>document.cookie</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#resource-metadata-management">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function(){
assert_equals(document.cookie, "");
}, "document has no cookie");
test(function(){
var doc = document.implementation.createHTMLDocument("doc");
assert_equals(doc.cookie, "");
doc.cookie = "test=foobar";
assert_equals(doc.cookie, "");
}, "getting cookie for a cookie-averse document returns empty string, setting does nothing");
</script>

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<title>document.lastModified should return current local time</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var d = new Date();
var last_modified = document.lastModified;
var initial_modified = Date.parse(last_modified) / 1000;
var expected = Math.round(d / 1000);
test(function() {
assert_approx_equals(initial_modified, expected, 2.5);
}, "Date returned by lastModified is current at page load");
var pattern = /[0-9]{2}\/[0-9]{2}\/[0-9]{4} ([0-9]{2}):([0-9]{2}):([0-9]{2})/
test(function() {
assert_regexp_match(last_modified, pattern,
"Format should match the pattern \"NN/NN/NNNN NN:NN:NN\".");
}, "Date returned by lastModified is in the form \"MM/DD/YYYY hh:mm:ss\".");
var hours = d.getHours()
var minutes = d.getMinutes()
var seconds = d.getSeconds()
test(function() {
var local_time = hours * 60 * 60 + minutes * 60 + seconds;
var m = pattern.exec(last_modified);
var last_modified_time = parseInt(m[1]) * 60 * 60 + parseInt(m[2]) * 60 + parseInt(m[3]);
assert_approx_equals(last_modified_time, local_time, 2,
"Hours and minutes should match local time.");
}, "Date returned by lastModified is in the user's local time zone.");
var t = async_test("Date returned by lastModified is current after timeout.");
setTimeout(function() {
t.step(function() {
var new_modified = Date.parse(document.lastModified) / 1000;
var new_expected = Math.round(new Date() / 1000);
assert_approx_equals(new_modified, new_expected, 2.5,
"(initial value was " + initial_modified + ")");
t.done();
});
}, 4000);
</script>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>document.lastModified</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#resource-metadata-management">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function(){
var date = new Date("Thu, 01 Jan 1970 01:23:45 GMT");
var result = ('0' + (date.getMonth()+1)).slice(-2) + '/' + ('0' + date.getDate()).slice(-2) + '/' + date.getFullYear() + " " + [date.getHours(),date.getMinutes(),date.getSeconds()].map(function(n){return ("0" + n).slice(-2);}).join(":");
assert_equals(document.lastModified, result);
}, "lastModified should return the last modified date and time");
</script>

View file

@ -0,0 +1 @@
Last-Modified: Thu, 01 Jan 1970 01:23:45 GMT

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>document.readyState</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#resource-metadata-management">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t1 = async_test("readyState equals 'complete' when the document has loaded"),
t2 = async_test("readyState equals 'interactive' when the document is finished parsing"),
t3 = async_test("readystatechange event is fired each time document.readyState changes");
window.onload = t1.step_func_done(function(){
assert_equals(document.readyState, "complete");
});
document.addEventListener("DOMContentLoaded", function(event) {
t2.step(function() {
assert_equals(document.readyState, "interactive")
});
t2.done();
});
var states = [document.readyState];
document.onreadystatechange = t3.step_func(function(){
states.push(document.readyState);
if (document.readyState === "complete") {
assert_array_equals(states, ["loading", "interactive", "complete"]);
t3.done();
}
})
</script>