| Index: chrome/test/data/webui/md_bookmarks/list_test.js
|
| diff --git a/chrome/test/data/webui/md_bookmarks/list_test.js b/chrome/test/data/webui/md_bookmarks/list_test.js
|
| index 9cf6755d34ae3a0730d208ba65f9f1f35388ec6d..62de4f3e6d6a35d3466ccee0137733037629c630 100644
|
| --- a/chrome/test/data/webui/md_bookmarks/list_test.js
|
| +++ b/chrome/test/data/webui/md_bookmarks/list_test.js
|
| @@ -4,28 +4,40 @@
|
|
|
| suite('<bookmarks-list>', function() {
|
| var list;
|
| - var TEST_LIST =
|
| - [createItem('0'), createItem('1'), createFolder('2', [], null)];
|
| + var store;
|
|
|
| setup(function() {
|
| + store = new bookmarks.TestStore({
|
| + nodes: testTree(createFolder(
|
| + '0',
|
| + [
|
| + createItem('1'),
|
| + createFolder('3', []),
|
| + createItem('5'),
|
| + createItem('7'),
|
| + ])),
|
| + selectedFolder: '0',
|
| + });
|
| + bookmarks.Store.instance_ = store;
|
| +
|
| list = document.createElement('bookmarks-list');
|
| replaceBody(list);
|
| - list.displayedList = TEST_LIST;
|
| + Polymer.dom.flush();
|
| });
|
|
|
| test('folder menu item hides the url field', function() {
|
| // Bookmark editor shows the url field.
|
| - list.menuItem_ = TEST_LIST[0];
|
| + list.menuItem_ = store.data.nodes['1'];
|
| assertFalse(list.$['url'].hidden);
|
|
|
| // Folder editor hides the url field.
|
| - list.menuItem_ = TEST_LIST[2];
|
| + list.menuItem_ = store.data.nodes['3'];
|
| assertTrue(list.$['url'].hidden);
|
| });
|
|
|
| test('saving edit passes correct details to the update', function() {
|
| // Saving bookmark edit.
|
| - var menuItem = TEST_LIST[0];
|
| + var menuItem = store.data.nodes['1'];
|
| chrome.bookmarks.update = function(id, edit) {
|
| assertEquals(menuItem.id, id);
|
| assertEquals(menuItem.url, edit.url);
|
| @@ -36,7 +48,7 @@ suite('<bookmarks-list>', function() {
|
| MockInteractions.tap(list.$.saveButton);
|
|
|
| // Saving folder rename.
|
| - menuItem = TEST_LIST[2];
|
| + menuItem = store.data.nodes['3'];
|
| chrome.bookmarks.update = function(id, edit) {
|
| assertEquals(menuItem.id, id);
|
| assertEquals(menuItem.title, edit.title);
|
| @@ -46,4 +58,11 @@ suite('<bookmarks-list>', function() {
|
| list.$.editBookmark.showModal();
|
| MockInteractions.tap(list.$.saveButton);
|
| });
|
| +
|
| + test('renders correct <bookmark-item> elements', function() {
|
| + var items = list.root.querySelectorAll('bookmarks-item');
|
| + var ids = Array.from(items).map((item) => item.itemId);
|
| +
|
| + assertDeepEquals(['1', '3', '5', '7'], ids);
|
| + });
|
| });
|
|
|