mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199127 - Update web-platform-tests to revision 4600b7dbae996754fe52f48bc9c225834f11a686, a=testonly
This commit is contained in:
parent
86f192fbc8
commit
f912ef549c
@ -1049,6 +1049,10 @@
|
||||
"path": "screen-orientation/page-visibility-manual.html",
|
||||
"url": "/screen-orientation/page-visibility-manual.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/dir-manual.html",
|
||||
"url": "/selection/dir-manual.html"
|
||||
},
|
||||
{
|
||||
"path": "svg/import/animate-dom-01-f-manual.svg",
|
||||
"url": "/svg/import/animate-dom-01-f-manual.svg"
|
||||
@ -12143,22 +12147,6 @@
|
||||
"path": "ambient-light/idlharness.html",
|
||||
"url": "/ambient-light/idlharness.html"
|
||||
},
|
||||
{
|
||||
"path": "animation-timing/callback-invoked.html",
|
||||
"url": "/animation-timing/callback-invoked.html"
|
||||
},
|
||||
{
|
||||
"path": "animation-timing/cancel-invoked.html",
|
||||
"url": "/animation-timing/cancel-invoked.html"
|
||||
},
|
||||
{
|
||||
"path": "animation-timing/idlharness.html",
|
||||
"url": "/animation-timing/idlharness.html"
|
||||
},
|
||||
{
|
||||
"path": "animation-timing/same-dispatch-time.html",
|
||||
"url": "/animation-timing/same-dispatch-time.html"
|
||||
},
|
||||
{
|
||||
"path": "battery-status/battery-interface-idlharness.html",
|
||||
"url": "/battery-status/battery-interface-idlharness.html"
|
||||
@ -13011,6 +12999,10 @@
|
||||
"path": "dom/collections/HTMLCollection-empty-name.html",
|
||||
"url": "/dom/collections/HTMLCollection-empty-name.html"
|
||||
},
|
||||
{
|
||||
"path": "dom/collections/HTMLCollection-supported-property-names.html",
|
||||
"url": "/dom/collections/HTMLCollection-supported-property-names.html"
|
||||
},
|
||||
{
|
||||
"path": "dom/events/Event-constants.html",
|
||||
"url": "/dom/events/Event-constants.html"
|
||||
@ -15411,6 +15403,10 @@
|
||||
"path": "html/dom/elements/global-attributes/the-translate-attribute-012.html",
|
||||
"url": "/html/dom/elements/global-attributes/the-translate-attribute-012.html"
|
||||
},
|
||||
{
|
||||
"path": "html/editing/activation/click.html",
|
||||
"url": "/html/editing/activation/click.html"
|
||||
},
|
||||
{
|
||||
"path": "html/editing/dnd/dom/draggable.html",
|
||||
"url": "/html/editing/dnd/dom/draggable.html"
|
||||
@ -17779,6 +17775,26 @@
|
||||
"path": "html/syntax/serializing-html-fragments/outerHTML.html",
|
||||
"url": "/html/syntax/serializing-html-fragments/outerHTML.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/animation-frames/callback-exception.html",
|
||||
"url": "/html/webappapis/animation-frames/callback-exception.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/animation-frames/callback-invoked.html",
|
||||
"url": "/html/webappapis/animation-frames/callback-invoked.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/animation-frames/cancel-invoked.html",
|
||||
"url": "/html/webappapis/animation-frames/cancel-invoked.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/animation-frames/idlharness.html",
|
||||
"url": "/html/webappapis/animation-frames/idlharness.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/animation-frames/same-dispatch-time.html",
|
||||
"url": "/html/webappapis/animation-frames/same-dispatch-time.html"
|
||||
},
|
||||
{
|
||||
"path": "html/webappapis/atob/base64.html",
|
||||
"url": "/html/webappapis/atob/base64.html"
|
||||
@ -18011,6 +18027,10 @@
|
||||
"path": "js/builtins/Object.prototype.freeze.html",
|
||||
"url": "/js/builtins/Object.prototype.freeze.html"
|
||||
},
|
||||
{
|
||||
"path": "js/builtins/Object.prototype.getOwnPropertyNames.html",
|
||||
"url": "/js/builtins/Object.prototype.getOwnPropertyNames.html"
|
||||
},
|
||||
{
|
||||
"path": "js/builtins/Object.prototype.hasOwnProperty-order.html",
|
||||
"url": "/js/builtins/Object.prototype.hasOwnProperty-order.html"
|
||||
@ -24903,10 +24923,6 @@
|
||||
"path": "selection/Document-open.html",
|
||||
"url": "/selection/Document-open.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/addRange.html",
|
||||
"url": "/selection/addRange.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/collapse.html",
|
||||
"url": "/selection/collapse.html"
|
||||
@ -24919,10 +24935,6 @@
|
||||
"path": "selection/deleteFromDocument.html",
|
||||
"url": "/selection/deleteFromDocument.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/dir.manual.html",
|
||||
"url": "/selection/dir.manual.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/extend.html",
|
||||
"url": "/selection/extend.html"
|
||||
@ -25071,10 +25083,6 @@
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html"
|
||||
},
|
||||
{
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html"
|
||||
},
|
||||
{
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html"
|
||||
@ -25091,10 +25099,6 @@
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html"
|
||||
},
|
||||
{
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html"
|
||||
},
|
||||
{
|
||||
"path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html",
|
||||
"url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html"
|
||||
@ -27491,6 +27495,10 @@
|
||||
"path": "workers/semantics/encodings/004.html",
|
||||
"url": "/workers/semantics/encodings/004.html"
|
||||
},
|
||||
{
|
||||
"path": "workers/semantics/encodings/004.worker.js",
|
||||
"url": "/workers/semantics/encodings/004.worker"
|
||||
},
|
||||
{
|
||||
"path": "workers/semantics/interface-objects/001.worker.js",
|
||||
"url": "/workers/semantics/interface-objects/001.worker"
|
||||
@ -28767,6 +28775,11 @@
|
||||
"timeout": "long",
|
||||
"url": "/quirks-mode/hashless-hex-color.html"
|
||||
},
|
||||
{
|
||||
"path": "selection/addRange.html",
|
||||
"timeout": "long",
|
||||
"url": "/selection/addRange.html"
|
||||
},
|
||||
{
|
||||
"path": "service-workers/cache-storage/common.https.html",
|
||||
"timeout": "long",
|
||||
@ -29034,17 +29047,7 @@
|
||||
},
|
||||
"local_changes": {
|
||||
"deleted": [],
|
||||
"items": {
|
||||
"testharness": {
|
||||
"selection/addRange.html": [
|
||||
{
|
||||
"path": "selection/addRange.html",
|
||||
"timeout": "long",
|
||||
"url": "/selection/addRange.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"items": {},
|
||||
"reftest_nodes": {}
|
||||
},
|
||||
"reftest_nodes": {
|
||||
@ -34449,7 +34452,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"rev": "b54dddfdcc4761d2f8a892fd783d60353949992d",
|
||||
"rev": "4600b7dbae996754fe52f48bc9c225834f11a686",
|
||||
"url_base": "/",
|
||||
"version": 2
|
||||
}
|
@ -1 +1 @@
|
||||
3fd466ba1167bbba529769448e96dd900b827296
|
||||
ec39b5e1f451d12030abbb2bc95ea506a73aef73
|
@ -144,4 +144,10 @@ Object.keys(expected).forEach(function(iface) {
|
||||
assert_props(iface, event, false);
|
||||
}, iface + " constructor (argument with non-default values)");
|
||||
});
|
||||
|
||||
test(function () {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new UIEvent("x", { view: 7 })
|
||||
});
|
||||
}, "UIEvent constructor (view argument with wrong type)")
|
||||
</script>
|
||||
|
@ -166,7 +166,7 @@ The way to contribute is just as usual:
|
||||
* Fork this repository (and make sure you're still relatively in sync
|
||||
with it if you forked a while ago).
|
||||
* Create a branch for your changes:
|
||||
`git checkout -b your-name/topic`.
|
||||
`git checkout -b topic`.
|
||||
* Make your changes.
|
||||
* Run the lint script described below.
|
||||
* Commit locally and push that to your repo.
|
||||
|
59
testing/web-platform/tests/XMLHttpRequest/send-content-type-charset.htm
Normal file → Executable file
59
testing/web-platform/tests/XMLHttpRequest/send-content-type-charset.htm
Normal file → Executable file
@ -10,7 +10,8 @@
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function request(input, output) {
|
||||
function request(input, output, title) {
|
||||
title = title || document.title + ' - ' + input;
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("POST", "resources/content.py", false)
|
||||
@ -19,39 +20,63 @@
|
||||
client.send("TEST")
|
||||
assert_equals(client.responseText, "TEST")
|
||||
assert_equals(client.getResponseHeader("x-request-content-type"), output)
|
||||
})
|
||||
}, title)
|
||||
}
|
||||
request(
|
||||
"text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
|
||||
"text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8"
|
||||
)
|
||||
|
||||
request(
|
||||
"text; charset=ascii",
|
||||
"text; charset=ascii"
|
||||
"text; charset=ascii",
|
||||
"header with invalid MIME type is not changed"
|
||||
)
|
||||
request(
|
||||
"charset=ascii",
|
||||
"charset=ascii"
|
||||
"charset=ascii",
|
||||
"known charset but bogus header - missing MIME type"
|
||||
)
|
||||
request(
|
||||
"text/x-thepiano;charset= waddup",
|
||||
"text/x-thepiano;charset=UTF-8"
|
||||
)
|
||||
request(
|
||||
"text/x-pink-unicorn",
|
||||
"text/x-pink-unicorn"
|
||||
"charset=bogus",
|
||||
"charset=bogus",
|
||||
"bogus charset and bogus header - missing MIME type"
|
||||
)
|
||||
request(
|
||||
"text/plain;charset=utf-8",
|
||||
"text/plain;charset=utf-8"
|
||||
"text/plain;charset=utf-8",
|
||||
"Correct text/plain MIME with charset"
|
||||
)
|
||||
request(
|
||||
"text/x-pink-unicorn",
|
||||
"text/x-pink-unicorn",
|
||||
"If no charset= param is given, implementation should not add one - unknown MIME"
|
||||
)
|
||||
request(
|
||||
"text/plain",
|
||||
"text/plain",
|
||||
"If no charset= param is given, implementation should not add one - known MIME"
|
||||
)
|
||||
request(
|
||||
"text/x-thepiano;charset= waddup",
|
||||
"text/x-thepiano;charset=UTF-8",
|
||||
"charset given but wrong, fix it (unknown MIME, bogus charset)"
|
||||
)
|
||||
request( /**/
|
||||
"text/plain;charset=utf-8;charset=waddup",
|
||||
"text/plain;charset=UTF-8;charset=UTF-8"
|
||||
"text/plain;charset=UTF-8;charset=UTF-8",
|
||||
"charset given but wrong, fix it (known MIME, bogus charset)"
|
||||
)
|
||||
request(
|
||||
"text/plain;charset=shift-jis",
|
||||
"text/plain;charset=UTF-8",
|
||||
"charset given but wrong, fix it (known MIME, actual charset)"
|
||||
)
|
||||
request(
|
||||
"text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
|
||||
"text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8",
|
||||
"If multiple charset parameters are given, all should be rewritten"
|
||||
)
|
||||
request(
|
||||
null,
|
||||
"text/plain;charset=UTF-8"
|
||||
"text/plain;charset=UTF-8",
|
||||
"No content type set, give MIME and charset"
|
||||
)
|
||||
</script>
|
||||
</body>
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<link rel=help href=https://dom.spec.whatwg.org/#interface-htmlcollection>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
|
||||
<!-- with no attribute -->
|
||||
<span></span>
|
||||
|
||||
<!-- with `id` attribute -->
|
||||
<span id=''></span>
|
||||
<span id='some-id'></span>
|
||||
<span id='some-id'></span><!-- to ensure no duplicates -->
|
||||
|
||||
<!-- with `name` attribute -->
|
||||
<span name=''></span>
|
||||
<span name='some-name'></span>
|
||||
<span name='some-name'></span><!-- to ensure no duplicates -->
|
||||
|
||||
<!-- with `name` and `id` attribute -->
|
||||
<span id='another-id' name='another-name'></span>
|
||||
|
||||
<script>
|
||||
test(function () {
|
||||
var elements = document.getElementsByTagName("span");
|
||||
assert_array_equals(
|
||||
Object.getOwnPropertyNames(elements),
|
||||
['0', '1', '2', '3', '4', '5', '6', '7', 'some-id', 'some-name', 'another-id', 'another-name']
|
||||
);
|
||||
}, 'Object.getOwnPropertyNames on HTMLCollection');
|
||||
|
||||
test(function () {
|
||||
var elem = document.createElementNS('some-random-namespace', 'foo');
|
||||
this.add_cleanup(function () {elem.remove();});
|
||||
elem.setAttribute("name", "some-name");
|
||||
document.body.appendChild(elem);
|
||||
|
||||
var elements = document.getElementsByTagName("foo");
|
||||
assert_array_equals(Object.getOwnPropertyNames(elements), ['0']);
|
||||
}, 'Object.getOwnPropertyNames on HTMLCollection with non-HTML namespace');
|
||||
|
||||
test(function () {
|
||||
var elem = document.createElement('foo');
|
||||
this.add_cleanup(function () {elem.remove();});
|
||||
document.body.appendChild(elem);
|
||||
|
||||
var elements = document.getElementsByTagName("foo");
|
||||
elements.someProperty = "some value";
|
||||
|
||||
assert_array_equals(Object.getOwnPropertyNames(elements), ['0', 'someProperty']);
|
||||
}, 'Object.getOwnPropertyNames on HTMLCollection with expando object');
|
||||
</script>
|
@ -237,7 +237,7 @@ test(function() {
|
||||
var html = document.implementation.createHTMLDocument("title");
|
||||
var copy = html.cloneNode();
|
||||
check_copy(html, copy, Document);
|
||||
assert_equals(html.title, copy.title);
|
||||
assert_equals(copy.title, "");
|
||||
}, "implementation.createHTMLDocument");
|
||||
|
||||
test(function() {
|
||||
|
@ -129,7 +129,7 @@ var commandTests = {
|
||||
indent: [],
|
||||
insertHorizontalRule: ["id"],
|
||||
insertHTML: ["<b>hi</b>"],
|
||||
insertImage: ["http://example.com/some-image"],
|
||||
insertImage: ["../images/green.png"],
|
||||
insertLineBreak: [],
|
||||
insertOrderedList: [],
|
||||
insertParagraph: [],
|
||||
|
@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLElement#click</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var element = document.createElement("div");
|
||||
var received = false;
|
||||
element.addEventListener("click", this.step_func(function(e) {
|
||||
received = true;
|
||||
assert_false(e.isTrusted, "Event should not be trusted")
|
||||
}));
|
||||
element.click();
|
||||
assert_true(received, "click event should have been dispatched synchronously");
|
||||
})
|
||||
</script>
|
@ -25,6 +25,10 @@
|
||||
var base = document.createElement("base");
|
||||
base.setAttribute("href", "/foo/bar");
|
||||
document.head.appendChild(base);
|
||||
t1.add_cleanup(function () {
|
||||
document.head.removeChild(base);
|
||||
});
|
||||
|
||||
assert_resolve_url(document, location.href.replace(location.pathname, "/foo"));
|
||||
assert_equals(document.baseURI, base.href, "The document base URL should be URL of the first base element that has an href attribute.");
|
||||
});
|
||||
@ -55,10 +59,10 @@
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.onload = this.step_func_done(function () {
|
||||
var doc = iframe.contentDocument;
|
||||
var base = doc.body.appendChild(document.createElement("base"));
|
||||
var base = doc.body.appendChild(doc.createElement("base"));
|
||||
base.href = "sub/";
|
||||
assert_resolve_url(doc, location.href.replace("/document-base-url.html", "/sub"));
|
||||
assert_equals(doc.baseURI, document.baseURI);
|
||||
assert_equals(doc.baseURI, document.baseURI.replace("/document-base-url.html", "/sub/"));
|
||||
});
|
||||
iframe.setAttribute("src", "about:blank");
|
||||
document.body.appendChild(iframe);
|
||||
|
@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>requestAnimationFrame callback exception reported to error handler</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://w3c.github.io/web-performance/specs/RequestAnimationFrame/Overview.html#dom-windowanimationtiming-requestanimationframe"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var custom_exception = 'requestAnimationFrameException';
|
||||
setup({allow_uncaught_exception : true});
|
||||
async_test(function (t) {
|
||||
addEventListener("error",function(e) {
|
||||
t.step(function() {
|
||||
assert_equals(e.error.message, custom_exception);
|
||||
t.done();
|
||||
})
|
||||
});
|
||||
window.requestAnimationFrame(function () {
|
||||
throw new Error(custom_exception);
|
||||
});
|
||||
}, "requestAnimationFrame callback exceptions are reported to error handler");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
<title>Object.prototype.getOwnPropertyNames</title>
|
||||
<link rel=help href=http://es5.github.io/#x15.2.3.4>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function () {
|
||||
var obj = {0: 'a', 1: 'b', 2: 'c'};
|
||||
assert_array_equals(
|
||||
Object.getOwnPropertyNames(obj).sort(),
|
||||
['0', '1', '2']
|
||||
);
|
||||
}, "object");
|
||||
|
||||
test(function () {
|
||||
var arr = ['a', 'b', 'c'];
|
||||
assert_array_equals(
|
||||
Object.getOwnPropertyNames(arr).sort(),
|
||||
['0', '1', '2', 'length']
|
||||
);
|
||||
}, "array-like");
|
||||
|
||||
test(function () {
|
||||
var obj = Object.create({}, {
|
||||
getFoo: {
|
||||
value: function() { return this.foo; },
|
||||
enumerable: false
|
||||
}
|
||||
});
|
||||
obj.foo = 1;
|
||||
assert_array_equals(
|
||||
Object.getOwnPropertyNames(obj).sort(),
|
||||
['foo', 'getFoo']
|
||||
);
|
||||
}, "non-enumerable property");
|
||||
|
||||
test(function() {
|
||||
function ParentClass() {}
|
||||
ParentClass.prototype.inheritedMethod = function() {};
|
||||
|
||||
function ChildClass() {
|
||||
this.prop = 5;
|
||||
this.method = function() {};
|
||||
}
|
||||
ChildClass.prototype = new ParentClass;
|
||||
ChildClass.prototype.prototypeMethod = function() {};
|
||||
|
||||
var obj = new ChildClass;
|
||||
assert_array_equals(
|
||||
Object.getOwnPropertyNames(obj).sort(),
|
||||
['method', 'prop']
|
||||
);
|
||||
}, 'items on the prototype chain are not listed');
|
||||
</script>
|
@ -15,12 +15,12 @@
|
||||
var manifestFilenameB = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json";
|
||||
|
||||
var expectationsA = {
|
||||
webm: "{ [0.000, 2.022) }",
|
||||
webm: "{ [0.000, 2.023) }",
|
||||
mp4: "{ [0.000, 2.043) }",
|
||||
};
|
||||
|
||||
var expectationsB = {
|
||||
webm: "{ [0.000, 2.000) }",
|
||||
webm: "{ [0.000, 2.001) }",
|
||||
mp4: "{ [0.000, 2.000) }",
|
||||
};
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
test.waitForExpectedEvents(function()
|
||||
{
|
||||
var expectationsAV = {
|
||||
webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.022) }"],
|
||||
webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.023) }"],
|
||||
mp4: ["{ [0.000, 2.000) }", "{ [0.000, 2.043) }"],
|
||||
};
|
||||
|
||||
|
@ -32,132 +32,69 @@ function assert_promise_rejects(promise, code, description) {
|
||||
});
|
||||
}
|
||||
|
||||
// Asserts that two objects |actual| and |expected| are weakly equal under the
|
||||
// following definition:
|
||||
// Helper for testing with Headers objects. Compares Headers instances
|
||||
// by serializing |expected| and |actual| to arrays and comparing.
|
||||
function assert_header_equals(actual, expected, description) {
|
||||
assert_class_string(actual, "Headers", description);
|
||||
var header, actual_headers = [], expected_headers = [];
|
||||
for (header of actual)
|
||||
actual_headers.push(header[0] + ": " + header[1]);
|
||||
for (header of expected)
|
||||
expected_headers.push(header[0] + ": " + header[1]);
|
||||
assert_array_equals(actual_headers, expected_headers,
|
||||
description + " Headers differ.");
|
||||
}
|
||||
|
||||
// Helper for testing with Response objects. Compares simple
|
||||
// attributes defined on the interfaces, as well as the headers. It
|
||||
// does not compare the response bodies.
|
||||
function assert_response_equals(actual, expected, description) {
|
||||
assert_class_string(actual, "Response", description);
|
||||
["type", "url", "status", "ok", "statusText"].forEach(function(attribute) {
|
||||
assert_equals(actual[attribute], expected[attribute],
|
||||
description + " Attributes differ: " + attribute + ".");
|
||||
});
|
||||
assert_header_equals(actual.headers, expected.headers, description);
|
||||
}
|
||||
|
||||
// Assert that the two arrays |actual| and |expected| contain the same
|
||||
// set of Responses as determined by assert_response_equals. The order
|
||||
// is not significant.
|
||||
//
|
||||
// |a| and |b| are weakly equal if any of the following are true:
|
||||
// 1. If |a| is not an 'object', and |a| === |b|.
|
||||
// 2. If |a| is an 'object', and all of the following are true:
|
||||
// 2.1 |a.p| is weakly equal to |b.p| for all own properties |p| of |a|.
|
||||
// 2.2 Every own property of |b| is an own property of |a|.
|
||||
//
|
||||
// This is a replacement for the the version of assert_object_equals() in
|
||||
// testharness.js. The latter doesn't handle own properties correctly. I.e. if
|
||||
// |a.p| is not an own property, it still requires that |b.p| be an own
|
||||
// property.
|
||||
//
|
||||
// Note that |actual| must not contain cyclic references.
|
||||
self.assert_object_equals = function(actual, expected, description) {
|
||||
var object_stack = [];
|
||||
// |expected| is assumed to not contain any duplicates.
|
||||
function assert_response_array_equivalent(actual, expected, description) {
|
||||
assert_true(Array.isArray(actual), description);
|
||||
assert_equals(actual.length, expected.length, description);
|
||||
expected.forEach(function(expected_element) {
|
||||
// assert_response_in_array treats the first argument as being
|
||||
// 'actual', and the second as being 'expected array'. We are
|
||||
// switching them around because we want to be resilient
|
||||
// against the |actual| array containing duplicates.
|
||||
assert_response_in_array(expected_element, actual, description);
|
||||
});
|
||||
}
|
||||
|
||||
function _is_equal(actual, expected, prefix) {
|
||||
if (typeof actual !== 'object') {
|
||||
assert_equals(actual, expected, prefix);
|
||||
return;
|
||||
}
|
||||
assert_true(typeof expected === 'object', prefix);
|
||||
assert_equals(object_stack.indexOf(actual), -1,
|
||||
prefix + ' must not contain cyclic references.');
|
||||
// Asserts that two arrays |actual| and |expected| contain the same
|
||||
// set of Responses as determined by assert_response_equals(). The
|
||||
// corresponding elements must occupy corresponding indices in their
|
||||
// respective arrays.
|
||||
function assert_response_array_equals(actual, expected, description) {
|
||||
assert_true(Array.isArray(actual), description);
|
||||
assert_equals(actual.length, expected.length, description);
|
||||
actual.forEach(function(value, index) {
|
||||
assert_response_equals(value, expected[index],
|
||||
description + " : object[" + index + "]");
|
||||
});
|
||||
}
|
||||
|
||||
object_stack.push(actual);
|
||||
|
||||
Object.getOwnPropertyNames(expected).forEach(function(property) {
|
||||
assert_own_property(actual, property, prefix);
|
||||
_is_equal(actual[property], expected[property],
|
||||
prefix + '.' + property);
|
||||
});
|
||||
Object.getOwnPropertyNames(actual).forEach(function(property) {
|
||||
assert_own_property(expected, property, prefix);
|
||||
});
|
||||
|
||||
object_stack.pop();
|
||||
}
|
||||
|
||||
function _brand(object) {
|
||||
return Object.prototype.toString.call(object).match(/^\[object (.*)\]$/)[1];
|
||||
}
|
||||
|
||||
_is_equal(actual, expected,
|
||||
(description ? description + ': ' : '') + _brand(expected));
|
||||
};
|
||||
|
||||
// Equivalent to assert_in_array, but uses a weaker equivalence relation
|
||||
// (assert_object_equals) than '==='.
|
||||
function assert_object_in_array(actual, expected_array, description) {
|
||||
assert_true(expected_array.some(function(element) {
|
||||
try {
|
||||
assert_object_equals(actual, element);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
// Equivalent to assert_in_array, but uses assert_response_equals.
|
||||
function assert_response_in_array(actual, expected_array, description) {
|
||||
assert_true(expected_array.some(function(element) {
|
||||
try {
|
||||
assert_response_equals(actual, element);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}), description);
|
||||
}
|
||||
|
||||
// Assert that the two arrays |actual| and |expected| contain the same set of
|
||||
// elements as determined by assert_object_equals. The order is not significant.
|
||||
//
|
||||
// |expected| is assumed to not contain any duplicates as determined by
|
||||
// assert_object_equals().
|
||||
function assert_array_equivalent(actual, expected, description) {
|
||||
assert_true(Array.isArray(actual), description);
|
||||
assert_equals(actual.length, expected.length, description);
|
||||
expected.forEach(function(expected_element) {
|
||||
// assert_in_array treats the first argument as being 'actual', and the
|
||||
// second as being 'expected array'. We are switching them around because
|
||||
// we want to be resilient against the |actual| array containing
|
||||
// duplicates.
|
||||
assert_object_in_array(expected_element, actual, description);
|
||||
});
|
||||
}
|
||||
|
||||
// Asserts that two arrays |actual| and |expected| contain the same set of
|
||||
// elements as determined by assert_object_equals(). The corresponding elements
|
||||
// must occupy corresponding indices in their respective arrays.
|
||||
function assert_array_objects_equals(actual, expected, description) {
|
||||
assert_true(Array.isArray(actual), description);
|
||||
assert_equals(actual.length, expected.length, description);
|
||||
actual.forEach(function(value, index) {
|
||||
assert_object_equals(value, expected[index],
|
||||
description + ' : object[' + index + ']');
|
||||
});
|
||||
}
|
||||
|
||||
// Asserts that |object| that is an instance of some interface has the attribute
|
||||
// |attribute_name| following the conditions specified by WebIDL, but it's
|
||||
// acceptable that the attribute |attribute_name| is an own property of the
|
||||
// object because we're in the middle of moving the attribute to a prototype
|
||||
// chain. Once we complete the transition to prototype chains,
|
||||
// assert_will_be_idl_attribute must be replaced with assert_idl_attribute
|
||||
// defined in testharness.js.
|
||||
//
|
||||
// FIXME: Remove assert_will_be_idl_attribute once we complete the transition
|
||||
// of moving the DOM attributes to prototype chains. (http://crbug.com/43394)
|
||||
function assert_will_be_idl_attribute(object, attribute_name, description) {
|
||||
assert_true(typeof object === "object", description);
|
||||
|
||||
assert_true("hasOwnProperty" in object, description);
|
||||
|
||||
// Do not test if |attribute_name| is not an own property because
|
||||
// |attribute_name| is in the middle of the transition to a prototype
|
||||
// chain. (http://crbug.com/43394)
|
||||
|
||||
assert_true(attribute_name in object, description);
|
||||
}
|
||||
|
||||
// Stringifies a DOM object. This function stringifies not only own properties
|
||||
// but also DOM attributes which are on a prototype chain. Note that
|
||||
// JSON.stringify only stringifies own properties.
|
||||
function stringifyDOMObject(object)
|
||||
{
|
||||
function deepCopy(src) {
|
||||
if (typeof src != "object")
|
||||
return src;
|
||||
var dst = Array.isArray(src) ? [] : {};
|
||||
for (var property in src) {
|
||||
dst[property] = deepCopy(src[property]);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
return JSON.stringify(deepCopy(object));
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ var vary_entries = [
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll('not-present-in-the-cache')
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result, [],
|
||||
'Cache.matchAll should resolve with an empty array on failure.');
|
||||
});
|
||||
@ -126,23 +126,23 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.a.request.url)
|
||||
.then(function(result) {
|
||||
assert_array_objects_equals(result, [entries.a.response],
|
||||
'Cache.matchAll should match by URL.');
|
||||
assert_response_array_equals(result, [entries.a.response],
|
||||
'Cache.matchAll should match by URL.');
|
||||
});
|
||||
}, 'Cache.matchAll with URL');
|
||||
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.a.request.url)
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, entries.a.response,
|
||||
'Cache.match should match by URL.');
|
||||
assert_response_equals(result, entries.a.response,
|
||||
'Cache.match should match by URL.');
|
||||
});
|
||||
}, 'Cache.match with URL');
|
||||
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.a.request)
|
||||
.then(function(result) {
|
||||
assert_array_objects_equals(
|
||||
assert_response_array_equals(
|
||||
result, [entries.a.response],
|
||||
'Cache.matchAll should match by Request.');
|
||||
});
|
||||
@ -151,15 +151,15 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.a.request)
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, entries.a.response,
|
||||
'Cache.match should match by Request.');
|
||||
assert_response_equals(result, entries.a.response,
|
||||
'Cache.match should match by Request.');
|
||||
});
|
||||
}, 'Cache.match with Request');
|
||||
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(new Request(entries.a.request.url))
|
||||
.then(function(result) {
|
||||
assert_array_objects_equals(
|
||||
assert_response_array_equals(
|
||||
result, [entries.a.response],
|
||||
'Cache.matchAll should match by Request.');
|
||||
});
|
||||
@ -168,8 +168,8 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(new Request(entries.a.request.url))
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, entries.a.response,
|
||||
'Cache.match should match by Request.');
|
||||
assert_response_equals(result, entries.a.response,
|
||||
'Cache.match should match by Request.');
|
||||
});
|
||||
}, 'Cache.match with new Request');
|
||||
|
||||
@ -177,7 +177,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.a.request,
|
||||
{ignoreSearch: true})
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
entries.a.response,
|
||||
@ -194,7 +194,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.a.request,
|
||||
{ignoreSearch: true})
|
||||
.then(function(result) {
|
||||
assert_object_in_array(
|
||||
assert_response_in_array(
|
||||
result,
|
||||
[
|
||||
entries.a.response,
|
||||
@ -211,7 +211,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.a_with_query.request,
|
||||
{ignoreSearch: true})
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
entries.a.response,
|
||||
@ -227,7 +227,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.a_with_query.request,
|
||||
{ignoreSearch: true})
|
||||
.then(function(result) {
|
||||
assert_object_in_array(
|
||||
assert_response_in_array(
|
||||
result,
|
||||
[
|
||||
entries.a.response,
|
||||
@ -242,7 +242,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.cat.request.url + '#mouse')
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
entries.cat.response,
|
||||
@ -254,15 +254,15 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.cat.request.url + '#mouse')
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, entries.cat.response,
|
||||
'Cache.match should ignore URL fragment.');
|
||||
assert_response_equals(result, entries.cat.response,
|
||||
'Cache.match should ignore URL fragment.');
|
||||
});
|
||||
}, 'Cache.match with URL containing fragment');
|
||||
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll('http')
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result, [],
|
||||
'Cache.matchAll should treat query as a URL and not ' +
|
||||
'just a string fragment.');
|
||||
@ -282,7 +282,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.matchAll(entries.secret_cat.request.url)
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result, [entries.secret_cat.response],
|
||||
'Cache.matchAll should not ignore embedded credentials');
|
||||
});
|
||||
@ -291,7 +291,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
return cache.match(entries.secret_cat.request.url)
|
||||
.then(function(result) {
|
||||
assert_object_equals(
|
||||
assert_response_equals(
|
||||
result, entries.secret_cat.response,
|
||||
'Cache.match should not ignore embedded credentials');
|
||||
});
|
||||
@ -300,7 +300,7 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
return cache.matchAll('http://example.com/c')
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
entries.vary_cookie_absent.response
|
||||
@ -316,7 +316,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
{headers: {'Cookies': 'none-of-the-above'}}));
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
],
|
||||
@ -331,7 +331,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
{headers: {'Cookies': 'is-for-cookie'}}));
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[entries.vary_cookie_is_cookie.response],
|
||||
'Cache.matchAll should match the entire header if a vary header ' +
|
||||
@ -342,7 +342,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
return cache.match('http://example.com/c')
|
||||
.then(function(result) {
|
||||
assert_object_in_array(
|
||||
assert_response_in_array(
|
||||
result,
|
||||
[
|
||||
entries.vary_cookie_absent.response
|
||||
@ -355,7 +355,7 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
|
||||
return cache.matchAll('http://example.com/c',
|
||||
{ignoreVary: true})
|
||||
.then(function(result) {
|
||||
assert_array_equivalent(
|
||||
assert_response_array_equivalent(
|
||||
result,
|
||||
[
|
||||
entries.vary_cookie_is_cookie.response,
|
||||
@ -383,7 +383,7 @@ cache_test(function(cache) {
|
||||
return cache.match(request.url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(
|
||||
assert_response_equals(
|
||||
result, response,
|
||||
'Cache.match should return a Response object that has the same ' +
|
||||
'properties as the stored response.');
|
||||
|
@ -30,9 +30,9 @@ cache_test(function(cache) {
|
||||
return cache.match(test_url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new request and response.');
|
||||
assert_response_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new request and response.');
|
||||
return result.text();
|
||||
})
|
||||
.then(function(body) {
|
||||
@ -75,9 +75,9 @@ cache_test(function(cache) {
|
||||
return cache.match(test_url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new Request and Response.');
|
||||
assert_response_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new Request and Response.');
|
||||
});
|
||||
}, 'Cache.put with a Response containing an empty URL');
|
||||
|
||||
@ -118,9 +118,9 @@ cache_test(function(cache) {
|
||||
return cache.match(test_url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new request and response.');
|
||||
assert_response_equals(result, response,
|
||||
'Cache.put should update the cache with ' +
|
||||
'new request and response.');
|
||||
return result.text();
|
||||
})
|
||||
.then(function(body) {
|
||||
@ -142,9 +142,9 @@ cache_test(function(cache) {
|
||||
return cache.match(test_url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, alternate_response,
|
||||
'Cache.put should replace existing ' +
|
||||
'response with new response.');
|
||||
assert_response_equals(result, alternate_response,
|
||||
'Cache.put should replace existing ' +
|
||||
'response with new response.');
|
||||
return result.text();
|
||||
})
|
||||
.then(function(body) {
|
||||
@ -168,9 +168,9 @@ cache_test(function(cache) {
|
||||
return cache.match(test_url);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, alternate_response,
|
||||
'Cache.put should replace existing ' +
|
||||
'response with new response.');
|
||||
assert_response_equals(result, alternate_response,
|
||||
'Cache.put should replace existing ' +
|
||||
'response with new response.');
|
||||
return result.text();
|
||||
})
|
||||
.then(function(body) {
|
||||
@ -248,9 +248,9 @@ cache_test(function(cache) {
|
||||
return cache.match(new URL('relative-url', location.href).href);
|
||||
})
|
||||
.then(function(result) {
|
||||
assert_object_equals(result, response,
|
||||
'Cache.put should accept a relative URL ' +
|
||||
'as the request.');
|
||||
assert_response_equals(result, response,
|
||||
'Cache.put should accept a relative URL ' +
|
||||
'as the request.');
|
||||
});
|
||||
}, 'Cache.put with a relative URL');
|
||||
|
||||
|
@ -30,8 +30,8 @@ cache_test(function(cache) {
|
||||
return self.caches.match(transaction.request);
|
||||
})
|
||||
.then(function(response) {
|
||||
assert_object_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
assert_response_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
});
|
||||
}, 'CacheStorageMatch with no cache name provided');
|
||||
|
||||
@ -49,8 +49,8 @@ cache_test(function(cache) {
|
||||
return self.caches.match(transaction.request);
|
||||
})
|
||||
.then(function(response) {
|
||||
assert_object_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
assert_response_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
});
|
||||
}, 'CacheStorageMatch from one of many caches');
|
||||
|
||||
@ -70,8 +70,8 @@ promise_test(function(test) {
|
||||
return self.caches.match(transaction.request, {cacheName: 'x'});
|
||||
})
|
||||
.then(function(response) {
|
||||
assert_object_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
assert_response_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
})
|
||||
.then(function() {
|
||||
return self.caches.match(transaction.request, {cacheName: 'y'});
|
||||
@ -89,8 +89,8 @@ cache_test(function(cache) {
|
||||
return self.caches.match(transaction.request);
|
||||
})
|
||||
.then(function(response) {
|
||||
assert_object_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
assert_response_equals(response, transaction.response,
|
||||
'The response should not have changed.');
|
||||
});
|
||||
}, 'CacheStorageMatch a string request');
|
||||
|
||||
|
@ -1,163 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Distributed under both the W3C Test Suite License [1] and the W3C
|
||||
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
|
||||
policies and contribution forms [3].
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
|
||||
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
|
||||
[3] http://www.w3.org/2004/10/27-testcases
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Shadow DOM Test: A_10_04_04</title>
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#content-element">
|
||||
<meta name="assert" content="The content HTML element: reset-style-inheritance attribute">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(unit(function (ctx) {
|
||||
|
||||
var d = newRenderedHTMLDocument(ctx);
|
||||
|
||||
d.body.innerHTML =
|
||||
'<ul id="shHost">' +
|
||||
'<li id="li1" class="shadow">1</li>' +
|
||||
'<li id="li2" class="shadow2">2</li>' +
|
||||
'<li id="li3" class="shadow">3</li>' +
|
||||
'<li id="li4">4</li>' +
|
||||
'<li id="li5" class="shadow">5</li>' +
|
||||
'<li id="li6" class="shadow2">6</li>' +
|
||||
'</ul>';
|
||||
|
||||
|
||||
var defHeight1 = d.querySelector('#li1').offsetHeight;
|
||||
var defHeight2 = d.querySelector('#li2').offsetHeight;
|
||||
var defHeight3 = d.querySelector('#li3').offsetHeight;
|
||||
var defHeight4 = d.querySelector('#li4').offsetHeight;
|
||||
var defHeight5 = d.querySelector('#li5').offsetHeight;
|
||||
var defHeight6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
|
||||
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
|
||||
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
|
||||
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
|
||||
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
|
||||
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
|
||||
|
||||
var host = d.querySelector('#shHost');
|
||||
|
||||
d.body.setAttribute('style', 'font-size: 30px');
|
||||
|
||||
var height1 = d.querySelector('#li1').offsetHeight;
|
||||
var height2 = d.querySelector('#li2').offsetHeight;
|
||||
var height3 = d.querySelector('#li3').offsetHeight;
|
||||
var height4 = d.querySelector('#li4').offsetHeight;
|
||||
var height5 = d.querySelector('#li5').offsetHeight;
|
||||
var height6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
|
||||
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
|
||||
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
|
||||
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
|
||||
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
|
||||
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
|
||||
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
|
||||
|
||||
//Shadow root to play with
|
||||
var s = host.createShadowRoot();
|
||||
|
||||
var div = d.createElement('div');
|
||||
div.innerHTML ='<ul><content select=".shadow" reset-style-inheritance=true></content></ul>';
|
||||
s.appendChild(div);
|
||||
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
|
||||
'element style should be reset');
|
||||
|
||||
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
|
||||
|
||||
}), 'A_10_04_04_T01');
|
||||
|
||||
|
||||
test(unit(function (ctx) {
|
||||
|
||||
var d = newRenderedHTMLDocument(ctx);
|
||||
|
||||
d.body.innerHTML =
|
||||
'<ul id="shHost">' +
|
||||
'<li id="li1" class="shadow">1</li>' +
|
||||
'<li id="li2" class="shadow2">2</li>' +
|
||||
'<li id="li3" class="shadow">3</li>' +
|
||||
'<li id="li4">4</li>' +
|
||||
'<li id="li5" class="shadow">5</li>' +
|
||||
'<li id="li6" class="shadow2">6</li>' +
|
||||
'</ul>';
|
||||
|
||||
|
||||
var defHeight1 = d.querySelector('#li1').offsetHeight;
|
||||
var defHeight2 = d.querySelector('#li2').offsetHeight;
|
||||
var defHeight3 = d.querySelector('#li3').offsetHeight;
|
||||
var defHeight4 = d.querySelector('#li4').offsetHeight;
|
||||
var defHeight5 = d.querySelector('#li5').offsetHeight;
|
||||
var defHeight6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
|
||||
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
|
||||
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
|
||||
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
|
||||
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
|
||||
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
|
||||
|
||||
var host = d.querySelector('#shHost');
|
||||
|
||||
d.body.setAttribute('style', 'font-size: 30px');
|
||||
|
||||
var height1 = d.querySelector('#li1').offsetHeight;
|
||||
var height2 = d.querySelector('#li2').offsetHeight;
|
||||
var height3 = d.querySelector('#li3').offsetHeight;
|
||||
var height4 = d.querySelector('#li4').offsetHeight;
|
||||
var height5 = d.querySelector('#li5').offsetHeight;
|
||||
var height6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
|
||||
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
|
||||
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
|
||||
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
|
||||
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
|
||||
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
|
||||
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
|
||||
|
||||
//Shadow root to play with
|
||||
var s = host.createShadowRoot();
|
||||
|
||||
var div = d.createElement('div');
|
||||
div.innerHTML ='<ul><content select=".shadow" reset-style-inheritance></content></ul>';
|
||||
s.appendChild(div);
|
||||
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
|
||||
'element style should be reset');
|
||||
|
||||
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
|
||||
|
||||
}), 'A_10_04_04_T02');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,189 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Distributed under both the W3C Test Suite License [1] and the W3C
|
||||
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
|
||||
policies and contribution forms [3].
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
|
||||
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
|
||||
[3] http://www.w3.org/2004/10/27-testcases
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Shadow DOM Test: A_10_05_03</title>
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-element">
|
||||
<meta name="assert" content="The shadow HTML element: reset-style-inheritance attribute">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// test reset-style-inheritance=true
|
||||
test(unit(function (ctx) {
|
||||
|
||||
var d = newRenderedHTMLDocument(ctx);
|
||||
|
||||
d.body.innerHTML =
|
||||
'<ul id="shHost">' +
|
||||
'<li id="li1" class="shadow">1</li>' +
|
||||
'<li id="li2" class="shadow2">2</li>' +
|
||||
'<li id="li3" class="shadow">3</li>' +
|
||||
'<li id="li4">4</li>' +
|
||||
'<li id="li5" class="shadow">5</li>' +
|
||||
'<li id="li6" class="shadow2">6</li>' +
|
||||
'</ul>';
|
||||
|
||||
|
||||
var defHeight1 = d.querySelector('#li1').offsetHeight;
|
||||
var defHeight2 = d.querySelector('#li2').offsetHeight;
|
||||
var defHeight3 = d.querySelector('#li3').offsetHeight;
|
||||
var defHeight4 = d.querySelector('#li4').offsetHeight;
|
||||
var defHeight5 = d.querySelector('#li5').offsetHeight;
|
||||
var defHeight6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
|
||||
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
|
||||
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
|
||||
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
|
||||
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
|
||||
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
|
||||
|
||||
var host = d.querySelector('#shHost');
|
||||
|
||||
d.body.setAttribute('style', 'font-size: 30px');
|
||||
|
||||
var height1 = d.querySelector('#li1').offsetHeight;
|
||||
var height2 = d.querySelector('#li2').offsetHeight;
|
||||
var height3 = d.querySelector('#li3').offsetHeight;
|
||||
var height4 = d.querySelector('#li4').offsetHeight;
|
||||
var height5 = d.querySelector('#li5').offsetHeight;
|
||||
var height6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
|
||||
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
|
||||
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
|
||||
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
|
||||
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
|
||||
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
|
||||
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
|
||||
|
||||
//Shadow root to play with
|
||||
var s = host.createShadowRoot();
|
||||
|
||||
var div = d.createElement('div');
|
||||
div.innerHTML ='<ul><content select=".shadow"></content></ul>';
|
||||
s.appendChild(div);
|
||||
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
|
||||
|
||||
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
|
||||
|
||||
//Young tree
|
||||
var s2 = host.createShadowRoot();
|
||||
|
||||
var div2 = d.createElement('div');
|
||||
div2.innerHTML = '<shadow reset-style-inheritance=true></shadow>';
|
||||
s2.appendChild(div2);
|
||||
|
||||
//styles should be reset
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
|
||||
'element style should be reset');
|
||||
|
||||
}), 'A_10_05_03_T01');
|
||||
|
||||
|
||||
//test reset-style-inheritance
|
||||
test(unit(function (ctx) {
|
||||
|
||||
var d = newRenderedHTMLDocument(ctx);
|
||||
|
||||
d.body.innerHTML =
|
||||
'<ul id="shHost">' +
|
||||
'<li id="li1" class="shadow">1</li>' +
|
||||
'<li id="li2" class="shadow2">2</li>' +
|
||||
'<li id="li3" class="shadow">3</li>' +
|
||||
'<li id="li4">4</li>' +
|
||||
'<li id="li5" class="shadow">5</li>' +
|
||||
'<li id="li6" class="shadow2">6</li>' +
|
||||
'</ul>';
|
||||
|
||||
|
||||
var defHeight1 = d.querySelector('#li1').offsetHeight;
|
||||
var defHeight2 = d.querySelector('#li2').offsetHeight;
|
||||
var defHeight3 = d.querySelector('#li3').offsetHeight;
|
||||
var defHeight4 = d.querySelector('#li4').offsetHeight;
|
||||
var defHeight5 = d.querySelector('#li5').offsetHeight;
|
||||
var defHeight6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
|
||||
assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
|
||||
assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
|
||||
assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
|
||||
assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
|
||||
assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
|
||||
|
||||
var host = d.querySelector('#shHost');
|
||||
|
||||
d.body.setAttribute('style', 'font-size: 30px');
|
||||
|
||||
var height1 = d.querySelector('#li1').offsetHeight;
|
||||
var height2 = d.querySelector('#li2').offsetHeight;
|
||||
var height3 = d.querySelector('#li3').offsetHeight;
|
||||
var height4 = d.querySelector('#li4').offsetHeight;
|
||||
var height5 = d.querySelector('#li5').offsetHeight;
|
||||
var height6 = d.querySelector('#li6').offsetHeight;
|
||||
|
||||
|
||||
assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
|
||||
assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
|
||||
assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
|
||||
assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
|
||||
assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
|
||||
assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
|
||||
|
||||
//Shadow root to play with
|
||||
var s = host.createShadowRoot();
|
||||
|
||||
var div = d.createElement('div');
|
||||
div.innerHTML ='<ul><content select=".shadow"></content></ul>';
|
||||
s.appendChild(div);
|
||||
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
|
||||
|
||||
assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
|
||||
assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
|
||||
|
||||
//Young tree
|
||||
var s2 = host.createShadowRoot();
|
||||
|
||||
var div2 = d.createElement('div');
|
||||
div2.innerHTML = '<shadow reset-style-inheritance></shadow>';
|
||||
s2.appendChild(div2);
|
||||
|
||||
//styles should be reset
|
||||
assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
|
||||
'element style should be reset');
|
||||
assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
|
||||
'element style should be reset');
|
||||
|
||||
}), 'A_10_05_03_T02');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -35,7 +35,7 @@ A_05_05_01_T01.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-slider-thumb relative target #volume-slider-thumb
|
||||
//For #volume-slider-thumb relative target #volume-slider-thumb
|
||||
roots.volumeShadowRoot.querySelector('#volume-slider-thumb').addEventListener('click',
|
||||
A_05_05_01_T01.step_func(function(event) {
|
||||
invoked = true;
|
||||
@ -68,7 +68,7 @@ A_05_05_01_T02.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-shadow-root relative target #volume-slider-thumb
|
||||
//For #volume-shadow-root relative target #volume-slider-thumb
|
||||
roots.volumeShadowRoot.addEventListener('click',
|
||||
A_05_05_01_T02.step_func(function(event) {
|
||||
invoked = true;
|
||||
@ -101,13 +101,13 @@ A_05_05_01_T03.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-slider relative target #volume-slider
|
||||
//For #volume-slider relative target #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
|
||||
A_05_05_01_T03.step_func(function(event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong target');
|
||||
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider',
|
||||
'Wrong currentTarget');
|
||||
}), false);
|
||||
|
||||
@ -135,13 +135,13 @@ A_05_05_01_T04.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-slider-container relative target #volume-slider
|
||||
//For #volume-slider-container relative target #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
|
||||
A_05_05_01_T04.step_func(function(event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong target');
|
||||
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider-container',
|
||||
'Wrong currentTarget');
|
||||
}), false);
|
||||
|
||||
@ -168,13 +168,13 @@ A_05_05_01_T05.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #controls relative target #volume-slider
|
||||
//For #controls relative target #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
|
||||
A_05_05_01_T05.step_func(function(event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong target');
|
||||
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.currentTarget.getAttribute('id'), 'controls',
|
||||
'Wrong currentTarget');
|
||||
}), false);
|
||||
|
||||
@ -201,13 +201,13 @@ A_05_05_01_T06.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #player-shadow-root relative target #volume-slider
|
||||
roots.playerShadowRoot.addEventListener('click',
|
||||
//For #player-shadow-host relative target #player-shadow-host
|
||||
d.querySelector('#player-shadow-host').addEventListener('click',
|
||||
A_05_05_01_T06.step_func(function(event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
|
||||
'Wrong target');
|
||||
assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.currentTarget.getAttribute('id'), 'player-shadow-host',
|
||||
'Wrong currentTarget');
|
||||
}), false);
|
||||
|
||||
@ -235,13 +235,13 @@ A_05_05_01_T07.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #player relative target #player
|
||||
//For #player relative target #player-shadow-host
|
||||
d.querySelector('#player').addEventListener('click',
|
||||
A_05_05_01_T07.step_func(function(event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'player',
|
||||
assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
|
||||
'Wrong target');
|
||||
assert_true(event.currentTarget.getAttribute('id'), 'player',
|
||||
assert_equals(event.currentTarget.getAttribute('id'), 'player',
|
||||
'Wrong currentTarget');
|
||||
}), false);
|
||||
|
||||
|
@ -60,11 +60,11 @@ A_05_01_04_T02.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-shadow-root relative target is #volume-slider-thumb
|
||||
roots.volumeShadowRoot.addEventListener('click',
|
||||
//For #volume-shadow-host relative target is #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#volume-shadow-host').addEventListener('click',
|
||||
A_05_01_04_T02.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider-thumb',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -90,11 +90,11 @@ A_05_01_04_T03.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-slider relative target is #volume-slider
|
||||
//For #volume-slider relative target is #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
|
||||
A_05_01_04_T03.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -118,11 +118,11 @@ A_05_01_04_T04.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #volume-slider-container relative target is #volume-slider
|
||||
//For #volume-slider-container relative target is #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
|
||||
A_05_01_04_T04.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -146,11 +146,11 @@ A_05_01_04_T05.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #controls relative target is #volume-slider
|
||||
//For #controls relative target is #volume-shadow-host
|
||||
roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
|
||||
A_05_01_04_T05.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -174,11 +174,11 @@ A_05_01_04_T06.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #player-shadow-root relative target is #volume-slider
|
||||
//For #player-shadow-host relative target is #player-shadow-host
|
||||
roots.playerShadowRoot.addEventListener('click',
|
||||
A_05_01_04_T06.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-slider',
|
||||
assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -203,11 +203,11 @@ A_05_01_04_T07.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #player relative target is #player
|
||||
//For #player relative target is #player-shadow-host
|
||||
d.querySelector('#player').addEventListener('click',
|
||||
A_05_01_04_T07.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'player',
|
||||
assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
@ -344,11 +344,11 @@ A_05_01_04_T12.step(unit(function (ctx) {
|
||||
//expected result of what relative target should be see
|
||||
//see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
|
||||
|
||||
//For #player relative target is #player
|
||||
//For #player relative target is #player-shadow-host
|
||||
d.querySelector('#player').addEventListener('click',
|
||||
A_05_01_04_T12.step_func(function (event) {
|
||||
invoked = true;
|
||||
assert_equals(event.target.getAttribute('id'), 'player',
|
||||
assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
|
||||
'Wrong related target');
|
||||
}), false);
|
||||
|
||||
|
@ -228,30 +228,30 @@ function createTestMediaPlayer(d) {
|
||||
d.body.innerHTML = '' +
|
||||
'<div id="player">' +
|
||||
'<input type="checkbox" id="outside-control">' +
|
||||
'<div id="player-shadow-root">' +
|
||||
'<div id="player-shadow-host">' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
var playerShadowRoot = d.querySelector('#player-shadow-root').createShadowRoot();
|
||||
var playerShadowRoot = d.querySelector('#player-shadow-host').createShadowRoot();
|
||||
playerShadowRoot.innerHTML = '' +
|
||||
'<div id="controls">' +
|
||||
'<button class="play-button">PLAY</button>' +
|
||||
'<input type="range" id="timeline">' +
|
||||
'<div id="timeline-shadow-root">' +
|
||||
'<div tabindex="0" id="timeline">' +
|
||||
'<div id="timeline-shadow-host">' +
|
||||
'</div>' +
|
||||
'</input>' +
|
||||
'</div>' +
|
||||
'<div class="volume-slider-container" id="volume-slider-container">' +
|
||||
'<input type="range" class="volume-slider" id="volume-slider">' +
|
||||
'<div id="volume-shadow-root">' +
|
||||
'<div tabindex="0" class="volume-slider" id="volume-slider">' +
|
||||
'<div id="volume-shadow-host">' +
|
||||
'</div>' +
|
||||
'</input>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-root').createShadowRoot();
|
||||
var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-host').createShadowRoot();
|
||||
timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-slider-thumb"></div>';
|
||||
|
||||
var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-root').createShadowRoot();
|
||||
var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-host').createShadowRoot();
|
||||
volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slider-thumb"></div>';
|
||||
|
||||
return {
|
||||
|
@ -115,6 +115,11 @@ class Webidl2Regexp(Regexp):
|
||||
pattern = "webidl2\.js"
|
||||
error = "WEBIDL2.JS"
|
||||
|
||||
class ConsoleRegexp(Regexp):
|
||||
pattern = "console\.[a-zA-Z]+\s*\("
|
||||
error = "CONSOLE"
|
||||
file_extensions = [".html", ".htm", ".js", ".xht", ".html", ".svg"]
|
||||
|
||||
class PrintRegexp(Regexp):
|
||||
pattern = "print(?:\s|\s*\()"
|
||||
error = "PRINT STATEMENT"
|
||||
@ -126,6 +131,7 @@ regexps = [item() for item in
|
||||
CRRegexp,
|
||||
W3CTestOrgRegexp,
|
||||
Webidl2Regexp,
|
||||
ConsoleRegexp,
|
||||
PrintRegexp]]
|
||||
|
||||
def check_regexp_line(path, f):
|
||||
|
@ -12,7 +12,7 @@ var args = [
|
||||
/* numbers */
|
||||
[NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0],
|
||||
[-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2],
|
||||
[1, 1], [-0xF1000000, 0xF000000],
|
||||
[1, 1], [-0xF1000000, 0],
|
||||
/* strings */
|
||||
["1", 1], ["1e2", 100],
|
||||
/* null, undefined, booleans */
|
||||
|
@ -12,7 +12,7 @@ var args = [
|
||||
/* numbers */
|
||||
[NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], // Step 2
|
||||
[-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], // Step 3
|
||||
[1, 1], [-0xF1000000, 0xF000000], // Step 4
|
||||
[1, 1], [-0xF1000000, 0], // Step 4
|
||||
/* strings */
|
||||
["1", 1], ["1e2", 100],
|
||||
/* null, undefined, booleans */
|
||||
|
@ -258,6 +258,9 @@ test.txt s:http h:www.example.com p:/test.txt
|
||||
\u4E2D/test.txt s:http h:www.example.com p:/%E4%B8%AD/test.txt
|
||||
http://www.example2.com s:http h:www.example2.com p:/
|
||||
//www.example2.com s:http h:www.example2.com p:/
|
||||
file:... s:file h: p:/...
|
||||
file:.. s:file h: p:/
|
||||
file:a s:file h: p:/a
|
||||
|
||||
# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
importScripts("/resources/testharness.js");
|
||||
test(function() {
|
||||
assert_equals("ÿ", "\ufffd");
|
||||
}, "Decoding invalid utf-8");
|
||||
done();
|
Loading…
Reference in New Issue
Block a user