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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/html/eventhandler-attribute-non-callable.html

Issue 2120153003: Remove keyIdentifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_key_identifier_3a
Patch Set: Rebase Created 4 years, 5 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipa ge/webappapis.html#eventhandler"> 3 <link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipa ge/webappapis.html#eventhandler">
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="div"></div> 7 <div id="div"></div>
8 <script> 8 <script>
9 description("This test checks that EventHandler attributes only accept JS functi ons as input."); 9 description("This test checks that EventHandler attributes only accept JS functi ons as input.");
10 10
11 var div = document.getElementById("div"); 11 var div = document.getElementById("div");
12 var callbackCount = 0; 12 var callbackCount = 0;
13 13
14 function callback() { 14 function callback() {
15 ++callbackCount; 15 ++callbackCount;
16 } 16 }
17 17
18 function dispatchKeyEvent() 18 function dispatchKeyEvent()
19 { 19 {
20 var event = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, view: null, keyIdentifier: 'Enter' }); 20 var event = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, view: null, key: 'Enter' });
21 div.dispatchEvent(event); 21 div.dispatchEvent(event);
22 } 22 }
23 23
24 // Input is a JS function, this should work. 24 // Input is a JS function, this should work.
25 shouldBeNull('div.onkeydown'); 25 shouldBeNull('div.onkeydown');
26 shouldNotThrow('div.onkeydown = callback'); 26 shouldNotThrow('div.onkeydown = callback');
27 shouldBe('div.onkeydown', 'callback'); 27 shouldBe('div.onkeydown', 'callback');
28 shouldBe('callbackCount', '0'); 28 shouldBe('callbackCount', '0');
29 dispatchKeyEvent(); 29 dispatchKeyEvent();
30 shouldBe('callbackCount', '1'); 30 shouldBe('callbackCount', '1');
(...skipping 13 matching lines...) Expand all
44 shouldBeNull('div.onkeydown'); 44 shouldBeNull('div.onkeydown');
45 45
46 // Test null assignment. 46 // Test null assignment.
47 shouldNotThrow('div.onkeydown = callback'); 47 shouldNotThrow('div.onkeydown = callback');
48 shouldBe('div.onkeydown', 'callback'); 48 shouldBe('div.onkeydown', 'callback');
49 shouldNotThrow('div.onkeydown = null'); 49 shouldNotThrow('div.onkeydown = null');
50 shouldBeNull('div.onkeydown'); 50 shouldBeNull('div.onkeydown');
51 </script> 51 </script>
52 </body> 52 </body>
53 </html> 53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698