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

Side by Side Diff: chrome/test/data/webui/md_bookmarks/edit_dialog_test.js

Issue 2742583003: MD Bookmarks: Extract bookmark editing into a <bookmark-edit-dialog> element (Closed)
Patch Set: Rename event handlers 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 suite('<bookmarks-edit-dialog>', function() {
6 var dialog;
7 var lastUpdate;
8
9 suiteSetup(function() {
10 chrome.bookmarks.update = function(id, edit) {
11 lastUpdate.id = id;
12 lastUpdate.edit = edit;
13 }
14 });
15
16 setup(function() {
17 lastUpdate = {};
18 dialog = document.createElement('bookmarks-edit-dialog');
19 replaceBody(dialog);
20 });
21
22 test('editing an item shows the url field', function() {
23 var item = createItem('0');
24 dialog.showEditDialog(item);
25
26 assertFalse(dialog.$.url.hidden);
27 });
28
29 test('editing a folder hides the url field', function() {
30 var folder = createFolder('0', []);
31 dialog.showEditDialog(folder);
32
33 assertTrue(dialog.$.url.hidden);
34 });
35
36 test('editing passes the correct details to the update', function() {
37 // Editing an item without changing anything.
38 var item = createItem('1', {url: 'www.website.com', title: 'website'});
39 dialog.showEditDialog(item);
40
41 MockInteractions.tap(dialog.$.saveButton);
42
43 assertEquals(item.id, lastUpdate.id);
44 assertEquals(item.url, lastUpdate.edit.url);
45 assertEquals(item.title, lastUpdate.edit.title);
46
47 // Editing a folder, changing the title.
48 var folder = createFolder('2', [], {title: 'Cool Sites'});
49 dialog.showEditDialog(folder);
50 dialog.titleValue_ = 'Awesome websites';
51
52 MockInteractions.tap(dialog.$.saveButton);
53
54 assertEquals(folder.id, lastUpdate.id);
55 assertEquals(undefined, lastUpdate.edit.url);
56 assertEquals('Awesome websites', lastUpdate.edit.title);
57 });
58 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc ('k') | chrome/test/data/webui/md_bookmarks/list_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698