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

Unified Diff: chrome/browser/ui/webui/options/options_browsertest.js

Issue 22268005: Prevent overlay enter events from executing two buttons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added test Created 7 years, 4 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
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/overlay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/options_browsertest.js
diff --git a/chrome/browser/ui/webui/options/options_browsertest.js b/chrome/browser/ui/webui/options/options_browsertest.js
index 5fa7932896feaad293cc1ad9c7a8d3008bfd6770..39ef88c9dccc5eccc649f9c6602ef5bbe6bf75e3 100644
--- a/chrome/browser/ui/webui/options/options_browsertest.js
+++ b/chrome/browser/ui/webui/options/options_browsertest.js
@@ -232,6 +232,22 @@ TEST_F('OptionsWebUITest', 'EnableAndDisableDoNotTrack', function() {
dntCheckbox.click();
});
+// Verify that preventDefault() is called on 'Enter' keydown events that trigger
+// the default button.
Dan Beam 2013/08/06 00:53:32 nit: explain why you want to ensure preventDefault
Rune Fevang 2013/08/06 00:58:02 Done.
+TEST_F('OptionsWebUITest', 'EnterPreventsDefault', function() {
+ var page = HomePageOverlay.getInstance();
+ OptionsPage.showPageByName(page.name);
+ var event = new KeyboardEvent('keydown', {
+ 'bubbles': true,
+ 'cancelable': true,
+ 'keyIdentifier': 'Enter'
+ });
+ assertFalse(event.defaultPrevented);
+ page.pageDiv.dispatchEvent(event);
+ assertTrue(event.defaultPrevented);
+ testDone();
+});
+
/**
* TestFixture for OptionsPage WebUI testing including tab history.
* @extends {testing.Test}
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698