OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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-toolbar>', function() { | 5 suite('<bookmarks-toolbar>', function() { |
6 var toolbar; | 6 var toolbar; |
7 var store; | 7 var store; |
8 var commandManager; | 8 var commandManager; |
9 | 9 |
10 suiteSetup(function() { | 10 suiteSetup(function() { |
11 chrome.bookmarkManagerPrivate.removeTrees = function() {}; | 11 chrome.bookmarkManagerPrivate.removeTrees = function() {}; |
12 }); | 12 }); |
13 | 13 |
14 setup(function() { | 14 setup(function() { |
15 store = new bookmarks.TestStore({ | 15 store = new bookmarks.TestStore({ |
16 nodes: testTree(createFolder( | 16 nodes: testTree(createFolder( |
17 '1', | 17 '1', |
18 [ | 18 [ |
19 createItem('2'), | 19 createItem('2'), |
20 createItem('3'), | 20 createItem('3'), |
21 createFolder('4', [], {unmodifiable: 'managed'}), | 21 createFolder('4', [], {unmodifiable: 'managed'}), |
22 createFolder('5', []), | |
23 createFolder( | |
24 '6', | |
25 [ | |
26 createItem('61'), | |
27 ]), | |
22 ])), | 28 ])), |
23 selection: { | 29 selection: { |
24 items: new Set(), | 30 items: new Set(), |
25 anchor: null, | 31 anchor: null, |
26 }, | 32 }, |
27 }); | 33 }); |
28 store.replaceSingleton(); | 34 store.replaceSingleton(); |
29 | 35 |
30 toolbar = document.createElement('bookmarks-toolbar'); | 36 toolbar = document.createElement('bookmarks-toolbar'); |
31 replaceBody(toolbar); | 37 replaceBody(toolbar); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 107 |
102 assertTrue(toolbar.$$('#addBookmarkButton').disabled); | 108 assertTrue(toolbar.$$('#addBookmarkButton').disabled); |
103 assertFalse(toolbar.$$('#importBookmarkButton').disabled); | 109 assertFalse(toolbar.$$('#importBookmarkButton').disabled); |
104 | 110 |
105 store.data.prefs.canEdit = false; | 111 store.data.prefs.canEdit = false; |
106 store.notifyObservers(); | 112 store.notifyObservers(); |
107 | 113 |
108 assertTrue(toolbar.$$('#addBookmarkButton').disabled); | 114 assertTrue(toolbar.$$('#addBookmarkButton').disabled); |
109 assertTrue(toolbar.$$('#importBookmarkButton').disabled); | 115 assertTrue(toolbar.$$('#importBookmarkButton').disabled); |
110 }); | 116 }); |
117 | |
118 test('sort button is disabled when folder is empty', function() { | |
119 MockInteractions.tap(toolbar.$.menuButton); | |
120 | |
121 store.data.selectedFolder = '6'; | |
122 store.notifyObservers(); | |
123 Polymer.dom.flush(); | |
tsergeant
2017/07/10 07:09:08
Nit: Are these flushes actually necessary? I would
calamity
2017/07/11 06:53:10
Done.
| |
124 assertTrue(toolbar.canSortFolder_); | |
125 | |
126 store.data.selectedFolder = '5'; | |
127 store.notifyObservers(); | |
128 Polymer.dom.flush(); | |
129 | |
130 assertFalse(toolbar.canSortFolder_); | |
131 assertTrue(toolbar.$$('#sortButton').disabled); | |
132 }); | |
111 }); | 133 }); |
OLD | NEW |