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