From 8c9e881922103df626b9a9ec6f68980375e9c434 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Mon, 24 Aug 2026 22:12:56 -0400 Subject: [PATCH] fix(e2e): derniers tests split-view + Forge - dropdown autocomplete, transferTab menu, drag natif - search.js : le dropdown d autocomplete ne se rouvre plus 500ms apres un hide (la recherche le rouvrait et bloquait les clics toolbar - test Forge) - ui.js + pane-manager.js : le split via menu contextuel ne transfert plus l onglet en synchrone (vidait le pane source -> auto-collapse -> grid disparu) - split-view.spec.js : navigation clavier attend la copie asynchrone (setTimeout 150ms qui reactivait pane 0) - split-view.spec.js : drag depuis l arbre via dragTo (drag natif HTML5) --- frontend/js/pane-manager.js | 5 ----- frontend/js/search.js | 4 ++++ frontend/js/ui.js | 4 ---- tests/e2e/split-view.spec.js | 18 +++++++----------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/frontend/js/pane-manager.js b/frontend/js/pane-manager.js index 98da2a4..2439e41 100644 --- a/frontend/js/pane-manager.js +++ b/frontend/js/pane-manager.js @@ -542,17 +542,12 @@ function createPaneTabManager(paneId) { if (action === 'splitRight') { if (pm && pm._hasAnyTab()) { pm.splitRight(); - // Transfer this specific tab to the new pane - const newPaneId = pm.panes.length - 1; - pm.transferTab(this.paneId, tabId, newPaneId); menu.remove(); return; } } else if (action === 'splitDown') { if (pm && pm._hasAnyTab()) { pm.splitDown(); - const newPaneId = pm.panes.length - 1; - pm.transferTab(this.paneId, tabId, newPaneId); menu.remove(); return; } } diff --git a/frontend/js/search.js b/frontend/js/search.js index 69cbc74..4b67329 100644 --- a/frontend/js/search.js +++ b/frontend/js/search.js @@ -179,6 +179,9 @@ export const AutocompleteDropdown = { }, show() { + // Après un hide() récent (ex: recherche lancée), on ignore le re-show + // du fetch de suggestions en attente — sinon le dropdown recouvre l'UI. + if (this._suppressShowUntil && Date.now() < this._suppressShowUntil) return; if (this._dropdown) this._dropdown.hidden = false; }, @@ -186,6 +189,7 @@ export const AutocompleteDropdown = { if (this._dropdown) this._dropdown.hidden = true; state.dropdownActiveIndex = -1; state.dropdownItems = []; + this._suppressShowUntil = Date.now() + 500; }, isVisible() { diff --git a/frontend/js/ui.js b/frontend/js/ui.js index cdac13d..958b209 100644 --- a/frontend/js/ui.js +++ b/frontend/js/ui.js @@ -2355,16 +2355,12 @@ export const TabManager = { if (action === "splitRight") { if (window.PaneManager && window.PaneManager._hasAnyTab && window.PaneManager._hasAnyTab()) { window.PaneManager.splitRight(); - const newPaneId = window.PaneManager.panes.length - 1; - window.PaneManager.transferTab(0, tabId, newPaneId); menu.remove(); return; } } else if (action === "splitDown") { if (window.PaneManager && window.PaneManager._hasAnyTab && window.PaneManager._hasAnyTab()) { window.PaneManager.splitDown(); - const newPaneId = window.PaneManager.panes.length - 1; - window.PaneManager.transferTab(0, tabId, newPaneId); menu.remove(); return; } } diff --git a/tests/e2e/split-view.spec.js b/tests/e2e/split-view.spec.js index 9afaafe..49cc036 100644 --- a/tests/e2e/split-view.spec.js +++ b/tests/e2e/split-view.spec.js @@ -235,20 +235,13 @@ test.describe('Split View — Tab Drag & Drop', () => { // Find a tree item const treeItem = page.locator('.tree-item[data-path="note2.md"]').first(); if (await treeItem.isVisible()) { - // Drag from tree to pane 1's content area + // Drag from tree to pane 1's content area (dragTo = drag natif HTML5) const targetPane = page.locator('.pane-container').nth(1); const targetContent = targetPane.locator('.content-area'); - - const treeBox = await treeItem.boundingBox(); - const targetBox = await targetContent.boundingBox(); - - if (treeBox && targetBox) { - await page.mouse.move(treeBox.x + treeBox.width / 2, treeBox.y + treeBox.height / 2); - await page.mouse.down(); - await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height / 2, { steps: 10 }); - await page.mouse.up(); + try { + await treeItem.dragTo(targetContent, { timeout: 5000 }); await page.waitForTimeout(500); - } + } catch (e) { /* drag not delivered — assertion below will fail */ } } // Pane 1 should have a tab now @@ -403,6 +396,9 @@ test.describe('Split View — Keyboard Navigation', () => { await openFile(page, 'TestVault', 'note2.md'); await page.keyboard.press('Control+Alt+\\'); await page.waitForSelector('.pane-grid', { timeout: 3000 }); + // Laisser la copie asynchrone de l'onglet actif se terminer (setTimeout 150ms + // dans _copyActiveTabToNewPane) — sinon elle réactive le pane 0 après la navigation. + await page.waitForTimeout(600); // Pane 0 should be active initially const pane0 = page.locator('.pane-container').nth(0);