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

Unified Diff: LayoutTests/fast/html/details-open-toggle-event.html

Issue 252373002: Add ontoggle to GlobalEventHandlers and HTML attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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: LayoutTests/fast/html/details-open-toggle-event.html
diff --git a/LayoutTests/fast/html/details-open-toggle-event.html b/LayoutTests/fast/html/details-open-toggle-event.html
index f086cb8ae6bc8cd40201f0d29331ffd131d84a12..23a68cda0d9f26e80cc40c0edf51721194bf062d 100644
--- a/LayoutTests/fast/html/details-open-toggle-event.html
+++ b/LayoutTests/fast/html/details-open-toggle-event.html
@@ -5,7 +5,7 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<details id="details">
+<details id="details" ontoggle="handleToggleEventFromHTMLAttribute(event)">
<summary>details</summary>
<input>
</details>
@@ -14,8 +14,16 @@ description("Tests that a 'toggle' event is fired asynchronously whenever the op
window.jsTestIsAsync = true;
var toggleEventCount = 0;
+var toggleEventCountFromHTMLAttribute = 0;
var testEvent;
+function handleToggleEventFromHTMLAttribute(ev) {
+ testEvent = ev;
+ shouldBe("testEvent.__proto__", "Event.prototype");
+ shouldBeEqualToString("testEvent.type", "toggle");
+ ++toggleEventCountFromHTMLAttribute;
+}
+
function handleToggleEvent(ev) {
testEvent = ev;
shouldBe("testEvent.__proto__", "Event.prototype");
@@ -25,19 +33,23 @@ function handleToggleEvent(ev) {
function checkSingleToggleEvent() {
shouldBe("toggleEventCount", "1");
+ shouldBe("toggleEventCountFromHTMLAttribute", "1");
shouldBeTrue("details.open");
testEventsCoalesced();
}
function testToogleEventFired() {
shouldBe("toggleEventCount", "0");
+ shouldBe("toggleEventCountFromHTMLAttribute", "0");
details.open = true;
shouldBe("toggleEventCount", "0");
+ shouldBe("toggleEventCountFromHTMLAttribute", "0");
setTimeout(checkSingleToggleEvent, 0);
}
function checkEventsCoalesced() {
shouldBe("toggleEventCount", "2");
+ shouldBe("toggleEventCountFromHTMLAttribute", "2");
shouldBeFalse("details.open");
finishJSTest();
}
@@ -53,6 +65,7 @@ function testEventsCoalesced() {
}
var details = document.getElementById("details");
+shouldBe("details.ontoggle.__proto__", "Function.prototype");
details.addEventListener("toggle", handleToggleEvent);
shouldBeFalse("details.open");
testToogleEventFired();
« no previous file with comments | « LayoutTests/fast/dom/global-event-handlers-expected.txt ('k') | LayoutTests/fast/html/details-open-toggle-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698