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

Unified Diff: chrome/test/data/webui/md_history/history_overflow_menu_test.js

Issue 1648803003: MD History: Drop-down menu allows searching for history-items by domain name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@search_functionality
Patch Set: Address reviewer comments and small fixes. Created 4 years, 10 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: chrome/test/data/webui/md_history/history_overflow_menu_test.js
diff --git a/chrome/test/data/webui/md_history/history_overflow_menu_test.js b/chrome/test/data/webui/md_history/history_overflow_menu_test.js
index 894bf857df241e10f72f46702e061195a97a4313..c06cd7b5270b2ae03c01a569c8faf5296790c54f 100644
--- a/chrome/test/data/webui/md_history/history_overflow_menu_test.js
+++ b/chrome/test/data/webui/md_history/history_overflow_menu_test.js
@@ -3,63 +3,63 @@
// found in the LICENSE file.
cr.define('md_history.history_overflow_menu_test', function() {
- // Menu button event.
- var MENU_EVENT = {
- detail: {
- accessTime: 1
- }
- };
-
- var ADDITIONAL_MENU_EVENT = {
- detail: {
- accessTime: 2
- }
- };
-
function registerTests() {
suite('#overflow-menu', function() {
var element;
+ var items;
- suiteSetup(function() {
+ suiteSetup(function(done) {
element = $('history-card-manager');
+ var historyItems = [];
+ historyItems.push(createHistoryEntry(345600000, "https://example.com"));
+ historyItems.push(createHistoryEntry(345601000, "https://google.com"));
+
+ element.addNewResults(historyItems, '');
+
+ flush(function() {
+ var card = element.$$('history-card');
+ items = Polymer.dom(card.root).querySelectorAll('history-item');
+ done();
+ });
});
test('opening and closing menu', function() {
- element.toggleMenu_(MENU_EVENT);
+ MockInteractions.tap(items[0].$['menu-button']);
assertEquals(true, element.menuOpen);
- assertEquals(1, element.menuIdentifier);
+ assertEquals("https://example.com", element.menuIdentifier.url);
// Test having the same menu event (pressing the same button) closes the
// overflow menu.
- element.toggleMenu_(MENU_EVENT);
+ MockInteractions.tap(items[0].$['menu-button']);
assertEquals(false, element.menuOpen);
// Test having consecutive distinct menu events moves the menu to the
// new button.
- element.toggleMenu_(MENU_EVENT);
- element.toggleMenu_(ADDITIONAL_MENU_EVENT);
- assertEquals(2, element.menuIdentifier);
+ MockInteractions.tap(items[0].$['menu-button']);
+ MockInteractions.tap(items[1].$['menu-button']);
+ assertEquals("https://google.com", element.menuIdentifier.url);
assertEquals(true, element.menuOpen);
- element.toggleMenu_(MENU_EVENT);
+ MockInteractions.tap(items[0].$['menu-button']);
assertEquals(true, element.menuOpen);
- assertEquals(1, element.menuIdentifier);
+ assertEquals("https://example.com", element.menuIdentifier.url);
element.closeMenu();
assertEquals(false, element.menuOpen);
- assertEquals(1, element.menuIdentifier);
+ assertEquals("https://example.com", element.menuIdentifier.url);
});
test('keyboard input for closing menu', function() {
// Test that pressing escape on the document closes the menu. In the
// actual page, it will take two presses to close the menu due to focus.
// TODO(yingran): Fix this behavior to only require one key press.
- element.toggleMenu_(MENU_EVENT);
+ MockInteractions.tap(items[0].$['menu-button']);
MockInteractions.pressAndReleaseKeyOn(document, 27);
assertEquals(false, element.menuOpen);
});
teardown(function() {
- element.menuIdentifier = 0;
+ element.menuIdentifier = {};
+ element.closeMenu();
});
});
}

Powered by Google App Engine
This is Rietveld 408576698