resolve the copilot suggestions

This commit is contained in:
Bikram Choudhury
2026-05-22 22:12:17 +05:30
parent 0dda2069eb
commit d80989e8cc
3 changed files with 88 additions and 92 deletions
@@ -187,7 +187,7 @@ export class DocumentsTabV2 extends TabsBase {
partitionKey: this.partitionKey,
documentIds: ko.observableArray<DocumentId>([]),
tabKind: ViewModels.CollectionTabKind.Documents,
title: "Items",
title: this.tabTitle(),
collection: this.collection,
node: this.collection,
tabPath: `${this.collection.databaseId}>${this.collection.id()}>Documents`,
+11 -13
View File
@@ -87,9 +87,7 @@ function TabNav({ tab, active, tabKind }: { tab?: Tab; active: boolean; tabKind?
focusTab.current.focus();
}
}, [active]);
return (
<Menu openOnContext>
<MenuTrigger disableButtonEnhancement>
const liElement = (
<li
data-test={`TabNav:${tab !== undefined ? tab.tabId : ReactTabKind[tabKind!]}`}
onMouseOver={() => setHovering(true)}
@@ -163,19 +161,19 @@ function TabNav({ tab, active, tabKind }: { tab?: Tab; active: boolean; tabKind?
</div>
</span>
</li>
</MenuTrigger>
);
if (!tab?.canDuplicate()) {
return liElement;
}
return (
<Menu openOnContext>
<MenuTrigger disableButtonEnhancement>{liElement}</MenuTrigger>
<MenuPopover>
<MenuList>
{tab?.canDuplicate() && (
<MenuItem onClick={() => tab.duplicateTab()}>{t(Keys.tabs.tabMenu.duplicateTab)}</MenuItem>
)}
<MenuItem
onClick={() => {
tab ? tab.onCloseTabButtonClick() : useTabs.getState().closeReactTab(tabKind);
}}
>
{t(Keys.tabs.tabMenu.closeTab)}
</MenuItem>
<MenuItem onClick={() => tab.onCloseTabButtonClick()}>{t(Keys.tabs.tabMenu.closeTab)}</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
+4 -6
View File
@@ -77,15 +77,13 @@ test("Duplicate Query tab preserves query text in new tab", async () => {
expect(editorText).toContain("duplicate-query-test");
});
test("Duplicate tab menu item is not shown for the Home tab", async () => {
// The Home tab (ReactTabKind) is never duplicable
test("Right-click context menu does not appear for the Home tab", async () => {
// The Home tab (ReactTabKind) is never duplicable — no context menu should appear
await explorer.tabNavHeader("Home").click({ button: "right" });
// "Close tab" should always appear
await expect(explorer.tabContextMenuItem("Close tab")).toBeVisible();
// "Duplicate tab" must NOT appear
// Neither menu item should be visible
await expect(explorer.tabContextMenuItem("Duplicate tab")).not.toBeVisible();
await expect(explorer.tabContextMenuItem("Close tab")).not.toBeVisible();
});
test("Close tab from right-click menu closes the tab", async () => {