| 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_());
|
|
|