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

Unified Diff: chrome/test/data/webui/history_browsertest.js

Issue 685783003: history: fix more focus oddness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arv@ review Created 6 years, 1 month 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 | « chrome/browser/resources/history/history.js ('k') | ui/webui/resources/js/cr/ui/focus_grid.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/history_browsertest.js
diff --git a/chrome/test/data/webui/history_browsertest.js b/chrome/test/data/webui/history_browsertest.js
index bcaf7810f773256a65db22ff76f6c71b37b510b0..aa5e9977e1e845b62374a59eec85a3d3a11b080a 100644
--- a/chrome/test/data/webui/history_browsertest.js
+++ b/chrome/test/data/webui/history_browsertest.js
@@ -909,6 +909,59 @@ TEST_F('HistoryWebUIRealBackendTest', 'showConfirmDialogAndRemove', function() {
assertFalse($('alertOverlay').classList.contains('showing'));
});
+TEST_F('HistoryWebUIRealBackendTest', 'menuButtonActivatesOneRow', function() {
+ var entries = document.querySelectorAll('.entry');
+ assertEquals(3, entries.length);
+ assertTrue(entries[0].classList.contains('active'));
+ assertTrue($('action-menu').hidden);
+
+ // Show the menu via mousedown on the menu button.
+ var menuButton = entries[2].querySelector('.menu-button');
+ menuButton.dispatchEvent(new MouseEvent('mousedown'));
+ expectFalse($('action-menu').hidden);
+
+ // Check that the 'active' item hasn't changed.
+ expectTrue(entries[0].classList.contains('active'));
+ expectFalse(entries[2].classList.contains('active'));
+
+ testDone();
+});
+
+TEST_F('HistoryWebUIRealBackendTest', 'shiftClickActivatesOneRow', function() {
+ var entries = document.querySelectorAll('.entry');
+ assertEquals(3, entries.length);
+ assertTrue(entries[0].classList.contains('active'));
+
+ entries[0].visit.checkBox.focus();
+ assertEquals(entries[0].visit.checkBox, document.activeElement);
+
+ entries[0].visit.checkBox.click();
+ assertTrue(entries[0].visit.checkBox.checked);
+
+ var entryBox = entries[2].querySelector('.entry-box');
+ entryBox.dispatchEvent(new MouseEvent('click', {shiftKey: true}));
+ assertTrue(entries[1].visit.checkBox.checked);
+
+ // Focus shouldn't have changed, but the checkbox should toggle.
+ expectEquals(entries[0].visit.checkBox, document.activeElement);
+
+ expectTrue(entries[0].classList.contains('active'));
+ expectFalse(entries[2].classList.contains('active'));
+
+ var shiftDown = new MouseEvent('mousedown', {shiftKey: true, bubbles: true});
+ entries[2].visit.checkBox.dispatchEvent(shiftDown);
+ expectEquals(entries[2].visit.checkBox, document.activeElement);
+
+ // 'focusin' events aren't dispatched while tests are run in batch (e.g.
+ // --test-launcher-jobs=2). Simulate this. TODO(dbeam): fix instead.
+ cr.dispatchSimpleEvent(document.activeElement, 'focusin', true, true);
+
+ expectFalse(entries[0].classList.contains('active'));
+ expectTrue(entries[2].classList.contains('active'));
+
+ testDone();
+});
+
/**
* Fixture for History WebUI testing when deletions are prohibited.
* @extends {HistoryWebUIRealBackendTest}
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | ui/webui/resources/js/cr/ui/focus_grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698