| 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 var TEST_HISTORY_RESULTS = [ | 5 var TEST_HISTORY_RESULTS = [ |
| 6 createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'), | 6 createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'), |
| 7 createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'), | 7 createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'), |
| 8 createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'), | 8 createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'), |
| 9 createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'), | 9 createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'), |
| 10 createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'), | 10 createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 MockInteractions.tap(item.$['time-accessed']); | 53 MockInteractions.tap(item.$['time-accessed']); |
| 54 assertEquals(item.$['checkbox'], item.root.activeElement); | 54 assertEquals(item.$['checkbox'], item.root.activeElement); |
| 55 }); | 55 }); |
| 56 }); | 56 }); |
| 57 }); | 57 }); |
| 58 | 58 |
| 59 suite('<history-item> integration test', function() { | 59 suite('<history-item> integration test', function() { |
| 60 var element; | 60 var element; |
| 61 | 61 |
| 62 setup(function() { | 62 setup(function() { |
| 63 element = replaceApp().$['history'].$['infinite-list']; | 63 element = replaceApp().$.history; |
| 64 }); | 64 }); |
| 65 | 65 |
| 66 test('basic separator insertion', function() { | 66 test('basic separator insertion', function() { |
| 67 element.addNewResults(TEST_HISTORY_RESULTS); | 67 element.addNewResults(TEST_HISTORY_RESULTS); |
| 68 return PolymerTest.flushTasks().then(function() { | 68 return PolymerTest.flushTasks().then(function() { |
| 69 // Check that the correct number of time gaps are inserted. | 69 // Check that the correct number of time gaps are inserted. |
| 70 var items = Polymer.dom(element.root).querySelectorAll('history-item'); | 70 var items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 71 | 71 |
| 72 assertTrue(items[0].hasTimeGap); | 72 assertTrue(items[0].hasTimeGap); |
| 73 assertTrue(items[1].hasTimeGap); | 73 assertTrue(items[1].hasTimeGap); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 89 assertFalse(items[1].hasTimeGap); | 89 assertFalse(items[1].hasTimeGap); |
| 90 assertFalse(items[2].hasTimeGap); | 90 assertFalse(items[2].hasTimeGap); |
| 91 }); | 91 }); |
| 92 }); | 92 }); |
| 93 | 93 |
| 94 test('separator insertion after deletion', function() { | 94 test('separator insertion after deletion', function() { |
| 95 element.addNewResults(TEST_HISTORY_RESULTS); | 95 element.addNewResults(TEST_HISTORY_RESULTS); |
| 96 return PolymerTest.flushTasks().then(function() { | 96 return PolymerTest.flushTasks().then(function() { |
| 97 var items = Polymer.dom(element.root).querySelectorAll('history-item'); | 97 var items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 98 | 98 |
| 99 element.removeItemsByPath(['historyData_.3']); | 99 element.removeItemsByIndex_([3]); |
| 100 assertEquals(5, element.historyData_.length); | 100 assertEquals(5, element.historyData_.length); |
| 101 | 101 |
| 102 // Checks that a new time gap separator has been inserted. | 102 // Checks that a new time gap separator has been inserted. |
| 103 assertTrue(items[2].hasTimeGap); | 103 assertTrue(items[2].hasTimeGap); |
| 104 | 104 |
| 105 element.removeItemsByPath(['historyData_.3']); | 105 element.removeItemsByIndex_([3]); |
| 106 | 106 |
| 107 // Checks time gap separator is removed. | 107 // Checks time gap separator is removed. |
| 108 assertFalse(items[2].hasTimeGap); | 108 assertFalse(items[2].hasTimeGap); |
| 109 }); | 109 }); |
| 110 }); | 110 }); |
| 111 | 111 |
| 112 test('remove bookmarks', function() { | 112 test('remove bookmarks', function() { |
| 113 element.addNewResults(TEST_HISTORY_RESULTS); | 113 element.addNewResults(TEST_HISTORY_RESULTS); |
| 114 return PolymerTest.flushTasks().then(function() { | 114 return PolymerTest.flushTasks().then(function() { |
| 115 element.set('historyData_.1.starred', true); | 115 element.set('historyData_.1.starred', true); |
| 116 element.set('historyData_.5.starred', true); | 116 element.set('historyData_.5.starred', true); |
| 117 return PolymerTest.flushTasks(); | 117 return PolymerTest.flushTasks(); |
| 118 }).then(function() { | 118 }).then(function() { |
| 119 | 119 |
| 120 items = Polymer.dom(element.root).querySelectorAll('history-item'); | 120 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 121 | 121 |
| 122 items[1].$$('#bookmark-star').focus(); | 122 items[1].$$('#bookmark-star').focus(); |
| 123 MockInteractions.tap(items[1].$$('#bookmark-star')); | 123 MockInteractions.tap(items[1].$$('#bookmark-star')); |
| 124 | 124 |
| 125 // Check that focus is shifted to overflow menu icon. | 125 // Check that focus is shifted to overflow menu icon. |
| 126 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); | 126 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); |
| 127 // Check that all items matching this url are unstarred. | 127 // Check that all items matching this url are unstarred. |
| 128 assertEquals(element.historyData_[1].starred, false); | 128 assertEquals(element.historyData_[1].starred, false); |
| 129 assertEquals(element.historyData_[5].starred, false); | 129 assertEquals(element.historyData_[5].starred, false); |
| 130 }); | 130 }); |
| 131 }); | 131 }); |
| 132 }); | 132 }); |
| OLD | NEW |