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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 suite('<bookmarks-list>', function() {
6 var list;
7 var TEST_LIST =
8 [createItem('0'), createItem('1'), createFolder('2', [], null)];
9
10 setup(function() {
11 list = document.createElement('bookmarks-list');
12 replaceBody(list);
13 list.displayedList = TEST_LIST;
14 });
15
16 test('folder menu item hides the url field', function() {
17 // Bookmark editor shows the url field.
18 list.menuItem_ = TEST_LIST[0];
19 assertFalse(list.$['url'].hidden);
20
21 // Folder editor hides the url field.
22 list.menuItem_ = TEST_LIST[2];
23 assertTrue(list.$['url'].hidden);
24 });
25
26 test('saving edit passes correct details to the update', function() {
27 // Saving bookmark edit.
28 var menuItem = TEST_LIST[0];
29 chrome.bookmarks.update = function(id, edit) {
30 assertEquals(menuItem.id, id);
31 assertEquals(menuItem.url, edit.url);
32 assertEquals(menuItem.title, edit.title);
33 };
34 list.menuItem_ = menuItem;
35 list.$.editBookmark.showModal();
36 list.onSaveEditTap_();
37
38 // Saving folder rename.
39 menuItem = TEST_LIST[2];
40 chrome.bookmarks.update = function(id, edit) {
41 assertEquals(menuItem.id, id);
42 assertEquals(menuItem.title, edit.title);
43 assertEquals(undefined, edit.url);
44 };
45 list.menuItem_ = menuItem;
46 list.$.editBookmark.showModal();
47 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
48 });
49 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698