Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4871)

Unified Diff: chrome/test/data/webui/md_bookmarks/list_test.js

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: More tweaks Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5e8dc8a3305f6745f36b9078f98c7858997b080e 100644
--- a/chrome/test/data/webui/md_bookmarks/list_test.js
+++ b/chrome/test/data/webui/md_bookmarks/list_test.js
@@ -4,28 +4,41 @@
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', [], null),
calamity 2017/03/09 04:58:57 nit: Drop the null.
tsergeant 2017/03/09 06:27:55 "Just 'createFolder'. It's cleaner."
+ 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'];
+ // TODO(tsergeant): Avoid overwriting these functions directly.
calamity 2017/03/09 04:58:57 Is this about using the real backend? If so, make
tsergeant 2017/03/09 06:27:55 My concern was with the fact that overwriting chro
chrome.bookmarks.update = function(id, edit) {
assertEquals(menuItem.id, id);
assertEquals(menuItem.url, edit.url);
@@ -36,7 +49,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 +59,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);
+ });
});

Powered by Google App Engine
This is Rietveld 408576698