| 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() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Change to a folder. | 38 // Change to a folder. |
| 39 item.itemId = '1'; | 39 item.itemId = '1'; |
| 40 | 40 |
| 41 assertFalse(item.$['folder-icon'].hidden); | 41 assertFalse(item.$['folder-icon'].hidden); |
| 42 assertTrue(item.$.icon.hidden); | 42 assertTrue(item.$.icon.hidden); |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 test('pressing the menu button selects the item', function() { | 45 test('pressing the menu button selects the item', function() { |
| 46 MockInteractions.tap(item.$$('.more-vert-button')); | 46 MockInteractions.tap(item.$$('.more-vert-button')); |
| 47 assertDeepEquals( | 47 assertDeepEquals( |
| 48 bookmarks.actions.selectItem('2', false, false, store.data), | 48 bookmarks.actions.selectItem('2', store.data, { |
| 49 clear: true, |
| 50 range: false, |
| 51 toggle: false, |
| 52 }), |
| 49 store.lastAction); | 53 store.lastAction); |
| 50 }); | 54 }); |
| 51 | 55 |
| 52 test('context menu selects item if unselected', function() { | 56 test('context menu selects item if unselected', function() { |
| 53 item.isSelectedItem_ = true; | 57 item.isSelectedItem_ = true; |
| 54 item.dispatchEvent(new MouseEvent('contextmenu')); | 58 item.dispatchEvent(new MouseEvent('contextmenu')); |
| 55 assertEquals(null, store.lastAction); | 59 assertEquals(null, store.lastAction); |
| 56 | 60 |
| 57 item.isSelectedItem_ = false; | 61 item.isSelectedItem_ = false; |
| 58 item.dispatchEvent(new MouseEvent('contextmenu')); | 62 item.dispatchEvent(new MouseEvent('contextmenu')); |
| 59 assertDeepEquals( | 63 assertDeepEquals( |
| 60 bookmarks.actions.selectItem('2', false, false, store.data), | 64 bookmarks.actions.selectItem('2', store.data, { |
| 65 clear: true, |
| 66 range: false, |
| 67 toggle: false, |
| 68 }), |
| 61 store.lastAction); | 69 store.lastAction); |
| 62 }); | 70 }); |
| 63 | 71 |
| 64 test('anchor tag updates with item url', function() { | 72 test('anchor tag updates with item url', function() { |
| 65 assertEquals('http://example.com/', item.$.url.href); | 73 assertEquals('http://example.com/', item.$.url.href); |
| 66 | 74 |
| 67 store.data.nodes['2'] = createItem('0', {url: 'https://mail.google.com'}); | 75 store.data.nodes['2'] = createItem('0', {url: 'https://mail.google.com'}); |
| 68 store.notifyObservers(); | 76 store.notifyObservers(); |
| 69 assertEquals('https://mail.google.com/', item.$.url.href); | 77 assertEquals('https://mail.google.com/', item.$.url.href); |
| 70 | 78 |
| 71 // Change to a folder. | 79 // Change to a folder. |
| 72 item.itemId = '1'; | 80 item.itemId = '1'; |
| 73 assertEquals('chrome://bookmarks/?id=1', item.$.url.href); | 81 assertEquals('chrome://bookmarks/?id=1', item.$.url.href); |
| 74 }); | 82 }); |
| 75 }); | 83 }); |
| OLD | NEW |