Chromium Code Reviews| 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 7b5ab0de1912ed9f36aa7ccecb79a11cdce1d5ec..ea928489e9375e4f604dc9bca0f3c5dbb4c90dc6 100644 |
| --- a/chrome/test/data/webui/md_history/history_item_test.js |
| +++ b/chrome/test/data/webui/md_history/history_item_test.js |
| @@ -10,7 +10,6 @@ cr.define('md_history.history_item_test', function() { |
| var SEARCH_HISTORY_RESULTS; |
| suiteSetup(function() { |
| - element = $('history-app').$['history'].$['infinite-list']; |
| TEST_HISTORY_RESULTS = [ |
| createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'), |
| createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'), |
| @@ -27,6 +26,10 @@ cr.define('md_history.history_item_test', function() { |
| ]; |
| }); |
| + setup(function() { |
| + element = replaceApp().$['history'].$['infinite-list']; |
| + }); |
| + |
| test('basic separator insertion', function() { |
| element.addNewResults(TEST_HISTORY_RESULTS); |
| return PolymerTest.flushTasks().then(function() { |
| @@ -97,9 +100,31 @@ cr.define('md_history.history_item_test', function() { |
| }); |
| }); |
| - teardown(function() { |
| - element.historyData_ = []; |
| - element.searchedTerm = ''; |
| + 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); |
| + |
| + // <a> link should not trigger selection. |
| + MockInteractions.tap(item.$['title']); |
|
calamity
2016/10/14 10:56:20
Does this actually trigger a navigate off the page
tsergeant
2016/11/02 04:41:35
...huh, it actually does. I didn't expect MockInte
|
| + assertEquals(2, selectionCount); |
| }); |
| }); |
| } |