| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('md_history.history_item_test', function() { | 5 cr.define('md_history.history_item_test', function() { |
| 6 function registerTests() { | 6 function registerTests() { |
| 7 suite('history-item', function() { | 7 suite('history-item', function() { |
| 8 var element; | 8 var element; |
| 9 var TEST_HISTORY_RESULTS; | 9 var TEST_HISTORY_RESULTS; |
| 10 var SEARCH_HISTORY_RESULTS; | 10 var SEARCH_HISTORY_RESULTS; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 element.removeDeletedHistory_([element.historyData_[3]]); | 72 element.removeDeletedHistory_([element.historyData_[3]]); |
| 73 | 73 |
| 74 // Checks time gap separator is removed. | 74 // Checks time gap separator is removed. |
| 75 assertFalse(items[2].hasTimeGap); | 75 assertFalse(items[2].hasTimeGap); |
| 76 }); | 76 }); |
| 77 }); | 77 }); |
| 78 | 78 |
| 79 test('remove bookmarks', function() { | 79 test('remove bookmarks', function() { |
| 80 element.addNewResults(TEST_HISTORY_RESULTS); | 80 element.addNewResults(TEST_HISTORY_RESULTS); |
| 81 return flush().then(function() { | 81 return flush().then(function() { |
| 82 element.historyData_[1].starred = true; | 82 element.set('historyData_.1.starred', true); |
| 83 element.historyData_[5].starred = true; | 83 element.set('historyData_.5.starred', true); |
| 84 | 84 |
| 85 items = Polymer.dom(element.root).querySelectorAll('history-item'); | 85 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 86 MockInteractions.tap(items[1].$$('#bookmark-star')); | |
| 87 | 86 |
| 87 items[1].$['bookmark-star'].focus(); |
| 88 MockInteractions.tap(items[1].$['bookmark-star']); |
| 89 |
| 90 // Check that focus is shifted to overflow menu icon. |
| 91 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); |
| 92 // Check that all items matching this url are unstarred. |
| 88 assertEquals(element.historyData_[1].starred, false); | 93 assertEquals(element.historyData_[1].starred, false); |
| 89 assertEquals(element.historyData_[5].starred, false); | 94 assertEquals(element.historyData_[5].starred, false); |
| 95 assertEquals( |
| 96 window.getComputedStyle(items[1].$['bookmark-star']).visibility, |
| 97 'hidden'); |
| 98 assertEquals( |
| 99 window.getComputedStyle(items[5].$['bookmark-star']).visibility, |
| 100 'hidden'); |
| 90 }); | 101 }); |
| 91 }); | 102 }); |
| 92 | 103 |
| 93 test('long titles are trimmed', function() { | 104 test('long titles are trimmed', function() { |
| 94 var item = document.createElement('history-item'); | 105 var item = document.createElement('history-item'); |
| 95 var longtitle = '0123456789'.repeat(100); | 106 var longtitle = '0123456789'.repeat(100); |
| 96 item.item = | 107 item.item = |
| 97 createHistoryEntry('2016-06-30', 'http://example.com/' + longtitle); | 108 createHistoryEntry('2016-06-30', 'http://example.com/' + longtitle); |
| 98 | 109 |
| 99 var label = item.$$('history-searched-label'); | 110 var label = item.$$('history-searched-label'); |
| 100 assertEquals(TITLE_MAX_LENGTH, label.title.length); | 111 assertEquals(TITLE_MAX_LENGTH, label.title.length); |
| 101 }); | 112 }); |
| 102 | 113 |
| 103 teardown(function() { | 114 teardown(function() { |
| 104 element.historyData_ = []; | 115 element.historyData_ = []; |
| 105 element.searchedTerm = ''; | 116 element.searchedTerm = ''; |
| 106 }); | 117 }); |
| 107 }); | 118 }); |
| 108 } | 119 } |
| 109 return { | 120 return { |
| 110 registerTests: registerTests | 121 registerTests: registerTests |
| 111 }; | 122 }; |
| 112 }); | 123 }); |
| OLD | NEW |