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

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

Issue 2780223004: MD Bookmarks: Implement dialog to add new folders/bookmarks (Closed)
Patch Set: Rebase Created 3 years, 8 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/edit_dialog_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js b/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js
index f433c9cbddaba499ca66e54582f6a4c65dbff829..8b7f9b3a8f2974a6f5ae515462a7c4860102869a 100644
--- a/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js
+++ b/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js
@@ -5,16 +5,21 @@
suite('<bookmarks-edit-dialog>', function() {
var dialog;
var lastUpdate;
+ var lastCreation;
suiteSetup(function() {
chrome.bookmarks.update = function(id, edit) {
lastUpdate.id = id;
lastUpdate.edit = edit;
- }
+ };
+ chrome.bookmarks.create = function(node) {
+ lastCreation = node;
+ };
});
setup(function() {
lastUpdate = {};
+ lastCreation = {};
dialog = document.createElement('bookmarks-edit-dialog');
replaceBody(dialog);
});
@@ -33,6 +38,11 @@ suite('<bookmarks-edit-dialog>', function() {
assertTrue(dialog.$.url.hidden);
});
+ test('adding a folder hides the url field', function() {
+ dialog.showAddDialog(true, '1');
+ assertTrue(dialog.$.url.hidden);
+ });
+
test('editing passes the correct details to the update', function() {
// Editing an item without changing anything.
var item = createItem('1', {url: 'http://website.com', title: 'website'});
@@ -64,6 +74,19 @@ suite('<bookmarks-edit-dialog>', function() {
assertFalse(dialog.$.dialog.open);
});
+ test('add passes the correct details to the backend', function() {
+ dialog.showAddDialog(false, '1');
+
+ dialog.titleValue_ = 'Permission Site';
+ dialog.urlValue_ = 'permission.site';
+
+ MockInteractions.tap(dialog.$.saveButton);
+
+ assertEquals('1', lastCreation.parentId);
+ assertEquals('http://permission.site', lastCreation.url);
+ assertEquals('Permission Site', lastCreation.title);
+ });
+
test('validates urls correctly', function() {
dialog.urlValue_ = 'http://www.example.com';
assertTrue(dialog.validateUrl_());

Powered by Google App Engine
This is Rietveld 408576698