mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: ignore notes in other tabs when navigating back
This commit is contained in:
@@ -230,5 +230,27 @@ test("clicking on a note that's already opened in another tab should focus the t
|
||||
expect(await tabs[0].isActive()).toBe(true);
|
||||
});
|
||||
|
||||
test("open a note in 2 tabs then open another note and navigate back", async ({
|
||||
page
|
||||
}) => {
|
||||
const app = new AppModel(page);
|
||||
await app.goto();
|
||||
const notes = await app.goToNotes();
|
||||
const note = await notes.createNote({
|
||||
title: "Note 1"
|
||||
});
|
||||
await note?.contextMenu.openInNewTab();
|
||||
await notes.editor.waitForLoading();
|
||||
await notes.createNote({
|
||||
title: "Note 2"
|
||||
});
|
||||
|
||||
await notes.editor.goBack();
|
||||
|
||||
const tabs = await notes.editor.getTabs();
|
||||
expect(await tabs[1].isActive()).toBe(true);
|
||||
expect(await tabs[1].title()).toBe("Note 1");
|
||||
});
|
||||
|
||||
test.skip("TODO: open a locked note, switch to another note and navigate back", () => {});
|
||||
test.skip("TODO: open a locked note, switch to another note, unlock the note and navigate back", () => {});
|
||||
|
||||
@@ -359,7 +359,7 @@ function TabStrip() {
|
||||
type={session.type}
|
||||
onFocus={() => {
|
||||
if (tab.id !== currentTab) {
|
||||
useEditorStore.getState().focusTab(tab.id);
|
||||
useEditorStore.getState().activateSession(tab.sessionId);
|
||||
}
|
||||
}}
|
||||
onClose={() => useEditorStore.getState().closeTabs(tab.id)}
|
||||
|
||||
@@ -655,7 +655,7 @@ class EditorStore extends BaseStore<EditorStore> {
|
||||
addTab
|
||||
} = this.get();
|
||||
const noteId = typeof noteOrId === "string" ? noteOrId : noteOrId.id;
|
||||
const oldTabForNote = getTabsForNote(noteId).at(0);
|
||||
const oldTabForNote = options.force ? null : getTabsForNote(noteId).at(0);
|
||||
const tabId = options.openInNewTab
|
||||
? addTab(getId())
|
||||
: oldTabForNote?.id || activeTabId || addTab(getId());
|
||||
|
||||
Reference in New Issue
Block a user