Bug 1475489 - stop editing folder names when closing the folder tree in the edit bookmark panel, r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D94227
This commit is contained in:
@@ -789,6 +789,9 @@ var gEditItemOverlay = {
|
||||
this._element("chooseFolderSeparator").hidden = this._element(
|
||||
"chooseFolderMenuItem"
|
||||
).hidden = false;
|
||||
// Stop editing if we were (will no-op if not). This avoids permanently
|
||||
// breaking the tree if/when it is reshown.
|
||||
this._folderTree.stopEditing(false);
|
||||
// Unlinking the view will break the connection with the result. We don't
|
||||
// want to pay for live updates while the view is not visible.
|
||||
this._folderTree.view = null;
|
||||
|
||||
@@ -28,7 +28,6 @@ add_task(async function setup() {
|
||||
registerCleanupFunction(async () => {
|
||||
bookmarkPanel = null;
|
||||
win.StarUI._autoCloseTimeout = oldTimeout;
|
||||
// BrowserTestUtils.removeTab(tab);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
win = null;
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
@@ -90,6 +89,42 @@ add_task(async function test_selectChoose() {
|
||||
"Should have kept the same menu label"
|
||||
);
|
||||
|
||||
let input = folderTree.shadowRoot.querySelector("input");
|
||||
|
||||
let newFolderButton = win.document.getElementById(
|
||||
"editBMPanel_newFolderButton"
|
||||
);
|
||||
newFolderButton.click(); // This will start editing.
|
||||
|
||||
// Wait for editing:
|
||||
await TestUtils.waitForCondition(() => !input.hidden);
|
||||
|
||||
// Click the arrow to collapse the list.
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
win.document.getElementById("editBMPanel_foldersExpander"),
|
||||
{},
|
||||
win
|
||||
);
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => folderTreeRow.collapsed,
|
||||
"Should hide the folder tree"
|
||||
);
|
||||
ok(input.hidden, "Folder tree should not be broken.");
|
||||
|
||||
// Click the arrow to re-show the list.
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
win.document.getElementById("editBMPanel_foldersExpander"),
|
||||
{},
|
||||
win
|
||||
);
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => !folderTreeRow.collapsed,
|
||||
"Should re-show the folder tree"
|
||||
);
|
||||
ok(input.hidden, "Folder tree should still not be broken.");
|
||||
|
||||
await hideBookmarksPanel(win);
|
||||
Assert.ok(!folderTree.view, "The view should have been disconnected");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user