| 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('1', [createItem(['0'])])), | 12 nodes: testTree(createFolder('1', [createItem(['2'])])), |
| 13 }); | 13 }); |
| 14 bookmarks.Store.instance_ = store; | 14 bookmarks.Store.instance_ = store; |
| 15 | 15 |
| 16 item = document.createElement('bookmarks-item'); | 16 item = document.createElement('bookmarks-item'); |
| 17 item.itemId = '0'; | 17 item.itemId = '2'; |
| 18 replaceBody(item); | 18 replaceBody(item); |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 test('changing the url changes the favicon', function() { | 21 test('changing the url changes the favicon', function() { |
| 22 var favicon = item.$.icon.style.backgroundImage; | 22 var favicon = item.$.icon.style.backgroundImage; |
| 23 store.data.nodes['0'] = createItem('0', {url: 'https://mail.google.com'}); | 23 store.data.nodes['2'] = createItem('0', {url: 'https://mail.google.com'}); |
| 24 store.notifyObservers(); | 24 store.notifyObservers(); |
| 25 assertNotEquals(favicon, item.$.icon.style.backgroundImage); | 25 assertNotEquals(favicon, item.$.icon.style.backgroundImage); |
| 26 }); | 26 }); |
| 27 | 27 |
| 28 test('changing to folder hides/unhides the folder/icon', function() { | 28 test('changing to folder hides/unhides the folder/icon', function() { |
| 29 // Starts test as an item. | 29 // Starts test as an item. |
| 30 assertTrue(item.$['folder-icon'].hidden); | 30 assertTrue(item.$['folder-icon'].hidden); |
| 31 assertFalse(item.$.icon.hidden); | 31 assertFalse(item.$.icon.hidden); |
| 32 | 32 |
| 33 // Change to a folder. | 33 // Change to a folder. |
| 34 item.itemId = '1'; | 34 item.itemId = '1'; |
| 35 | 35 |
| 36 assertFalse(item.$['folder-icon'].hidden); | 36 assertFalse(item.$['folder-icon'].hidden); |
| 37 assertTrue(item.$.icon.hidden); | 37 assertTrue(item.$.icon.hidden); |
| 38 }); | 38 }); |
| 39 }); | 39 }); |
| OLD | NEW |