Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html

Issue 1854003004: Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html
index 43a6331ba08c3fb73a68e45a5e0d241eb624a0b6..286df98706d6ad63c676153249837a5635398462 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/Event-dispatch-bubbles-false.html
@@ -19,32 +19,21 @@
</tbody>
</table>
<script>
-test(function() {
- var event_type = "click";
- var target = document.getElementById("target");
- var targets = [
- window,
+function targetsForDocumentChain(document) {
+ return [
document,
document.documentElement,
- document.body,
+ document.getElementsByTagName("body")[0],
document.getElementById("table"),
document.getElementById("table-body"),
- document.getElementById("parent"),
- target,
- ];
- var expected_targets = targets.concat(target);
- var phases = [
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.CAPTURING_PHASE,
- Event.AT_TARGET,
- Event.AT_TARGET,
+ document.getElementById("parent")
];
+}
+function testChain(document, targetParents, phases, event_type) {
+ var target = document.getElementById("target");
+ var targets = targetParents.concat(target);
+ var expected_targets = targets.concat(target);
var actual_targets = [], actual_phases = [];
var test_event = function(evt) {
@@ -64,5 +53,46 @@ test(function() {
assert_array_equals(actual_targets, expected_targets, "targets");
assert_array_equals(actual_phases, phases, "phases");
-}, "Event.dispatchEvent with Event.bubbles set to false.");
+}
+
+var phasesForDocumentChain = [
+ Event.CAPTURING_PHASE,
+ Event.CAPTURING_PHASE,
+ Event.CAPTURING_PHASE,
+ Event.CAPTURING_PHASE,
+ Event.CAPTURING_PHASE,
+ Event.CAPTURING_PHASE,
+ Event.AT_TARGET,
+ Event.AT_TARGET,
+];
+
+test(function () {
+ var chainWithWindow = [window].concat(targetsForDocumentChain(document));
+ testChain(
+ document, chainWithWindow, [Event.CAPTURING_PHASE].concat(phasesForDocumentChain), "click");
+}, "In window.document with click event");
+
+test(function () {
+ testChain(document, targetsForDocumentChain(document), phasesForDocumentChain, "load");
+}, "In window.document with load event")
+
+test(function () {
+ var documentClone = document.cloneNode(true);
+ testChain(
+ documentClone, targetsForDocumentChain(documentClone), phasesForDocumentChain, "click");
+}, "In window.document.cloneNode(true)");
+
+test(function () {
+ var newDocument = new Document();
+ newDocument.appendChild(document.documentElement.cloneNode(true));
+ testChain(
+ newDocument, targetsForDocumentChain(newDocument), phasesForDocumentChain, "click");
+}, "In new Document()");
+
+test(function () {
+ var HTMLDocument = document.implementation.createHTMLDocument();
+ HTMLDocument.body.appendChild(document.getElementById("table").cloneNode(true));
+ testChain(
+ HTMLDocument, targetsForDocumentChain(HTMLDocument), phasesForDocumentChain, "click");
+}, "In DOMImplementation.createHTMLDocument()");
</script>

Powered by Google App Engine
This is Rietveld 408576698