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

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

Issue 2666033002: [MD Bookmarks] Add edit folder. (Closed)
Patch Set: Add unit test for onSaveEditTap_ Created 3 years, 10 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
new file mode 100644
index 0000000000000000000000000000000000000000..567cce3127c3b9a23a3fea5881d1fe513511bb92
--- /dev/null
+++ b/chrome/test/data/webui/md_bookmarks/list_test.js
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+suite('<bookmarks-list>', function() {
+ var list;
+ var TEST_LIST =
+ [createItem('0'), createItem('1'), createFolder('2', [], null)];
+
+ setup(function() {
+ list = document.createElement('bookmarks-list');
+ replaceBody(list);
+ list.displayedList = TEST_LIST;
+ });
+
+ test('folder menu item hides the url field', function() {
+ // Bookmark editor shows the url field.
+ list.menuItem_ = TEST_LIST[0];
+ assertFalse(list.$['url'].hidden);
+
+ // Folder editor hides the url field.
+ list.menuItem_ = TEST_LIST[2];
+ assertTrue(list.$['url'].hidden);
+ });
+
+ test('saving edit passes correct details to the update', function() {
+ // Saving bookmark edit.
+ var menuItem = TEST_LIST[0];
+ chrome.bookmarks.update = function(id, edit) {
+ assertEquals(menuItem.id, id);
+ assertEquals(menuItem.url, edit.url);
+ assertEquals(menuItem.title, edit.title);
+ };
+ list.menuItem_ = menuItem;
+ list.$.editBookmark.showModal();
+ list.onSaveEditTap_();
+
+ // Saving folder rename.
+ menuItem = TEST_LIST[2];
+ chrome.bookmarks.update = function(id, edit) {
+ assertEquals(menuItem.id, id);
+ assertEquals(menuItem.title, edit.title);
+ assertEquals(undefined, edit.url);
+ };
+ list.menuItem_ = menuItem;
+ list.$.editBookmark.showModal();
+ list.onSaveEditTap_();
calamity 2017/02/03 03:45:24 If you're gonna open the actual dialog, seems a sh
angelayang 2017/02/06 00:49:39 Sounds good
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698