| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 MockInteractions.tap(items[1].$$('#bookmark-star')); | 90 MockInteractions.tap(items[1].$$('#bookmark-star')); |
| 91 | 91 |
| 92 // Check that focus is shifted to overflow menu icon. | 92 // Check that focus is shifted to overflow menu icon. |
| 93 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); | 93 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); |
| 94 // Check that all items matching this url are unstarred. | 94 // Check that all items matching this url are unstarred. |
| 95 assertEquals(element.historyData_[1].starred, false); | 95 assertEquals(element.historyData_[1].starred, false); |
| 96 assertEquals(element.historyData_[5].starred, false); | 96 assertEquals(element.historyData_[5].starred, false); |
| 97 }); | 97 }); |
| 98 }); | 98 }); |
| 99 | 99 |
| 100 test('long titles are trimmed', function() { | |
| 101 var item = document.createElement('history-item'); | |
| 102 var longtitle = '0123456789'.repeat(100); | |
| 103 item.item = | |
| 104 createHistoryEntry('2016-06-30', 'http://example.com/' + longtitle); | |
| 105 | |
| 106 var label = item.$$('history-searched-label'); | |
| 107 assertEquals(TITLE_MAX_LENGTH, label.title.length); | |
| 108 }); | |
| 109 | |
| 110 teardown(function() { | 100 teardown(function() { |
| 111 element.historyData_ = []; | 101 element.historyData_ = []; |
| 112 element.searchedTerm = ''; | 102 element.searchedTerm = ''; |
| 113 }); | 103 }); |
| 114 }); | 104 }); |
| 115 } | 105 } |
| 116 return { | 106 return { |
| 117 registerTests: registerTests | 107 registerTests: registerTests |
| 118 }; | 108 }; |
| 119 }); | 109 }); |
| OLD | NEW |