| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 MockInteractions.tap(item.$$('.more-vert-button')); | 46 MockInteractions.tap(item.$$('.more-vert-button')); |
| 47 assertDeepEquals( | 47 assertDeepEquals( |
| 48 bookmarks.actions.selectItem('2', store.data, { | 48 bookmarks.actions.selectItem('2', store.data, { |
| 49 clear: true, | 49 clear: true, |
| 50 range: false, | 50 range: false, |
| 51 toggle: false, | 51 toggle: false, |
| 52 }), | 52 }), |
| 53 store.lastAction); | 53 store.lastAction); |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 test('context menu selects item if unselected', function() { | 56 function testEventSelection(eventname) { |
| 57 item.isSelectedItem_ = true; | 57 item.isSelectedItem_ = true; |
| 58 item.dispatchEvent(new MouseEvent('contextmenu')); | 58 item.dispatchEvent(new MouseEvent(eventname)); |
| 59 assertEquals(null, store.lastAction); | 59 assertEquals(null, store.lastAction); |
| 60 | 60 |
| 61 item.isSelectedItem_ = false; | 61 item.isSelectedItem_ = false; |
| 62 item.dispatchEvent(new MouseEvent('contextmenu')); | 62 item.dispatchEvent(new MouseEvent(eventname)); |
| 63 assertDeepEquals( | 63 assertDeepEquals( |
| 64 bookmarks.actions.selectItem('2', store.data, { | 64 bookmarks.actions.selectItem('2', store.data, { |
| 65 clear: true, | 65 clear: true, |
| 66 range: false, | 66 range: false, |
| 67 toggle: false, | 67 toggle: false, |
| 68 }), | 68 }), |
| 69 store.lastAction); | 69 store.lastAction); |
| 70 } |
| 71 |
| 72 test('context menu selects item if unselected', function() { |
| 73 testEventSelection('contextmenu'); |
| 74 }); |
| 75 |
| 76 test('doubleclicking selects item if unselected', function() { |
| 77 document.body.appendChild( |
| 78 document.createElement('bookmarks-command-manager')); |
| 79 testEventSelection('dblclick'); |
| 70 }); | 80 }); |
| 71 }); | 81 }); |
| OLD | NEW |