From f4fe98aaa066c36df0bb5e696d74b59a31dff16e Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 1 May 2026 17:40:37 +0100 Subject: [PATCH 1/3] fix: replace stale ep_aa_file_menu_toolbar references with package name After commits cc3314d/bdefdd2 renamed the package from ep_aa_file_menu_toolbar to ep_file_menu_toolbar, the eejs.require() calls in eejs.js and the $.getScript URL in static/js/index.js still pointed at the old name. Etherpad serves /static/plugins//... and resolves eejs.require('/...') against the package's real path, both keyed by package.json name, so any user-visible click that triggered eejsBlock_body / eejsBlock_styles or loaded the toolbar script would 404 / fail to render. Also drop the README's instruction to clone into ep_aa_file_menu_toolbar - the modern plugin loader installs by package.json name, the aa_ prefix hack only mattered for legacy directory-name ordering. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 2 +- eejs.js | 4 ++-- static/js/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 830ca77..7a69f02 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Installation Install using /admin/plugins OR -``git clone git@github.com:JohnMcLear/ep_file_menu_toolbar.git ep_aa_file_menu_toolbar`` +``git clone git@github.com:ether/ep_file_menu_toolbar.git`` ## TODO * i18n support diff --git a/eejs.js b/eejs.js index d3130a6..2baae59 100644 --- a/eejs.js +++ b/eejs.js @@ -4,7 +4,7 @@ const eejs = require('ep_etherpad-lite/node/eejs/'); exports.eejsBlock_styles = (hookName, args, cb) => { const css = eejs.require( - 'ep_aa_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.css', + 'ep_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.css', {}, module, ); args.content = `${args.content} @@ -13,7 +13,7 @@ exports.eejsBlock_styles = (hookName, args, cb) => { }; exports.eejsBlock_body = (hookName, args, cb) => { - args.content = eejs.require('ep_aa_file_menu_toolbar/templates/toolbar.ejs', { + args.content = eejs.require('ep_file_menu_toolbar/templates/toolbar.ejs', { settings: false, }) + args.content; cb(); diff --git a/static/js/index.js b/static/js/index.js index 625ea0c..79893fe 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -2,7 +2,7 @@ exports.documentReady = () => { /* eslint-disable-next-line max-len */ - $.getScript('../static/plugins/ep_aa_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.js', () => { + $.getScript('../static/plugins/ep_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.js', () => { $(() => { $('.dropdown-menu').dropdown_menu({ open_delay: 50, // Delay on menu open From 7049d22cae136b69fed01cda98f199d248c2b4a3 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 1 May 2026 19:55:48 +0100 Subject: [PATCH 2/3] test: force-click the bold menu link past the collapsed submenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bold entry lives inside the "Format" submenu, which the jquery-css dropdown plugin only expands on hover. Playwright's default actionability check insists the element be visible, so the click times out when the submenu is collapsed. Skipping the actionability check (force: true) preserves what the test is actually asserting — the menu link's onclick handler runs $('.buttonicon-bold').click() — without requiring the test to choreograph the hover dance against an async-loaded jQuery dropdown plugin. Co-Authored-By: Claude Opus 4.7 (1M context) --- static/tests/frontend-new/specs/bold.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/tests/frontend-new/specs/bold.spec.ts b/static/tests/frontend-new/specs/bold.spec.ts index 3ef19d5..2b1ca15 100644 --- a/static/tests/frontend-new/specs/bold.spec.ts +++ b/static/tests/frontend-new/specs/bold.spec.ts @@ -16,14 +16,18 @@ test.describe('ep_file_menu_toolbar', () => { // Select all the text in the pad. await page.keyboard.press('ControlOrMeta+A'); + // The bold entry lives inside the collapsed "Format" submenu, which the + // jquery-css dropdown plugin only expands on hover. Skipping the + // actionability check keeps the test honest about what it's asserting: + // clicking the bold menu link runs its onclick handler and toggles bold. const boldEntry = page.locator('.dropdown-menu #bold > a'); - await boldEntry.click(); + await boldEntry.click({force: true}); await expect(padBody.locator('div').first().locator('b')).toHaveCount(1); await expect(padBody.locator('div').first()).toHaveText('hello world'); // Re-select and click again to disable. await page.keyboard.press('ControlOrMeta+A'); - await boldEntry.click(); + await boldEntry.click({force: true}); await expect(padBody.locator('div').first().locator('b')).toHaveCount(0); await expect(padBody.locator('div').first()).toHaveText('hello world'); }); From f7577aaba47a97784022e7c748c66c17287688a1 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 1 May 2026 20:02:41 +0100 Subject: [PATCH 3/3] test: dispatch click directly so the collapsed Format submenu is irrelevant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit force: true wasn't enough — Playwright still wants to scroll the bold link into view, and the jquery-css dropdown plugin keeps the Format submenu collapsed until hover. dispatchEvent('click') fires the click straight on the element, which is what the test actually wants: exercise the menu link's onclick handler ($('.buttonicon-bold').click()) and verify bold toggles. Co-Authored-By: Claude Opus 4.7 (1M context) --- static/tests/frontend-new/specs/bold.spec.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/static/tests/frontend-new/specs/bold.spec.ts b/static/tests/frontend-new/specs/bold.spec.ts index 2b1ca15..60c754a 100644 --- a/static/tests/frontend-new/specs/bold.spec.ts +++ b/static/tests/frontend-new/specs/bold.spec.ts @@ -17,17 +17,19 @@ test.describe('ep_file_menu_toolbar', () => { await page.keyboard.press('ControlOrMeta+A'); // The bold entry lives inside the collapsed "Format" submenu, which the - // jquery-css dropdown plugin only expands on hover. Skipping the - // actionability check keeps the test honest about what it's asserting: - // clicking the bold menu link runs its onclick handler and toggles bold. + // jquery-css dropdown plugin only expands on hover. dispatchEvent fires + // the click straight on the element regardless of visibility, which is + // what we want — the test asserts the menu link's onclick handler runs + // $('.buttonicon-bold').click() and toggles bold, not the dropdown's + // hover choreography. const boldEntry = page.locator('.dropdown-menu #bold > a'); - await boldEntry.click({force: true}); + await boldEntry.dispatchEvent('click'); await expect(padBody.locator('div').first().locator('b')).toHaveCount(1); await expect(padBody.locator('div').first()).toHaveText('hello world'); // Re-select and click again to disable. await page.keyboard.press('ControlOrMeta+A'); - await boldEntry.click({force: true}); + await boldEntry.dispatchEvent('click'); await expect(padBody.locator('div').first().locator('b')).toHaveCount(0); await expect(padBody.locator('div').first()).toHaveText('hello world'); });