mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
fix(tab_bar): empty tabs not properly removed at app start
This commit is contained in:
parent
0c5cd66eae
commit
a8319fcbdf
@ -82,3 +82,21 @@ test("Tabs are restored in right order", async ({ page, context }) => {
|
||||
// Check the note tree has the right active node.
|
||||
await expect(app.noteTreeActiveNote).toContainText("Text notes");
|
||||
});
|
||||
|
||||
test("Empty tabs are cleared out", async ({ page, context }) => {
|
||||
const app = new App(page, context);
|
||||
await app.goto();
|
||||
|
||||
// Open three tabs.
|
||||
await app.closeAllTabs();
|
||||
await app.addNewTab();
|
||||
await app.goToNoteInNewTab("Code notes");
|
||||
await app.addNewTab();
|
||||
await app.addNewTab();
|
||||
|
||||
// Refresh the page and check the order.
|
||||
await app.goto({ preserveTabs: true });
|
||||
|
||||
// Expect no empty tabs.
|
||||
expect(await app.tabBar.locator(".note-tab-wrapper").count()).toBe(1);
|
||||
});
|
||||
|
@ -75,7 +75,7 @@ export default class TabManager extends Component {
|
||||
|
||||
const filteredNoteContexts = noteContextsToOpen.filter((openTab: NoteContextState) => {
|
||||
const noteId = treeService.getNoteIdFromUrl(openTab.notePath);
|
||||
if (noteId && !(noteId in froca.notes)) {
|
||||
if (!noteId || !(noteId in froca.notes)) {
|
||||
// note doesn't exist so don't try to open tab for it
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user