| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 suite('<bookmarks-edit-dialog>', function() { | 5 suite('<bookmarks-edit-dialog>', function() { |
| 6 var dialog; | 6 var dialog; |
| 7 var lastUpdate; | 7 var lastUpdate; |
| 8 var lastCreation; | 8 var lastCreation; |
| 9 | 9 |
| 10 suiteSetup(function() { | 10 suiteSetup(function() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 dialog.showEditDialog(folder); | 59 dialog.showEditDialog(folder); |
| 60 dialog.titleValue_ = 'Awesome websites'; | 60 dialog.titleValue_ = 'Awesome websites'; |
| 61 | 61 |
| 62 MockInteractions.tap(dialog.$.saveButton); | 62 MockInteractions.tap(dialog.$.saveButton); |
| 63 | 63 |
| 64 assertEquals(folder.id, lastUpdate.id); | 64 assertEquals(folder.id, lastUpdate.id); |
| 65 assertEquals(undefined, lastUpdate.edit.url); | 65 assertEquals(undefined, lastUpdate.edit.url); |
| 66 assertEquals('Awesome websites', lastUpdate.edit.title); | 66 assertEquals('Awesome websites', lastUpdate.edit.title); |
| 67 }); | 67 }); |
| 68 | 68 |
| 69 test('pressing enter saves and closes dialog', function() { | |
| 70 var item = createItem('1', {url: 'http://www.example.com'}); | |
| 71 dialog.showEditDialog(item); | |
| 72 | |
| 73 MockInteractions.pressEnter(dialog.$.url); | |
| 74 assertFalse(dialog.$.dialog.open); | |
| 75 }); | |
| 76 | |
| 77 test('add passes the correct details to the backend', function() { | 69 test('add passes the correct details to the backend', function() { |
| 78 dialog.showAddDialog(false, '1'); | 70 dialog.showAddDialog(false, '1'); |
| 79 | 71 |
| 80 dialog.titleValue_ = 'Permission Site'; | 72 dialog.titleValue_ = 'Permission Site'; |
| 81 dialog.urlValue_ = 'permission.site'; | 73 dialog.urlValue_ = 'permission.site'; |
| 82 | 74 |
| 83 MockInteractions.tap(dialog.$.saveButton); | 75 MockInteractions.tap(dialog.$.saveButton); |
| 84 | 76 |
| 85 assertEquals('1', lastCreation.parentId); | 77 assertEquals('1', lastCreation.parentId); |
| 86 assertEquals('http://permission.site', lastCreation.url); | 78 assertEquals('http://permission.site', lastCreation.url); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 110 dialog.showEditDialog(item); | 102 dialog.showEditDialog(item); |
| 111 | 103 |
| 112 dialog.urlValue_ = ''; | 104 dialog.urlValue_ = ''; |
| 113 | 105 |
| 114 MockInteractions.tap(dialog.$.saveButton); | 106 MockInteractions.tap(dialog.$.saveButton); |
| 115 | 107 |
| 116 assertTrue(dialog.$.url.invalid); | 108 assertTrue(dialog.$.url.invalid); |
| 117 assertTrue(dialog.$.dialog.open); | 109 assertTrue(dialog.$.dialog.open); |
| 118 }); | 110 }); |
| 119 }); | 111 }); |
| OLD | NEW |