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

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

Issue 2503983002: MD History: Focus item checkbox when selecting/deselecting on click (Closed)
Patch Set: Add a test Created 4 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/md_history/history_item.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_history/history_item_test.js
diff --git a/chrome/test/data/webui/md_history/history_item_test.js b/chrome/test/data/webui/md_history/history_item_test.js
index e91a5f5c5ebaea73699981b82c5680bac00f4a5c..bbad622e8bf90d53578fab636035929a86ce5e1f 100644
--- a/chrome/test/data/webui/md_history/history_item_test.js
+++ b/chrome/test/data/webui/md_history/history_item_test.js
@@ -4,27 +4,62 @@
cr.define('md_history.history_item_test', function() {
function registerTests() {
- suite('history-item', function() {
- var element;
- var TEST_HISTORY_RESULTS;
- var SEARCH_HISTORY_RESULTS;
-
- suiteSetup(function() {
- TEST_HISTORY_RESULTS = [
- createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'),
- createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'),
- createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'),
- createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'),
- createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'),
- createHistoryEntry('2016-03-15 11:00', 'http://www.example.com'),
- ];
-
- SEARCH_HISTORY_RESULTS = [
- createSearchEntry('2016-03-16', "http://www.google.com"),
- createSearchEntry('2016-03-14 11:00', "http://calendar.google.com"),
- createSearchEntry('2016-03-14 10:00', "http://mail.google.com")
- ];
+ var TEST_HISTORY_RESULTS = [
+ createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'),
+ createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'),
+ createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'),
+ createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'),
+ createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'),
+ createHistoryEntry('2016-03-15 11:00', 'http://www.example.com'),
+ ];
+
+ var SEARCH_HISTORY_RESULTS = [
+ createSearchEntry('2016-03-16', "http://www.google.com"),
+ createSearchEntry('2016-03-14 11:00', "http://calendar.google.com"),
+ createSearchEntry('2016-03-14 10:00', "http://mail.google.com")
+ ];
+
+ suite('<history-item> unit test', function() {
+ var item;
+
+ setup(function() {
+ item = document.createElement('history-item');
+ item.item = TEST_HISTORY_RESULTS[0];
+ replaceBody(item);
+ });
+
+ test('click targets for selection', function() {
+ var selectionCount = 0;
+ item.addEventListener('history-checkbox-select', function() {
+ selectionCount++;
+ });
+
+ // Checkbox should trigger selection.
+ MockInteractions.tap(item.$.checkbox);
+ assertEquals(1, selectionCount);
+
+ // Non-interactive text should trigger selection.
+ MockInteractions.tap(item.$['time-accessed']);
+ assertEquals(2, selectionCount);
+
+ // Menu button should not trigger selection.
+ MockInteractions.tap(item.$['menu-button']);
+ assertEquals(2, selectionCount);
+ });
+
+ test('refocus checkbox on click', function() {
+ return PolymerTest.flushTasks().then(function() {
+ item.$['menu-button'].focus();
+ assertEquals(item.$['menu-button'], item.root.activeElement);
+
+ MockInteractions.tap(item.$['time-accessed']);
+ assertEquals(item.$['checkbox'], item.root.activeElement);
+ });
});
+ });
+
+ suite('<history-item> integration test', function() {
+ var element;
setup(function() {
element = replaceApp().$['history'].$['infinite-list'];
@@ -99,29 +134,6 @@ cr.define('md_history.history_item_test', function() {
assertEquals(element.historyData_[5].starred, false);
});
});
-
- test('click targets for selection', function() {
- var item = document.createElement('history-item');
- var selectionCount = 0;
- item.item = TEST_HISTORY_RESULTS[0];
- item.addEventListener('history-checkbox-select', function() {
- selectionCount++;
- });
-
- replaceBody(item);
-
- // Checkbox should trigger selection.
- MockInteractions.tap(item.$.checkbox);
- assertEquals(1, selectionCount);
-
- // Non-interactive text should trigger selection.
- MockInteractions.tap(item.$['time-accessed']);
- assertEquals(2, selectionCount);
-
- // Menu button should not trigger selection.
- MockInteractions.tap(item.$['menu-button']);
- assertEquals(2, selectionCount);
- });
});
}
return {
« no previous file with comments | « chrome/browser/resources/md_history/history_item.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698