Update web-platform-tests to revision 66c4613f823c4384c78ada77346eda17bb128947

This commit is contained in:
Ms2ger 2016-03-15 15:55:36 +01:00
parent 183772583f
commit a91433f0c8
234 changed files with 4368 additions and 967 deletions

View file

@ -8,11 +8,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/Blob.js"></script>
<p><strong><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=23683">Discussion</a>
is ongoing that will affect a number of the following tests.</strong>
<div id="log"></div>
<!-- used by "platform object that supports indexed properties" tests -->
<iframe style="display:none"></iframe>
<script>
test(function() {
assert_true("Blob" in window, "window should have a Blob property.");
@ -51,6 +47,10 @@ test(function() {
"FAIL",
new Date(),
new RegExp(),
{},
{ 0: "FAIL", length: 1 },
document.createElement("div"),
window,
];
args.forEach(function(arg) {
assert_throws(new TypeError(), function() {
@ -60,18 +60,24 @@ test(function() {
}, "Passing non-objects, Dates and RegExps for blobParts should throw a TypeError.");
test_blob(function() {
return new Blob({});
return new Blob({
[Symbol.iterator]: Array.prototype[Symbol.iterator],
});
}, {
expected: "",
type: "",
desc: "A plain object should be treated as a sequence for the blobParts argument."
desc: "A plain object with @@iterator should be treated as a sequence for the blobParts argument."
});
test_blob(function() {
return new Blob({ 0: "PASS", length: 1 });
return new Blob({
[Symbol.iterator]: Array.prototype[Symbol.iterator],
0: "PASS",
length: 1
});
}, {
expected: "PASS",
type: "",
desc: "A plain object with a length property should be treated as a sequence for the blobParts argument."
desc: "A plain object with @@iterator and a length property should be treated as a sequence for the blobParts argument."
});
test_blob(function() {
return new Blob(new String("xyz"));
@ -88,10 +94,14 @@ test_blob(function() {
desc: "A Uint8Array object should be treated as a sequence for the blobParts argument."
});
var test_error = { name: "test" };
var test_error = {
name: "test",
message: "test error",
};
test(function() {
var obj = {
[Symbol.iterator]: Array.prototype[Symbol.iterator],
get length() { throw test_error; }
};
assert_throws(test_error, function() {
@ -99,7 +109,7 @@ test(function() {
});
}, "The length getter should be invoked and any exceptions should be propagated.");
test_blob(function() {
test(function() {
var element = document.createElement("div");
element.appendChild(document.createElement("div"));
element.appendChild(document.createElement("p"));
@ -107,16 +117,15 @@ test_blob(function() {
Object.defineProperty(list, "length", {
get: function() { throw test_error; }
});
return new Blob(list);
}, {
expected: "[object HTMLDivElement][object HTMLParagraphElement]",
type: "",
desc: "A platform object that supports indexed properties should be treated as a sequence for the blobParts argument (overwritten 'length'.)"
});
assert_throws(test_error, function() {
new Blob(list);
});
}, "A platform object that supports indexed properties should be treated as a sequence for the blobParts argument (overwritten 'length'.)");
test(function() {
assert_throws(test_error, function() {
var obj = {
[Symbol.iterator]: Array.prototype[Symbol.iterator],
length: {
valueOf: null,
toString: function() { throw test_error; }
@ -126,6 +135,7 @@ test(function() {
});
assert_throws(test_error, function() {
var obj = {
[Symbol.iterator]: Array.prototype[Symbol.iterator],
length: { valueOf: function() { throw test_error; } }
};
new Blob(obj);
@ -135,6 +145,10 @@ test(function() {
test(function() {
var received = [];
var obj = {
get [Symbol.iterator]() {
received.push("Symbol.iterator");
return Array.prototype[Symbol.iterator];
},
get length() {
received.push("length getter");
return {
@ -166,15 +180,18 @@ test(function() {
new Blob(obj);
});
assert_array_equals(received, [
"Symbol.iterator",
"length getter",
"length valueOf",
"0 getter",
"0 toString",
"1 getter"
"length getter",
"length valueOf",
"1 getter",
]);
}, "Getters and value conversions should happen in order until an exception is thrown.");
// XXX should add tests edge cases of ToUint32(length)
// XXX should add tests edge cases of ToLength(length)
test(function() {
assert_throws(test_error, function() {
@ -201,7 +218,7 @@ test_blob(function() {
];
return new Blob(arr);
}, {
expected: "PASSundefined",
expected: "PASS",
type: "",
desc: "Changes to the blobParts array should be reflected in the returned Blob (pop)."
});
@ -211,19 +228,19 @@ test_blob(function() {
{
toString: function() {
if (arr.length === 3) {
return "SS";
return "A";
}
arr.unshift({
toString: function() {
assert_unreached("Should only access index 0 once.");
}
});
return "PA";
return "P";
}
},
{
toString: function() {
assert_unreached("Should not access the final element.");
return "SS";
}
}
];
@ -297,29 +314,6 @@ test_blob(function() {
desc: "Passing a Float64Array as element of the blobParts array should work."
});
test_blob(function() {
return new Blob(document.createElement("div"));
}, {
expected: "",
type: "",
desc: "Passing an element as the blobParts array should work."
});
test_blob(function() {
return new Blob(window);
}, {
expected: "[object Window]",
type: "",
desc: "Passing an platform object that supports indexed properties as the blobParts array should work (window)."
});
test_blob(function() {
window[0].toString = function() { return "foo"; };
return new Blob(window);
}, {
expected: "foo",
type: "",
desc: "Passing an platform object that supports indexed properties as the blobParts array should work (window with custom toString)."
});
test_blob(function() {
var select = document.createElement("select");
select.appendChild(document.createElement("option"));

View file

@ -0,0 +1,14 @@
importScripts("/resources/testharness.js");
async_test(function() {
var data = "TEST";
var blob = new Blob([data], {type: "text/plain"});
var reader = new FileReader();
reader.onload = this.step_func_done(function() {
assert_equals(reader.result, data);
});
reader.onerror = this.unreached_func("Unexpected error event");
reader.readAsText(blob);
}, "Create Blob in Worker");
done();

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Blob slice overflow</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://w3c.github.io/FileAPI/#dfn-slice">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var text = '';
for (var i = 0; i < 2000; ++i) {
text += 'A';
}
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(-1, 2000);
assert_equals(sliceBlob.size, 2000-(2000-1), "Bolb slice size");
}, "slice start is negative, relativeStart will be max((size + start), 0)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(2001, 2000);
assert_equals(sliceBlob.size, 0, "Bolb slice size");
}, "slice start is greater than blob size, relativeStart will be min(start, size)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(1998, -1);
assert_equals(sliceBlob.size, (2000-1)-1998, "Bolb slice size");
}, "slice end is negative, relativeEnd will be max((size + end), 0)");
test(function() {
var blob = new Blob([text]);
var sliceBlob = blob.slice(1998, 2999);
assert_equals(sliceBlob.size, 2000-1998, "Bolb slice size");
}, "slice end is greater than blob size, relativeEnd will be min(end, size)");
</script>

View file

@ -0,0 +1,15 @@
importScripts("/resources/testharness.js");
async_test(function() {
var file = new File(["bits"], "dummy", { 'type': 'text/plain', lastModified: 42 });
var reader = new FileReader();
reader.onload = this.step_func_done(function() {
assert_equals(file.name, "dummy", "file name");
assert_equals(reader.result, "bits", "file content");
assert_equals(file.lastModified, 42, "file lastModified");
});
reader.onerror = this.unreached_func("Unexpected error event");
reader.readAsText(file);
}, "FileReader in Worker");
done();

View file

@ -5,4 +5,3 @@
@zqzhang
@yunxiaoxie
@zhaozihao
@foolip

View file

@ -0,0 +1,33 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test( function() {
var closedRange = IDBKeyRange.bound(5, 20);
assert_true(!!closedRange.includes, "IDBKeyRange has a .includes");
assert_true(closedRange.includes(7), "in range");
assert_false(closedRange.includes(1), "below range");
assert_false(closedRange.includes(42), "above range");
assert_true(closedRange.includes(5) && closedRange.includes(20),
"boundary points");
assert_throws("DataError", function() { closedRange.includes({}) },
"invalid key");
}, "IDBKeyRange.includes() with a closed range");
test( function() {
var openRange = IDBKeyRange.bound(5, 20, true, true);
assert_false(openRange.includes(5) || openRange.includes(20),
"boundary points");
}, "IDBKeyRange.includes() with an open range");
test( function() {
var range = IDBKeyRange.only(42);
assert_true(range.includes(42), "in range");
assert_false(range.includes(1), "below range");
assert_false(range.includes(9000), "above range");
}, "IDBKeyRange.includes() with an only range");
</script>

View file

@ -137,14 +137,6 @@ they will be under `html/browsers/history/the-history-interface/`.
Various resources that tests depend on are in `common`, `images`, and
`fonts`.
If you're looking at a section of the specification and can't figure
out where the directory is for it in the tree, just run:
```
node tools/scripts/id2path.js your-id
```
Branches
========

View file

@ -9,21 +9,6 @@
</head>
<body>
<div id="log"></div>
<script>
var test = async_test()
test.step(function() {
var client = new XMLHttpRequest()
client.open("GET", "...")
client.onreadystatechange = function() {
test.step(function() {
assert_unreached()
})
}
client.abort()
assert_equals(client.readyState, 0)
assert_throws("InvalidStateError", function() { client.send("test") }, "calling send() after abort()")
})
test.done()
</script>
<script src="abort-during-open.js"></script>
</body>
</html>

View file

@ -0,0 +1,14 @@
var test = async_test()
test.step(function() {
var client = new XMLHttpRequest()
client.open("GET", "...")
client.onreadystatechange = function() {
test.step(function() {
assert_unreached()
})
}
client.abort()
assert_equals(client.readyState, 0)
assert_throws("InvalidStateError", function() { client.send("test") }, "calling send() after abort()")
})
test.done()

View file

@ -0,0 +1,3 @@
importScripts("/resources/testharness.js");
importScripts("abort-during-open.js");
done();

View file

@ -0,0 +1,20 @@
import imp
import os
def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass');
response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir),
"XMLHttpRequest",
"resources",
"authentication.py"))
if request.method == "OPTIONS":
return ""
else:
return auth.main(request, response)

View file

@ -0,0 +1,20 @@
import imp
import os
def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow-Headers', 'x-user, x-pass');
response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir),
"XMLHttpRequest",
"resources",
"authentication.py"))
if request.method == "OPTIONS":
return ""
else:
return auth.main(request, response)

View file

@ -0,0 +1,10 @@
import imp
import os
here = os.path.split(os.path.abspath(__file__))[0]
def main(request, response):
auth = imp.load_source("", os.path.join(here,
"..",
"authentication.py"))
return auth.main(request, response)

View file

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader() and open() arguments (asserts header wins)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. -->
<link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
</head>
<body>
<div id="log"></div>
<script>
var test = async_test()
test.step(function() {
var client = new XMLHttpRequest(),
urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
user = token()
client.open("GET", location.protocol+'//'+urlstart + "resources/auth9/auth.py", false, 'open-' + user, 'open-pass')
client.setRequestHeader("x-user", user)
client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass"))
client.onreadystatechange = function () {
if (client.readyState < 4) {return}
test.step( function () {
assert_equals(client.responseText, user + '\npass')
assert_equals(client.status, 200)
assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
test.done()
})
}
client.send(null)
})
</script>
</body>
</html>

View file

@ -0,0 +1,61 @@
<!doctype html>
<html>
<head>
<title>XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() but not setting withCredentials (expects to succeed)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. -->
<link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
</head>
<body>
<div id="log"></div>
<script>
function doTest(desc, pathsuffix, conditionsFunc, errorFunc, endFunc) {
var test = async_test(desc)
test.step(function() {
var client = new XMLHttpRequest(),
urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
user = token()
client.open("GET", location.protocol + "//www1." + urlstart + "resources/" + pathsuffix, false)
client.setRequestHeader("x-user", user)
client.setRequestHeader("x-pass", 'pass')
client.setRequestHeader("Authorization", "Basic " + btoa(user + ":pass"))
client.onerror = test.step_func(errorFunc)
client.onreadystatechange = test.step_func(function () {
if(client.readyState < 4) {return}
conditionsFunc(client, test, user)
})
if(endFunc) {
client.onloadend = test.step_func(endFunc)
}
client.send(null)
})
}
doTest("CORS request with setRequestHeader auth to URL accepting Authorization header", "auth7/corsenabled.py", function (client, test, user) {
assert_true(client.responseText == (user + "\npass"), "responseText should contain the right user and password")
assert_equals(client.status, 200)
assert_equals(client.getResponseHeader("x-challenge"), "DID-NOT")
test.done()
}, function(){
assert_unreached("Cross-domain request is permitted and should not cause an error")
this.done()
})
var errorFired = false;
doTest("CORS request with setRequestHeader auth to URL NOT accepting Authorization header", "auth8/corsenabled-no-authorize.py", function (client, test, user) {
assert_equals(client.responseText, '')
assert_equals(client.status, 0)
}, function(e){
errorFired = true
assert_equals(e.type, 'error', 'Error event fires when Authorize is a user-set header but not allowed by the CORS endpoint')
}, function() {
assert_true(errorFired, 'The error event should fire')
this.done()
})
</script>
</body>
</html>

View file

@ -8,14 +8,6 @@
</head>
<body>
<div id="log"></div>
<script>
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/well-formed.xml")
client.send(null)
assert_throws("InvalidStateError", function() { client.send(null) })
client.abort()
})
</script>
<script src="send-send.js"></script>
</body>
</html>

View file

@ -0,0 +1,7 @@
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/well-formed.xml")
client.send(null)
assert_throws("InvalidStateError", function() { client.send(null) })
client.abort()
})

View file

@ -0,0 +1,3 @@
importScripts("/resources/testharness.js");
importScripts("send-send.js");
done();

View file

@ -2384,7 +2384,7 @@
"xhtml/elements/keygen/360-novalid.xhtml": "The \u201clabel\u201d element may contain at most one \u201cbutton\u201d, \u201cinput\u201d, \u201ckeygen\u201d, \u201cmeter\u201d, \u201coutput\u201d, \u201cprogress\u201d, \u201cselect\u201d, or \u201ctextarea\u201d descendant.",
"xhtml/elements/keygen/361-novalid.xhtml": "The element \u201ckeygen\u201d must not appear as a descendant of the \u201ca\u201d element.",
"xhtml/elements/link/001-novalid.xhtml": "Element \u201clink\u201d is missing required attribute \u201chref\u201d.",
"xhtml/elements/menu/001-haswarn.xhtml": "The \u201cmenu\u201d element is not supported by browsers yet. It would probably be better to wait for implementations.",
"xhtml/elements/menu/001-haswarn.xhtml": "The \u201cmenu\u201d element is not supported in all browsers. Please be sure to test, and consider using a polyfill.",
"xhtml/elements/menu/001-novalid.xhtml": "The \u201ccontextmenu\u201d attribute must refer to a \u201cmenu\u201d element.",
"xhtml/elements/meter/010-novalid.xhtml": "The value of the \u201cmin\u201d attribute must be less than or equal to the value of the \u201cvalue\u201d attribute.",
"xhtml/elements/meter/011-novalid.xhtml": "Element \u201cmeter\u201d is missing required attribute \u201cvalue\u201d.",

View file

@ -224,33 +224,25 @@ information in one of two ways:
In order for the latter to work, a file must either have a name of the
form `{name}.sub.{ext}` e.g. `example-test.sub.html` or be referenced
through a URL containing `pipe=sub` in the query string
e.g. `example-test.html?pipe=sub`. The substitution syntax uses {% raw %} `{{
}}` {% endraw %} to delimit items for substitution. For example to substitute in
e.g. `example-test.html?pipe=sub`. The substitution syntax uses `{{ }}`
to delimit items for substitution. For example to substitute in
the host name on which the tests are running, one would write:
{% raw %}
{{host}}
{% endraw %}
As well as the host, one can get full domains, including subdomains
using the `domains` dictionary. For example:
{% raw %}
{{domains[www]}}
{% endraw %}
would be replaced by the fully qualified domain name of the `www`
subdomain. Ports are also available on a per-protocol basis e.g.
{% raw %}
{{ports[ws][0]}}
{% endraw %}
is replaced with the first (and only) websockets port, whilst
{% raw %}
{{ports[http][1]}}
{% endraw %}
is replaced with the second HTTP port.
@ -258,9 +250,7 @@ The request URL itself can be used as part of the substitution using
the `location` dictionary, which has entries matching the
`window.location` API. For example
{% raw %}
{{location[host]}}
{% endraw %}
is replaced by `hostname:port` for the current request.

View file

@ -1,4 +1,5 @@
@ayg
@foolip
@jdm
@Ms2ger
@plehegar

View file

@ -282,6 +282,7 @@ var encodingMap = {
],
"shift_jis": [
"csshiftjis",
"ms932",
"ms_kanji",
"shift-jis",
"shift_jis",

View file

@ -33,11 +33,23 @@ function testAlias(arg, iface) {
"isTrusted should be initialized to false");
}, "createEvent('" + arg + "') should be initialized correctly.");
}
aliases.forEach(function(alias) {
testAlias(alias[0], alias[1]);
testAlias(alias[0].toLowerCase(), alias[1]);
testAlias(alias[0].toUpperCase(), alias[1]);
});
for (var alias in aliases) {
var iface = aliases[alias];
testAlias(alias, iface);
testAlias(alias.toLowerCase(), iface);
testAlias(alias.toUpperCase(), iface);
if (!alias.endsWith("s")) {
var plural = alias + "s";
if (!(plural in aliases)) {
test(function () {
assert_throws("NOT_SUPPORTED_ERR", function () {
var evt = document.createEvent(plural);
});
}, 'Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "' + plural + '"');
}
}
}
test(function() {
assert_throws("NOT_SUPPORTED_ERR", function() {
@ -61,11 +73,73 @@ This list is not exhaustive.
*/
var someNonCreateableEvents = [
"AnimationEvent",
"AnimationPlayerEvent",
"ApplicationCacheErrorEvent",
"AudioProcessingEvent",
"AutocompleteErrorEvent",
"BeforeInstallPromptEvent",
"BeforeUnloadEvent",
"BlobEvent",
"ClipboardEvent",
"CloseEvent",
"CompositionEvent",
"DeviceLightEvent",
"DeviceMotionEvent",
"DeviceOrientationEvent",
"DragEvent",
"ErrorEvent",
"ExtendableEvent",
"ExtendableMessageEvent",
"FetchEvent",
"FocusEvent",
"FontFaceSetLoadEvent",
"GamepadEvent",
"GeofencingEvent",
"HashChangeEvent",
"IDBVersionChangeEvent",
"InstallEvent",
"KeyEvent",
"MIDIConnectionEvent",
"MIDIMessageEvent",
"MediaEncryptedEvent",
"MediaKeyEvent",
"MediaKeyMessageEvent",
"MediaQueryListEvent",
"MediaStreamEvent",
"MediaStreamTrackEvent",
"MutationEvent",
"NotificationEvent",
"OfflineAudioCompletionEvent",
"OrientationEvent",
"PageTransitionEvent",
"PointerEvent",
"PopStateEvent",
"PresentationConnectionAvailableEvent",
"PresentationConnectionCloseEvent",
"ProgressEvent",
"PromiseRejectionEvent",
"PushEvent",
"RTCDTMFToneChangeEvent",
"RTCDataChannelEvent",
"RTCIceCandidateEvent",
"RelatedEvent",
"ResourceProgressEvent",
"SVGEvent",
"SVGZoomEvent",
"SecurityPolicyViolationEvent",
"ServicePortConnectEvent",
"ServiceWorkerMessageEvent",
"SpeechRecognitionError",
"SpeechRecognitionEvent",
"SpeechSynthesisEvent",
"StorageEvent",
"SyncEvent",
"TextEvent",
"TrackEvent",
"TransitionEvent",
"WebGLContextEvent",
"WebKitAnimationEvent",
"WebKitTransitionEvent",
"WheelEvent"
];
someNonCreateableEvents.forEach(function (eventInterface) {

View file

@ -1,14 +1,13 @@
var aliases = [
["CustomEvent", "CustomEvent"],
["Event", "Event"],
["Events", "Event"],
["HTMLEvents", "Event"],
["KeyboardEvent", "KeyboardEvent"],
["KeyEvents", "KeyboardEvent"],
["MessageEvent", "MessageEvent"],
["MouseEvent", "MouseEvent"],
["MouseEvents", "MouseEvent"],
["TouchEvent", "TouchEvent"],
["UIEvent", "UIEvent"],
["UIEvents", "UIEvent"]
];
var aliases = {
"CustomEvent": "CustomEvent",
"Event": "Event",
"Events": "Event",
"HTMLEvents": "Event",
"KeyboardEvent": "KeyboardEvent",
"MessageEvent": "MessageEvent",
"MouseEvent": "MouseEvent",
"MouseEvents": "MouseEvent",
"TouchEvent": "TouchEvent",
"UIEvent": "UIEvent",
"UIEvents": "UIEvent"
};

View file

@ -6,6 +6,7 @@ function attr_is(attr, v, ln, ns, p, n) {
assert_equals(attr.namespaceURI, ns)
assert_equals(attr.prefix, p)
assert_equals(attr.name, n)
assert_equals(attr.nodeName, n);
assert_equals(attr.specified, true)
}

View file

@ -1,2 +1,3 @@
@foolip
@inexorabletash
@sideshowbarker

View file

@ -419,6 +419,7 @@ var encodings_table =
{
"labels": [
"csshiftjis",
"ms932",
"ms_kanji",
"shift-jis",
"shift_jis",

View file

@ -11,8 +11,6 @@ function streamBody(reader, test, count) {
} else {
test.step(function() {
assert_true(count >= 2, "Retrieve body progressively");
test.done();
return;
});
}
});
@ -20,16 +18,14 @@ function streamBody(reader, test, count) {
//simulate streaming:
//count is large enough to let the UA deliver the body before it is completely retrieved
async_test(function(test) {
fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(resp) {
promise_test(function(test) {
return fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(resp) {
var count = 0;
if (resp.body)
return streamBody(resp.body.getReader(), test, count);
else
test.step(function() {
assert_unreached( "Body does not exist in response");
test.done();
return;
});
});
}, "Stream response's body");

View file

@ -25,7 +25,7 @@
var parameters = [null, 1];
parameters.forEach(function(parameter) {
test(function() {
assert_throws(new TypeError(), () => new Headers(parameter));
assert_throws(new TypeError(), function() { new Headers(parameter) });
}, "Create headers with " + parameter + " should throw");
});

View file

@ -0,0 +1,103 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Request consume empty bodies</title>
<meta name="help" href="https://fetch.spec.whatwg.org/#request">
<meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function checkBodyText(request) {
return request.text().then(function(bodyAsText) {
assert_equals(bodyAsText, "", "Resolved value should be empty");
assert_false(request.bodyUsed);
});
}
function checkBodyBlob(request) {
return request.blob().then(function(bodyAsBlob) {
var promise = new Promise(function(resolve, reject) {
var reader = new FileReader();
reader.onload = function(evt) {
resolve(reader.result)
};
reader.onerror = function() {
reject("Blob's reader failed");
};
reader.readAsText(bodyAsBlob);
});
return promise.then(function(body) {
assert_equals(body, "", "Resolved value should be empty");
assert_false(request.bodyUsed);
});
});
}
function checkBodyArrayBuffer(request) {
return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
assert_false(request.bodyUsed);
});
}
function checkBodyJSON(request) {
return request.json().then(
function(bodyAsJSON) {
assert_unreached("JSON parsing should fail");
},
function() {
assert_false(request.bodyUsed);
});
}
function checkBodyFormData(request) {
return request.formData().then(function(bodyAsFormData) {
assert_true(bodyAsFormData instanceof FormData, "Should receive a FormData");
assert_false(request.bodyUsed);
});
}
function checkRequestWithNoBody(bodyType, checkFunction) {
promise_test(function(test) {
var request = new Request("", {"method": "POST"});
assert_false(request.bodyUsed);
return checkFunction(request);
}, "Consume request's body as " + bodyType);
}
var formData = new FormData();
checkRequestWithNoBody("text", checkBodyText);
checkRequestWithNoBody("blob", checkBodyBlob);
checkRequestWithNoBody("arrayBuffer", checkBodyArrayBuffer);
checkRequestWithNoBody("json", checkBodyJSON);
checkRequestWithNoBody("formData", checkBodyFormData);
function checkRequestWithEmptyBody(bodyType, body, asText) {
promise_test(function(test) {
var request = new Request("", {"method": "POST", "body": body});
assert_false(request.bodyUsed, "bodyUsed is false at init");
if (asText) {
return request.text().then(function(bodyAsString) {
assert_equals(bodyAsString.length, 0, "Resolved value should be empty");
assert_true(request.bodyUsed, "bodyUsed is true after being consumed");
});
}
return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
assert_true(request.bodyUsed, "bodyUsed is true after being consumed");
});
}, "Consume empty " + bodyType + " request body as " + (asText ? "text" : "arrayBuffer"));
}
// FIXME: Add BufferSource, FormData and URLSearchParams.
checkRequestWithEmptyBody("blob", new Blob([], { "type" : "text/plain" }), false);
checkRequestWithEmptyBody("text", "", false);
checkRequestWithEmptyBody("blob", new Blob([], { "type" : "text/plain" }), true);
checkRequestWithEmptyBody("text", "", true);
</script>
</body>
</html>

View file

@ -8,6 +8,7 @@
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
</head>
<body>
<script>
@ -37,19 +38,9 @@
});
}
<!-- Taken from https://developers.google.com -->
function str2ab(str) {
var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
var bufView = new Uint16Array(buf);
for (var i=0, strLen=str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
function checkBodyArrayBuffer(request, expectedBody) {
return request.arrayBuffer().then( function(bodyAsArrayBuffer) {
assert_array_equals(bodyAsArrayBuffer, str2ab(expectedBody), "Retrieve and verify request's body");
return request.arrayBuffer().then(function(bodyAsArrayBuffer) {
validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify request's body");
assert_true(request.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
});
}
@ -79,12 +70,28 @@
var formData = new FormData();
formData.append("name", "value")
checkRequestBody("This is request's body", "text", checkBodyText);
checkRequestBody("This is request's body", "blob", checkBodyBlob);
checkRequestBody("This is request's body", "arrayBuffer", checkBodyArrayBuffer);
checkRequestBody(JSON.stringify("This is request's body"), "json", checkBodyJSON);
var textData = JSON.stringify("This is response's body");
var blob = new Blob([textData], { "type" : "text/plain" });
checkRequestBody(textData, "text", checkBodyText);
checkRequestBody(textData, "blob", checkBodyBlob);
checkRequestBody(textData, "arrayBuffer", checkBodyArrayBuffer);
checkRequestBody(textData, "json", checkBodyJSON);
checkRequestBody(formData, "formData", checkBodyFormData);
function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {
promise_test(function(test) {
var response = new Response(blobBody);
assert_false(response.bodyUsed, "bodyUsed is false at init");
return checkFunction(response, blobData);
}, "Consume blob response's body as " + bodyType);
}
checkBlobResponseBody(blob, textData, "blob", checkBodyBlob);
checkBlobResponseBody(blob, textData, "text", checkBodyText);
checkBlobResponseBody(blob, textData, "json", checkBodyJSON);
checkBlobResponseBody(blob, textData, "arrayBuffer", checkBodyArrayBuffer);
var goodJSONValues = ["null", "1", "true", "\"string\""];
goodJSONValues.forEach(function(value) {
promise_test(function(test) {

View file

@ -23,18 +23,23 @@
}
}, "Initialize Request with headers values");
function makeRequestInit(body, method) {
return {"method": method, "body": body};
}
function checkRequestInit(body, bodyType, expectedTextBody) {
promise_test(function(test) {
var request = new Request("", {"method": "POST", "body": body});
assert_throws(new TypeError(),
function() { new Request("", {"method": "GET", "body": body}); }
);
assert_throws(new TypeError(),
function() { new Request("", {"method": "HEAD", "body": body}); }
);
var request = new Request("", makeRequestInit(body, "POST"));
if (body) {
assert_throws(new TypeError(),
function() { new Request("", makeRequestInit(body, "GET")); }
);
} else {
new Request("", makeRequestInit(body, "GET")); // should not throw
}
var reqHeaders = request.headers;
var mime = reqHeaders.get("Content-Type");
assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
assert_true(!body || (mime && mime.search(bodyType) > -1), "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
return request.text().then(function(bodyAsText) {
//not equals: cannot guess formData exact value
assert_true( bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify request body");
@ -47,6 +52,8 @@
formaData.append("name", "value");
var usvString = "This is a USVString"
checkRequestInit(undefined, undefined, "");
checkRequestInit(null, null, "");
checkRequestInit(blob, "application/octet-binary", "This is a blob");
checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");

View file

@ -44,25 +44,31 @@ function checkRequest(request, ExpectedValuesDict) {
}
}
//check reader's text content in an asyncronous test
function readTextStream(reader, asyncTest, expectedValue, retrievedText) {
if (!retrievedText)
retrievedText = "";
reader.read().then(function(data) {
function stringToArray(str) {
var array = new Uint8Array(str.length);
for (var i=0, strLen = str.length; i < strLen; i++)
array[i] = str.charCodeAt(i);
return array;
}
function validateBufferFromString(buffer, expectedValue, message)
{
return assert_array_equals(new Uint8Array(buffer), stringToArray(expectedValue), message);
}
function validateStreamFromString(reader, expectedValue, retrievedArrayBuffer) {
return reader.read().then(function(data) {
if (!data.done) {
var decoder = new TextDecoder();
retrievedText += decoder.decode(data.value);
readTextStream(reader, asyncTest, expectedValue, retrievedText);
return;
var newBuffer;
if (retrievedArrayBuffer) {
newBuffer = new ArrayBuffer(data.value.length + retrievedArrayBuffer.length);
newBuffer.set(retrievedArrayBuffer, 0);
newBuffer.set(data.value, retrievedArrayBuffer.length);
} else {
newBuffer = data.value;
}
return validateStreamFromString(reader, expectedValue, newBuffer);
}
asyncTest.step(function() {
assert_equals(retrievedText, expectedValue, "Retrieve and verify stream");
asyncTest.done();
});
}).catch(function(e) {
asyncTest.step(function() {
assert_unreached("Cannot read stream " + e);
asyncTest.done();
});
validateBufferFromString(retrievedArrayBuffer, expectedValue, "Retrieve and verify stream");
});
}

View file

@ -45,12 +45,12 @@
"Expect response.headers has name:value header");
}, "Check Response's clone has the expected attribute values");
async_test(function(test) {
readTextStream(response.body.getReader(), test, body);
promise_test(function(test) {
return validateStreamFromString(response.body.getReader(), body);
}, "Check orginal response's body after cloning");
async_test(function(test) {
readTextStream(clonedResponse.body.getReader(), test, body);
promise_test(function(test) {
return validateStreamFromString(clonedResponse.body.getReader(), body);
}, "Check cloned response's body");
promise_test(function(test) {
@ -63,4 +63,4 @@
}, "Cannot clone a disturbed response");
</script>
</body>
</html>
</html>

View file

@ -0,0 +1,103 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Response consume empty bodies</title>
<meta name="help" href="https://fetch.spec.whatwg.org/#response">
<meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin">
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function checkBodyText(response) {
return response.text().then(function(bodyAsText) {
assert_equals(bodyAsText, "", "Resolved value should be empty");
assert_false(response.bodyUsed);
});
}
function checkBodyBlob(response) {
return response.blob().then(function(bodyAsBlob) {
var promise = new Promise(function(resolve, reject) {
var reader = new FileReader();
reader.onload = function(evt) {
resolve(reader.result)
};
reader.onerror = function() {
reject("Blob's reader failed");
};
reader.readAsText(bodyAsBlob);
});
return promise.then(function(body) {
assert_equals(body, "", "Resolved value should be empty");
assert_false(response.bodyUsed);
});
});
}
function checkBodyArrayBuffer(response) {
return response.arrayBuffer().then(function(bodyAsArrayBuffer) {
assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
assert_false(response.bodyUsed);
});
}
function checkBodyJSON(response) {
return response.json().then(
function(bodyAsJSON) {
assert_unreached("JSON parsing should fail");
},
function() {
assert_false(response.bodyUsed);
});
}
function checkBodyFormData(response) {
return response.formData().then(function(bodyAsFormData) {
assert_true(bodyAsFormData instanceof FormData, "Should receive a FormData");
assert_false(response.bodyUsed);
});
}
function checkResponseWithNoBody(bodyType, checkFunction) {
promise_test(function(test) {
var response = new Response();
assert_false(response.bodyUsed);
return checkFunction(response);
}, "Consume response's body as " + bodyType);
}
var formData = new FormData();
checkResponseWithNoBody("text", checkBodyText);
checkResponseWithNoBody("blob", checkBodyBlob);
checkResponseWithNoBody("arrayBuffer", checkBodyArrayBuffer);
checkResponseWithNoBody("json", checkBodyJSON);
checkResponseWithNoBody("formData", checkBodyFormData);
function checkResponseWithEmptyBody(bodyType, body, asText) {
promise_test(function(test) {
var response = new Response(body);
assert_false(response.bodyUsed, "bodyUsed is false at init");
if (asText) {
return response.text().then(function(bodyAsString) {
assert_equals(bodyAsString.length, 0, "Resolved value should be empty");
assert_true(response.bodyUsed, "bodyUsed is true after being consumed");
});
}
return response.arrayBuffer().then(function(bodyAsArrayBuffer) {
assert_equals(bodyAsArrayBuffer.byteLength, 0, "Resolved value should be empty");
assert_true(response.bodyUsed, "bodyUsed is true after being consumed");
});
}, "Consume empty " + bodyType + " response body as " + (asText ? "text" : "arrayBuffer"));
}
// FIXME: Add BufferSource, FormData and URLSearchParams.
checkResponseWithEmptyBody("blob", new Blob([], { "type" : "text/plain" }), false);
checkResponseWithEmptyBody("text", "", false);
checkResponseWithEmptyBody("blob", new Blob([], { "type" : "text/plain" }), true);
checkResponseWithEmptyBody("text", "", true);
</script>
</body>
</html>

View file

@ -8,6 +8,7 @@
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
</head>
<body>
<script>
@ -39,16 +40,14 @@
function checkBodyArrayBuffer(response, expectedBody) {
return response.arrayBuffer().then( function(bodyAsArrayBuffer) {
var decoder = new TextDecoder("utf-8");
var strBody = decoder.decode(bodyAsArrayBuffer);
assert_equals(strBody, expectedBody, "Retrieve and verify response's body");
validateBufferFromString(bodyAsArrayBuffer, expectedBody, "Retrieve and verify response's body");
assert_true(response.bodyUsed, "body as arrayBuffer: bodyUsed turned true");
});
}
function checkBodyJson(response, expectedBody) {
return response.json().then(function(bodyAsJson) {
var strBody = JSON.stringify(bodyAsJson)
function checkBodyJSON(response, expectedBody) {
return response.json().then(function(bodyAsJSON) {
var strBody = JSON.stringify(bodyAsJSON)
assert_equals(strBody, expectedBody, "Retrieve and verify response's body");
assert_true(response.bodyUsed, "body as json: bodyUsed turned true");
});
@ -70,12 +69,29 @@
}
var formData = new FormData();
formData.append("name", "value")
checkResponseBody("This is response's body", "text", checkBodyText);
checkResponseBody("This is response's body", "blob", checkBodyBlob);
checkResponseBody("This is response's body", "arrayBuffer", checkBodyArrayBuffer);
checkResponseBody(JSON.stringify("This is response's body"), "json", checkBodyJson);
formData.append("name", "value");
var textData = JSON.stringify("This is response's body");
var blob = new Blob([textData], { "type" : "text/plain" });
checkResponseBody(textData, "text", checkBodyText);
checkResponseBody(textData, "blob", checkBodyBlob);
checkResponseBody(textData, "arrayBuffer", checkBodyArrayBuffer);
checkResponseBody(textData, "json", checkBodyJSON);
checkResponseBody(formData, "formData", checkBodyFormData);
function checkBlobResponseBody(blobBody, blobData, bodyType, checkFunction) {
promise_test(function(test) {
var response = new Response(blobBody);
assert_false(response.bodyUsed, "bodyUsed is false at init");
return checkFunction(response, blobData);
}, "Consume blob response's body as " + bodyType);
}
checkBlobResponseBody(blob, textData, "blob", checkBodyBlob);
checkBlobResponseBody(blob, textData, "text", checkBodyText);
checkBlobResponseBody(blob, textData, "json", checkBodyJSON);
checkBlobResponseBody(blob, textData, "arrayBuffer", checkBodyArrayBuffer);
</script>
</body>
</html>

View file

@ -52,10 +52,10 @@
checkResponseInit(urlSearchParams, "application/x-www-form-urlencoded;charset=UTF-8", "name=value");
checkResponseInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
async_test(function(test) {
promise_test(function(test) {
var body = "This is response body";
var response = new Response(body);
readTextStream(response.body.getReader(), test, body);
return validateStreamFromString(response.body.getReader(), body);
}, "Read Response's body as readableStream");
</script>
</body>

View file

@ -1,2 +1 @@
@plehegar
@foolip

View file

@ -1,2 +1,3 @@
@foolip
@haoxli
@zqzhang

View file

@ -1,4 +1,5 @@
@Ms2ger
@foolip
@gsnedders
@jdm
@jgraham

View file

@ -18,7 +18,7 @@
test(function () {
var href = location.href;
location.assign("http://:");
assert_throws('SYNTAX_ERR', function() { location.assign("http://:"); });
assert_equals(location.href, href);
}, "URL that fails to parse");
</script>

View file

@ -0,0 +1,38 @@
<!doctype html>
<meta charset=utf-8>
<title>Document#defaultView</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function() {
assert_equals(document.defaultView, window);
}, "Document in a browsing context");
test(function() {
var d = new Document();
assert_equals(d.defaultView, null);
}, "Document created with the Document constructor");
test(function() {
var d = document.implementation.createDocument(null, null);
assert_equals(d.defaultView, null);
}, "Document created with createDocument");
test(function() {
var d = document.implementation.createHTMLDocument();
assert_equals(d.defaultView, null);
}, "Document created with createHTMLDocument");
test(function() {
var parser = new DOMParser();
var d = parser.parseFromString("<foo\/\>", "application/xml");
assert_equals(d.defaultView, null);
}, "Document created with XML DOMParser");
test(function() {
var parser = new DOMParser();
var d = parser.parseFromString("bar", "text/html");
assert_equals(d.defaultView, null);
}, "Document created with HTML DOMParser");
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<title>Window#document</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
async_test(function() {
var URL = "/common/blank.html";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var initialWindow = iframe.contentWindow;
var initialDocument = initialWindow.document;
assert_equals(initialDocument.URL, "about:blank");
iframe.src = URL;
iframe.onload = this.step_func_done(function() {
assert_equals(iframe.contentWindow, initialWindow);
assert_equals(initialDocument.URL, "about:blank");
var loadedDocument = initialWindow.document;
assert_equals(loadedDocument.URL, location.href.replace(location.pathname, URL));
assert_not_equals(initialDocument, loadedDocument);
});
}, "Document in a browsing context");
</script>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>window[@@iterator]</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_false(Symbol.iterator in window);
});
</script>

View file

@ -0,0 +1,55 @@
<!doctype html>
<link rel="match" href="table-cell-width-ref.html">
<style>
body {
margin: 0;
}
table {
width: 400px;
border-collapse: collapse;
}
th {
font-weight: normal;
text-align: left;
}
td, th {
padding: 0;
}
td:first-child, th:first-child {
background-color: red;
}
</style>
<!-- width=0 should be treated as 'auto' -->
<table>
<tr>
<th width=0>a</th>
<th>a</th>
</tr>
</table>
<table>
<tr>
<td width=0>a</td>
<td>a</td>
</tr>
</table>
<!-- test valid width attribute value-->
<table>
<tr>
<th width=100>a</th>
<th>a</th>
</tr>
</table>
<table>
<tr>
<td width=100>a</td>
<td>a</td>
</tr>
</table>

View file

@ -0,0 +1,31 @@
<!doctype html>
<link rel="match" href="table-width-ref.html">
<style>
table {
border-collapse: collapse;
}
td {
padding: 0;
}
</style>
<!-- width=0 should be treated as 'auto' -->
<table width=0>
<tr>
<td>
a b
</td>
</tr>
</table>
<hr>
<table width=1>
<tr>
<td>
a b
</td>
</tr>
</table>

View file

@ -24,21 +24,21 @@ var testElements = [
},
{
tag: "input",
types: ["datetime"],
types: ["datetime-local"],
testData: [
{conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"},
{conditions: {value: "2000-01-01T12:00:00Z"}, expected: false, name: "[target] The value attribute is a valid date and time string"},
{conditions: {value: "abc"}, expected: true, name: "[target] The value attribute cannot convert to a valid normalized forced-UTC global date and time string"}
{conditions: {value: "2000-01-01T12:00:00"}, expected: false, name: "[target] The value attribute is a valid date and time string"},
{conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid normalized forced-UTC global date and time string"}
]
},
{
tag: "input",
types: ["color"],
testData: [
{conditions: {value: ""}, expected: true, name: "[target] The value attribute is empty"},
{conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"},
{conditions: {value: "#000000"}, expected: false, name: "[target] The value attribute is a valid sample color"},
{conditions: {value: "#FFFFFF"}, expected: false, name: "[target] The value attribute is not a valid lowercase sample color"},
{conditions: {value: "abc"}, expected: true, name: "[target] The value attribute cannot convert to a valid sample color"}
{conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid sample color"}
]
},
];

View file

@ -1,42 +0,0 @@
<!DOCTYPE HTML>
<title>The selection interface members</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var valid = ["text", "search", "url", "tel", "password"];
var invalid = ["hidden", "datetime", "date", "month", "week", "datetime-local",
"number", "range", "color", "checkbox", "radio", "button",
"file", "email", "submit", "image", "reset"];
valid.forEach(function(aType) {
test(function() {
var input = document.createElement("input");
input.type = aType;
assert_equals(input.type, aType, "Input type unsupported")
input.select();
var a = input.selectionStart;
input.selectionStart = 0;
a = input.selectionEnd;
input.selectionEnd = 0;
input.setSelectionRange(0, 0);
}, "Selection attributes should apply to type " + aType)
})
invalid.forEach(function(aType) {
test(function() {
var input = document.createElement("input");
input.type = aType;
assert_equals(input.type, aType, "Input type unsupported")
assert_throws("INVALID_STATE_ERR", function() { input.select(); }, "Should throw with type " + aType);
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionStart; });
assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0; });
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd; });
assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; });
assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0, 0); });
}, "Selection attributes should not apply to type " + aType)
})
});
</script>

View file

@ -0,0 +1,131 @@
<!DOCTYPE HTML>
<title>Input element programmatic selection support</title>
<link rel="author" title="yaycmyk" href="mailto:evan@yaycmyk.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-select">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
/* all textual, non-hidden inputs support .select() */
test(function() {
var valid = [
"text",
"search",
"url",
"tel",
"email",
"password",
"date",
"month",
"week",
"time",
"datetime-local",
"number",
"color",
"file",
];
var invalid = [
"hidden",
"range",
"checkbox",
"radio",
"submit",
"image",
"reset",
"button"
];
valid.forEach(function(type) {
test(function() {
var input = document.createElement("input");
var a;
input.type = type;
assert_equals(input.type, type, "the given input type is not supported");
input.select();
}, "input type " + type + " should support the select() method");
});
invalid.forEach(function(type) {
test(function() {
var input = document.createElement("input");
input.type = type;
assert_equals(input.type, type, "the given input type is not supported");
assert_throws("INVALID_STATE_ERR", function() { input.select(); });
}, "input type " + type + " should not support the select() method");
});
});
/* only certain input types are allowed to have a variable-length selection */
test(function() {
var valid = [
"text",
"search",
"url",
"tel",
"password"
];
var invalid = [
"hidden",
"email",
"date",
"month",
"week",
"time",
"datetime-local",
"number",
"range",
"color",
"checkbox",
"radio",
"file",
"submit",
"image",
"reset",
"button"
];
valid.forEach(function(type) {
test(function() {
var input = document.createElement("input");
var a;
input.type = type;
assert_equals(input.type, type, "the given input type is not supported");
a = input.selectionStart;
input.selectionStart = 0;
a = input.selectionEnd;
input.selectionEnd = 0;
input.setSelectionRange(0, 0);
input.setRangeText('', 0, 0);
}, "input type " + type + " should support all selection attributes and methods");
});
invalid.forEach(function(type) {
test(function() {
var input = document.createElement("input");
input.type = type;
assert_equals(input.type, type, "the given input type is not supported");
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionStart; });
assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0; });
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd; });
assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; });
assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0, 0); });
assert_throws("INVALID_STATE_ERR", function() { input.setRangeText('', 0, 0); });
}, "input type " + type + " should not support variable-length selections");
});
});
</script>

View file

@ -32,8 +32,11 @@ test(function() {
assert_equals(template.ownerDocument, doc.body.ownerDocument,
'Wrong template node owner document');
assert_equals(template.content.ownerDocument, doc,
'Wrong template content owner document');
var ownerDoc = template.content.ownerDocument;
assert_not_equals(ownerDoc, doc, 'Wrong template content owner document');
assert_not_equals(ownerDoc, document, 'Wrong template content owner document');
assert_equals(ownerDoc.defaultView, null,
'Template content owner document should not have a browsing context');
}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
+ 'to which it will be appended. Test empty template');

View file

@ -22,6 +22,13 @@ function templateIsAChild(element) {
'Template element should be a descendant of the ' + element.tagName + ' element');
}
function templateIsDisallowedAsAChild(element) {
element.innerHTML = '<template>some text</template>';
assert_equals(element.querySelector('template'), null,
'Template element should not be allowed as a descendant of the ' + element.tagName + ' element');
}
function templateIsAnIndirectChild(element) {
element.innerHTML = '<div><template>some text</template></div>';
@ -29,6 +36,13 @@ function templateIsAnIndirectChild(element) {
'Template element should be a descendant of the ' + element.tagName + ' element');
}
function templateIsDisallowedAsAnIndirectChild(element) {
element.innerHTML = '<div><template>some text</template></div>';
assert_equals(element.querySelector('template'), null,
'Template element should not be allowed as indirect descendant of the ' + element.tagName + ' element');
}
function templateIsAnAppendedChild(doc, element) {
var template = doc.createElement('template');
@ -58,13 +72,16 @@ var parameters = [['Template element as a descendant of the BODY element. ' +
['Template element as a descendant of the HEAD element. ' +
'Template element is created by innerHTML',
doc.head],
['Template element as a descendant of the FRAMESET element. ' +
'Template element is created by innerHTML',
frameset]
];
generate_tests(templateIsAChild, parameters,
'Template element as a descendant of the HEAD, BODY and FRAMESET elements');
'Template element as a descendant of the HEAD and BODY elements');
parameters = [['Template element as a descendant of the FRAMESET element. ' +
'Template element is created by innerHTML',
frameset],
];
generate_tests(templateIsDisallowedAsAChild, parameters,
'Template element should be disallowed as a descendant of the FRAMESET elements');
parameters = [['Template element as an indirect descendant of the BODY element. ' +
@ -73,13 +90,17 @@ parameters = [['Template element as an indirect descendant of the BODY element.
['Template element as an indirect descendant of the HEAD element. ' +
'Template element is created by innerHTML',
doc.head],
['Template element as an indirect descendant of the FRAMESET element. ' +
'Template element is created by innerHTML',
frameset]
];
generate_tests(templateIsAnIndirectChild, parameters,
'Template element as an indirect descendant of the HEAD, BODY and FRAMESET elements');
parameters = [['Template element as a descendant of the FRAMESET element. ' +
'Template element is created by innerHTML',
frameset],
];
generate_tests(templateIsDisallowedAsAnIndirectChild, parameters,
'Template element should be disallowed as an indirect descendant of the FRAMESET elements');
parameters = [['Template element as a descendant of the BODY element. ' +

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:focus for autofocus)</title>
<link rel="author" title="Kent Tamura" href="mailto:tkent@chromium.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes">
<link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#autofocusing-a-form-control:-the-autofocus-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
// This test can't be merged to focus.html because element.focus() may affect
// autofocus behavior.
var autofocusTest = async_test(":focus selector should work with an autofocused element.");
var input = document.createElement("input");
input.autofocus = true;
input.addEventListener("focus", function() {
autofocusTest.step(function() {
assert_array_equals(document.querySelectorAll(":focus"), [input])
autofocusTest.done();
});
}, false);
document.body.appendChild(input);
</script>
</body>

View file

@ -11,7 +11,6 @@
<button id=button1 type=submit>button1</button>
<input id=input1>
<input id=input2 disabled>
<input id=input3 autofocus>
<textarea id=textarea1>textarea1</textarea>
<input type=checkbox id=checkbox1 checked>
<input type=radio id=radio1 checked>
@ -20,8 +19,6 @@
<iframe src="focus-iframe.html" id=iframe onload="load()"></iframe>
<script>
testSelector(":focus", ["input3"], "input3 has the attribute autofocus");
document.getElementById("input1").focus(); // set the focus on input1
testSelector(":focus", ["input1"], "input1 has the focus");

View file

@ -3,8 +3,8 @@
<head>
<title>HTML Templates: additions to 'in frameset' insertion mode</title>
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="assert" content="If parser is in 'in frameset' insertion mode and meets frameset end tag then if the stack of open elements has a template element in html scope then this is a parse error; ignore the token">
<link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-head-addition">
<meta name="assert" content="If parser is in 'in frameset' insertion mode then a start tag or an end tag whose name is 'template' is a parsing error">
<link rel="help" href="https://www.w3.org/TR/2015/WD-html51-20151008/syntax.html#parsing-main-inframeset">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/resources/common.js"></script>
@ -18,15 +18,9 @@ testInIFrame('/html/semantics/scripting-1/the-template-element/resources/framese
var doc = context.iframes[0].contentDocument;
var frameset = doc.querySelector('frameset');
assert_equals(frameset.children.length, 1, 'Wrong number of frameset children elements');
assert_equals(frameset.children.length, 0, 'Wrong number of frameset children elements');
var template = frameset.querySelector('template');
assert_equals(template.tagName, 'TEMPLATE', 'FRAMESET should contain template element');
assert_equals(template.content.childNodes.length, 0,
'Template content should be empty');
}, '</frameset> tag should be ignored if there\'s TEMPLATE element in '
+ 'the stack of open elements');
}, '<template> tag should be ignored in "in frameset" insertion mode');
</script>
</body>

View file

@ -66,26 +66,6 @@ test(function () {
test(function () {
var doc = newHTMLDocument();
doc.open();
doc.write('<frameset><template id="tmpl1"><div id="div">DIV</div></template></frameset>');
doc.close();
var template = doc.querySelector('#tmpl1');
var div = template.content.querySelector('#div');
assert_equals(div.ownerDocument, template.content.ownerDocument,
'Wrong ownerDocument of the element in template');
}, 'Test ownerDocument property of the element in a template. '
+ 'Current DOCUMENT has no browsing context. Test template element '
+ 'in the root of the frameset');
test(function () {
var doc = newHTMLDocument();
doc.body.innerHTML = '<template id="tmpl1">'

View file

@ -1,4 +1,5 @@
@bit
@acolwell
@foolip
@shishimaru
@sideshowbarker

View file

@ -1,3 +1,3 @@
@dontcallmedom
@alvestrand
@dontcallmedom
@foolip

View file

@ -1,25 +1,24 @@
<!doctype html>
<html>
<head>
<title>Adding a track to a finished MediaStream</title>
<title>Adding a track to an inactive MediaStream</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrackList-add-void-MediaStreamTrack-track">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-stop-void">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStream-addTrack-void-MediaStreamTrack-track">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-stop-void">
</head>
<body>
<p class="instructions">When prompted, accept to share your audio stream, then
your video stream.</p>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that adding a track to a finished
MediaStream raises an INVALID_STATE_ERR exception.</p>
<p class="instructions">This test checks that adding a track to an inactive
MediaStream is allowed.</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"}]'></script>
<script>
var t = async_test("Tests that an addition to a finished MediaStream raises an exception", {timeout:20000});
var t = async_test("Tests that adding a track to an inactive MediaStream is allowed", {timeout:20000});
t.step(function () {
var audio, video;
@ -33,13 +32,10 @@ t.step(function () {
video = stream;
t.step(function () {
audio.getAudioTracks()[0].stop();
assert_true(audio.ended, "Audio stream is ended after stopping its only audio track");
assert_throws("INVALID_STATE_ERR", function () {
video.addTrack(audio.getAudioTracks()[0]);
}, "Adding a track from a finished stream raises an INVALID_STATE_ERR exception");
assert_throws("INVALID_STATE_ERR", function () {
audio.removeTrack(audio.getAudioTracks()[0]);
}, "Removing a track from a finished stream raises an INVALID_STATE_ERR exception");
assert_false(audio.active, "audio stream is inactive after stopping its only audio track");
assert_true(video.active, "video stream is active");
audio.addTrack(video.getVideoTracks()[0]);
audio.removeTrack(audio.getAudioTracks()[0]);
});
t.done();
}

View file

@ -3,13 +3,12 @@
<head>
<title>MediaStream constructor algorithm</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-MediaStream">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStream-id">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastream">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-ended">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-stop-void">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-clone-MediaStreamTrack">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStream">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStream-id">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediastream">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#event-mediastreamtrack-ended">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-stop-void">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-clone-MediaStreamTrack">
</head>
<body>
<p class="instructions">When prompted, accept to share your video and audio stream.</p>
@ -42,7 +41,7 @@ t.step(function() {
assert_equals(stream3.getTrackById(audioTrack2.id), null, "an ended track doesn't get added via the MediaStream constructor");
assert_equals(stream3.getTrackById(videoTrack.id), videoTrack, "a non-ended track gets added via the MediaStream constructor even if the previous track was ended");
var stream5 = new MediaStream([audioTrack2]);
assert_true(stream5.ended, "a MediaStream created using the MediaStream() constructor whose arguments are lists of MediaStreamTrack objects that are all ended, the MediaStream object MUST be created with its ended attribute set to true");
assert_false(stream5.active, "a MediaStream created using the MediaStream() constructor whose arguments are lists of MediaStreamTrack objects that are all ended, the MediaStream object MUST be created with its active attribute set to false");
t.done();
}), false);
audioTrack2.stop();

View file

@ -1,37 +0,0 @@
<!doctype html>
<html>
<head>
<title>getUserMedia({video:true}) creates a stream with ended set to false</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStream-ended">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-ended">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
</head>
<body>
<p class="instructions">When prompted, accept to share your video stream.</p>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that the MediaStream object returned by
the success callback in getUserMedia has a ended set to false at start, and
triggers "onended" when it is set to true.</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"}]'></script>
<script>
var t = async_test("Tests that a MediaStream handles ended correctly", {timeout:10000});
t.step(function () {
navigator.getUserMedia({video:true}, t.step_func(function (stream) {
assert_true(!stream.ended, "the media stream starts with ended set to false");
stream.addEventListener("ended", t.step_func(function() {
assert_true(stream.ended, "stream.ended now set to true");
t.done();
}), false);
stream.ended = true;
assert_true(!stream.ended, "stream.ended should remain false");
stream.getVideoTracks()[0].stop();
}), function (error) {});
});
</script>
</body>
</html>

View file

@ -3,8 +3,7 @@
<head>
<title>Test that mediastreamtrack are properly ended</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#mediastreamtrack">
</head>
<body>
<p class="instructions">When prompted, accept to share your video and audio
@ -12,7 +11,7 @@ stream, and then revoke that permission.</p>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that the video and audio tracks of
MediaStream object returned by the success callback in getUserMedia are
correctly set into ended state when permission is revoked.</p>
correctly set into inactive state when permission is revoked.</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
@ -29,7 +28,7 @@ t.step(function () {
vidTrack.onended = t.step_func(function () {
assert_equals(vidTrack.readyState, "ended", "Video track has been ended as expected");
assert_equals(audTrack.readyState, "ended", "Audio track has been ended as expected");
assert_true(stream.ended, "MediaStream has been ended as expected");
assert_false(stream.active, "MediaStream has been inactive as expected");
t.done();
});
}), function (error) {}

View file

@ -1,2 +1 @@
@plehegar
@foolip

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -44,4 +44,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -44,4 +44,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -49,4 +49,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -53,4 +53,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -47,4 +47,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -45,4 +45,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -40,4 +40,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -42,4 +42,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -38,4 +38,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -38,4 +38,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -38,4 +38,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -40,4 +40,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -44,4 +44,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -35,4 +35,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -48,4 +48,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -39,4 +39,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -46,4 +46,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -40,4 +40,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -42,4 +42,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -38,4 +38,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -38,4 +38,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -36,4 +36,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -39,4 +39,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -37,4 +37,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<title>Forms</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>
@ -45,4 +45,4 @@
</script>
</body>
</html>
</html>

View file

@ -1,2 +1 @@
@plehegar
@foolip

View file

@ -1,185 +1,50 @@
<!DOCTYPE HTML>
<html>
<!--
Test cases for Touch Events v1 Recommendation
http://www.w3.org/TR/touch-events/
These tests are based on Mozilla-Nokia-Google's single-touch tests.
The primary purpose of the tests in this document is checking that the createTouch and
createTouchList interfaces of the Touch Events APIs are correctly implemented.
Other interactions are covered in other test files.
This document references Test Assertions (abbrev TA below) written by Cathy Chan
http://www.w3.org/2010/webevents/wiki/TestAssertions
-->
<head>
<title>Touch Events createTouch and createTouchList Interface Tests</title>
<meta name="viewport" content="width=device-width">
<title>document.createTouch and document.createTouchList Tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="touch-support.js"></script>
<body>
<div id="target0"></div>
<script>
setup({explicit_done: true});
test(function() {
var testTarget = document.getElementById('target0');
var touch1 = document.createTouch(window, testTarget, 42, 15, 20, 35, 40);
assert_equals(touch1.target, testTarget, "touch.target is target0");
assert_equals(touch1.identifier, 42, "touch.identifier is requested value");
assert_equals(touch1.pageX, 15, "touch.pageX is requested value");
assert_equals(touch1.pageY, 20, "touch.pageY is requested value");
assert_equals(touch1.screenX, 35, "touch.screenX is requested value");
assert_equals(touch1.screenY, 40, "touch.screenY is requested value");
}, "document.createTouch exists and creates a Touch object with requested properties");
// Check a Touch object's atttributes for existence and correct type
// TA: 1.1.2, 1.1.3
function check_Touch_object (t) {
test(function() {
assert_equals(Object.prototype.toString.call(t), "[object Touch]", "touch is of type Touch");
}, "touch point is a Touch object");
[
["long", "identifier"],
["EventTarget", "target"],
["long", "screenX"],
["long", "screenY"],
["long", "clientX"],
["long", "clientY"],
["long", "pageX"],
["long", "pageY"],
].forEach(function(attr) {
var type = attr[0];
var name = attr[1];
test(function() {
var touchList = document.createTouchList();
assert_equals(touchList.length, 0, "touchList.length is 0");
check_TouchList_object(touchList);
}, "document.createTouchList exists and correctly creates a TouchList from zero Touch objects");
// existence check
test(function() {
assert_true(name in t, name + " attribute in Touch object");
}, "Touch." + name + " attribute exists");
test(function() {
var testTarget = document.getElementById('target0');
var touch1 = document.createTouch(window, testTarget, 42, 15, 20, 35, 40);
var touchList = document.createTouchList(touch1);
assert_equals(touchList.length, 1, "touchList.length is 1");
assert_equals(touchList.item(0), touch1, "touchList.item(0) is touch1");
check_TouchList_object(touchList);
}, "document.createTouchList exists and correctly creates a TouchList from a single Touch");
// type check
switch(type) {
case "long":
test(function() {
assert_equals(typeof t[name], "number", name + " attribute of type long");
}, "Touch." + name + " attribute is of type number (long)");
break;
case "EventTarget":
// An event target is some type of Element
test(function() {
assert_true(t[name] instanceof Element, "EventTarget must be an Element.");
}, "Touch." + name + " attribute is of type Element");
break;
default:
break;
}
});
}
// Check a TouchList object's attributes and methods for existence and proper type
// Also make sure all of the members of the list are Touch objects
// TA: 1.2.1, 1.2.2, 1.2.5, 1.2.6
function check_TouchList_object (tl) {
test(function() {
assert_equals(Object.prototype.toString.call(tl), "[object TouchList]", "touch list is of type TouchList");
}, "touch list is a TouchList object");
[
["unsigned long", "length"],
["function", "item"],
].forEach(function(attr) {
var type = attr[0];
var name = attr[1];
// existence check
test(function() {
assert_true(name in tl, name + " attribute in TouchList");
}, "TouchList." + name + " attribute exists");
// type check
switch(type) {
case "unsigned long":
test(function() {
assert_equals(typeof tl[name], "number", name + " attribute of type long");
}, "TouchList." + name + " attribute is of type number (unsigned long)");
break;
case "function":
test(function() {
assert_equals(typeof tl[name], "function", name + " attribute of type function");
}, "TouchList." + name + " attribute is of type function");
break;
default:
break;
}
});
// Each member of tl should be a proper Touch object
for (var i=0; i < tl.length; i++) {
check_Touch_object(tl.item(i));
}
// TouchList.item(x) should return null if x is >= TouchList.length
test(function() {
var t = tl.item(tl.length);
assert_equals(t, null, "TouchList.item(TouchList.length) must return null");
}, "TouchList.item returns null if the index is >= the length of the list");
}
function check_touch_clientXY(touch) {
assert_equals(touch.clientX, touch.pageX - window.pageXOffset, "touch.clientX is touch.pageX - window.pageXOffset.");
assert_equals(touch.clientY, touch.pageY - window.pageYOffset, "touch.clientY is touch.pageY - window.pageYOffset.");
}
function run() {
var target0 = document.getElementById("target0");
var touch1, touch2;
test(function() {
touch1 = document.createTouch(window, target0, 42, 15, 20, 35, 40);
assert_equals(touch1.target, target0, "touch.target is target0");
assert_equals(touch1.identifier, 42, "touch.identifier is requested value");
assert_equals(touch1.pageX, 15, "touch.pageX is requested value");
assert_equals(touch1.pageY, 20, "touch.pageY is requested value");
check_touch_clientXY(touch1);
assert_equals(touch1.screenX, 35, "touch.screenX is requested value");
assert_equals(touch1.screenY, 40, "touch.screenY is requested value");
}, "document.createTouch exists and creates a Touch object with requested properties");
touch2 = document.createTouch(window, target0, 44, 25, 30, 45, 50);
var touchList;
test(function() {
touchList = document.createTouchList();
assert_equals(touchList.length, 0, "touchList.length is 0");
}, "document.createTouchList exists and correctly creates a TouchList from zero Touch objects");
if (touchList)
check_TouchList_object(touchList);
test(function() {
touchList = document.createTouchList(touch1);
assert_equals(touchList.length, 1, "touchList.length is 1");
assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
}, "document.createTouchList exists and correctly creates a TouchList from a single Touch");
if (touchList)
check_TouchList_object(touchList);
test(function() {
touchList = document.createTouchList(touch1, touch2);
assert_equals(touchList.length, 2, "touchList.length is 2");
assert_equals(touchList.item(0), touch1, "touchList.item(0) is input touch1");
assert_equals(touchList.item(1), touch2, "touchList.item(1) is input touch2");
}, "document.createTouchList exists and correctly creates a TouchList from two Touch objects");
if (touchList)
check_TouchList_object(touchList);
target0.innerHTML = "Test complete."
done();
}
test(function() {
var testTarget = document.getElementById('target0');
var touch1 = document.createTouch(window, testTarget, 42, 15, 20, 35, 40);
var touch2 = document.createTouch(window, target0, 44, 25, 30, 45, 50);
var touchList = document.createTouchList(touch1, touch2);
assert_equals(touchList.length, 2, "touchList.length is 2");
assert_equals(touchList.item(0), touch1, "touchList.item(0) is touch1");
assert_equals(touchList.item(1), touch2, "touchList.item(1) is touch2");
check_TouchList_object(touchList);
}, "document.createTouchList exists and correctly creates a TouchList from two Touch objects");
</script>
<style>
div {
margin: 0em;
padding: 2em;
}
#target0 {
background: yellow;
border: 1px solid orange;
}
</style>
</head>
<body onload="run()">
<h1>Touch Events: createTouch and createTouchList tests</h1>
<div id="target0">Please wait for test to complete...</div>
<div id="log"></div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more