| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Checks that a new time gap separator has been inserted. | 69 // Checks that a new time gap separator has been inserted. |
| 70 assertTrue(items[2].hasTimeGap); | 70 assertTrue(items[2].hasTimeGap); |
| 71 | 71 |
| 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() { |
| 80 element.addNewResults(TEST_HISTORY_RESULTS); |
| 81 return flush().then(function() { |
| 82 element.historyData_[1].starred = true; |
| 83 element.historyData_[5].starred = true; |
| 84 |
| 85 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 86 MockInteractions.tap(items[1].$$('#bookmark-star')); |
| 87 |
| 88 assertEquals(element.historyData_[1].starred, false); |
| 89 assertEquals(element.historyData_[5].starred, false); |
| 90 }); |
| 91 }); |
| 92 |
| 79 test('long titles are trimmed', function() { | 93 test('long titles are trimmed', function() { |
| 80 var item = document.createElement('history-item'); | 94 var item = document.createElement('history-item'); |
| 81 var longtitle = '0123456789'.repeat(100); | 95 var longtitle = '0123456789'.repeat(100); |
| 82 item.item = | 96 item.item = |
| 83 createHistoryEntry('2016-06-30', 'http://example.com/' + longtitle); | 97 createHistoryEntry('2016-06-30', 'http://example.com/' + longtitle); |
| 84 | 98 |
| 85 var label = item.$$('history-searched-label'); | 99 var label = item.$$('history-searched-label'); |
| 86 assertEquals(TITLE_MAX_LENGTH, label.title.length); | 100 assertEquals(TITLE_MAX_LENGTH, label.title.length); |
| 87 }); | 101 }); |
| 88 | 102 |
| 89 teardown(function() { | 103 teardown(function() { |
| 90 element.historyData_ = []; | 104 element.historyData_ = []; |
| 91 element.searchedTerm = ''; | 105 element.searchedTerm = ''; |
| 92 }); | 106 }); |
| 93 }); | 107 }); |
| 94 } | 108 } |
| 95 return { | 109 return { |
| 96 registerTests: registerTests | 110 registerTests: registerTests |
| 97 }; | 111 }; |
| 98 }); | 112 }); |
| OLD | NEW |