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..4f17457eea5a2f3e31f8d8b8fcc41150afaf83b2 100644 |
--- a/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js |
+++ b/chrome/test/data/webui/md_bookmarks/edit_dialog_test.js |
@@ -5,12 +5,16 @@ |
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() { |
@@ -33,6 +37,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 +73,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_()); |