| 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 suite('<bookmarks-item>', function() { | 5 suite('<bookmarks-item>', function() { |
| 6 var item; | 6 var item; |
| 7 var store; | 7 var store; |
| 8 var TEST_ITEM = createItem('0'); | 8 var TEST_ITEM = createItem('0'); |
| 9 | 9 |
| 10 setup(function() { | 10 setup(function() { |
| 11 store = new bookmarks.TestStore({ | 11 store = new bookmarks.TestStore({ |
| 12 nodes: testTree(createFolder( | 12 nodes: testTree(createFolder( |
| 13 '1', | 13 '1', |
| 14 [ | 14 [ |
| 15 createItem(['2']), | 15 createItem('2', {url: 'http://example.com/'}), |
| 16 createItem(['3']), | 16 createItem('3'), |
| 17 ])), | 17 ])), |
| 18 }); | 18 }); |
| 19 bookmarks.Store.instance_ = store; | 19 bookmarks.Store.instance_ = store; |
| 20 | 20 |
| 21 item = document.createElement('bookmarks-item'); | 21 item = document.createElement('bookmarks-item'); |
| 22 item.itemId = '2'; | 22 item.itemId = '2'; |
| 23 replaceBody(item); | 23 replaceBody(item); |
| 24 }); | 24 }); |
| 25 | 25 |
| 26 test('changing the url changes the favicon', function() { | 26 test('changing the url changes the favicon', function() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 item.isSelectedItem_ = true; | 53 item.isSelectedItem_ = true; |
| 54 item.dispatchEvent(new MouseEvent('contextmenu')); | 54 item.dispatchEvent(new MouseEvent('contextmenu')); |
| 55 assertEquals(null, store.lastAction); | 55 assertEquals(null, store.lastAction); |
| 56 | 56 |
| 57 item.isSelectedItem_ = false; | 57 item.isSelectedItem_ = false; |
| 58 item.dispatchEvent(new MouseEvent('contextmenu')); | 58 item.dispatchEvent(new MouseEvent('contextmenu')); |
| 59 assertDeepEquals( | 59 assertDeepEquals( |
| 60 bookmarks.actions.selectItem('2', false, false, store.data), | 60 bookmarks.actions.selectItem('2', false, false, store.data), |
| 61 store.lastAction); | 61 store.lastAction); |
| 62 }); | 62 }); |
| 63 |
| 64 test('anchor tag updates with item url', function() { |
| 65 assertEquals('http://example.com/', item.$.url.href); |
| 66 |
| 67 store.data.nodes['2'] = createItem('0', {url: 'https://mail.google.com'}); |
| 68 store.notifyObservers(); |
| 69 assertEquals('https://mail.google.com/', item.$.url.href); |
| 70 |
| 71 // Change to a folder. |
| 72 item.itemId = '1'; |
| 73 assertEquals('chrome://bookmarks/?id=1', item.$.url.href); |
| 74 }); |
| 63 }); | 75 }); |
| OLD | NEW |