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

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

Issue 249573002: HTMLDetailsElement should fire a 'toggle' event (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/html/details-open-toggle-event-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipa ge/interactive-elements.html#attr-details-open">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <details id="details">
9 <summary>details</summary>
10 <input>
11 </details>
12 <script>
13 description("Tests that a 'toggle' event is fired asynchronously whenever the op en attribute is added to or removed from a details element.");
14 window.jsTestIsAsync = true;
15
16 var toggleEventCount = 0;
17
18 function handleToggleEvent(ev) {
19 testEvent = ev;
arv (Not doing code reviews) 2014/04/23 17:03:32 Please add a global var for this too.
Inactive 2014/04/23 19:19:29 Done.
20 shouldBe("testEvent.__proto__", "Event.prototype");
21 shouldBeEqualToString("testEvent.type", "toggle");
22 ++toggleEventCount;
23 }
24
25 function checkSingleToggleEvent() {
26 shouldBe("toggleEventCount", "1");
27 shouldBeTrue("details.open");
28 testEventsCoalesced();
29 }
30
31 function testToogleEventFired() {
32 shouldBe("toggleEventCount", "0");
33 details.open = true;
34 shouldBe("toggleEventCount", "0");
35 setTimeout(checkSingleToggleEvent, 0);
36 }
37
38 function checkEventsCoalesced() {
39 shouldBe("toggleEventCount", "1");
40 shouldBeFalse("details.open");
41 finishJSTest();
42 }
43
44 function testEventsCoalesced() {
45 toggleEventCount = 0;
arv (Not doing code reviews) 2014/04/23 17:03:32 I think this might read clearer if this was not re
Inactive 2014/04/23 19:19:29 Done.
46 // When the open attribute is toggled several times in succession,
47 // these steps essentially get coalesced so that only one event is
48 // fired.
49 details.open = false;
50 details.open = true;
51 details.open = false;
52 setTimeout(checkEventsCoalesced, 0);
53 }
54
55 details = document.getElementById("details");
arv (Not doing code reviews) 2014/04/23 17:03:32 missing var
Inactive 2014/04/23 19:19:29 Done.
56 details.addEventListener("toggle", handleToggleEvent);
57 shouldBeFalse("details.open");
58 testToogleEventFired();
59 </script>
60 </body>
61 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/html/details-open-toggle-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698