From e8190b7691b3eb6626fb2138951afdfbae840c53 Mon Sep 17 00:00:00 2001 From: prismiwi2015 Date: Sat, 26 Sep 2026 20:36:39 +0200 Subject: [PATCH] Prepare AllTerrain Forms 1.2.1 release --- allterrain-forms.php | 4 +-- package-lock.json | 4 +-- package.json | 2 +- readme.txt | 11 ++++++- tests/vitest/widget-registry.test.ts | 47 ++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 tests/vitest/widget-registry.test.ts diff --git a/allterrain-forms.php b/allterrain-forms.php index d5f7378..57d1c57 100644 --- a/allterrain-forms.php +++ b/allterrain-forms.php @@ -3,7 +3,7 @@ * Plugin Name: AllTerrain Forms * Plugin URI: https://github.com/AllTerrainDeveloper/forms * Description: Forms for WordPress with every premium feature free — conditional logic, calculations, multi-page, file uploads, signatures, repeaters, entry management, ten themes — built as an OpenStation desktop app with a drag-and-drop builder. - * Version: 1.2.0 + * Version: 1.2.1 * Requires at least: 6.9 * Requires PHP: 7.4 * Requires Plugins: desktop-mode @@ -55,7 +55,7 @@ defined( 'ABSPATH' ) || exit; -define( 'ALLTFO_VERSION', '1.2.0' ); +define( 'ALLTFO_VERSION', '1.2.1' ); define( 'ALLTFO_FILE', __FILE__ ); define( 'ALLTFO_DIR', plugin_dir_path( __FILE__ ) ); define( 'ALLTFO_URL', plugin_dir_url( __FILE__ ) ); diff --git a/package-lock.json b/package-lock.json index 592526d..d064590 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "allterrain-forms", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "allterrain-forms", - "version": "1.2.0", + "version": "1.2.1", "license": "GPL-2.0-or-later", "dependencies": { "ajv": "^8.20.0", diff --git a/package.json b/package.json index b133c44..f89f0dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "allterrain-forms", - "version": "1.2.0", + "version": "1.2.1", "private": true, "description": "Forms for WordPress with every premium feature free, as an OpenStation desktop app.", "license": "GPL-2.0-or-later", diff --git a/readme.txt b/readme.txt index 2913a3a..7c4f71b 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Requires at least: 6.9 Tested up to: 7.1 Requires PHP: 7.4 Requires Plugins: desktop-mode -Stable tag: 1.2.0 +Stable tag: 1.2.1 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -327,6 +327,12 @@ API, importer hooks, and a REST namespace. Full reference in the repository. == Changelog == += 1.2.1 = + +* Fixed the Recent submissions desktop widget failing to mount in OpenStation because its callback was absent from the widget registry. +* Preserved other plugins' registered widgets and compatibility with older Desktop Mode builds. +* Thanks to Juan Lentino for the fix in PR #60. + = 1.2.0 = * Build forms on your phone: open "Add a field", tap a field type, and edit it in a full-width inspector with a Done button to return to the canvas. @@ -367,6 +373,9 @@ API, importer hooks, and a REST namespace. Full reference in the repository. == Upgrade Notice == += 1.2.1 = +Restores the Recent submissions desktop widget in OpenStation. No form or entry data changes. + = 1.2.0 = Build and edit forms comfortably on your phone, with tap-to-add fields, full-width editing panels and reachable Save controls. Existing forms and saved data keep their current format. diff --git a/tests/vitest/widget-registry.test.ts b/tests/vitest/widget-registry.test.ts new file mode 100644 index 0000000..ee41860 --- /dev/null +++ b/tests/vitest/widget-registry.test.ts @@ -0,0 +1,47 @@ +/** + * OpenStation resolves widget callbacks by ID after loading the bundle. A + * working standalone export does not help if that global registration is absent. + */ + +import { afterEach, describe, expect, it, vi } from 'vitest'; + +type Registry = Record< string, ( host: HTMLElement ) => unknown >; +type RegistryWindow = Window & { + openStationWidgets?: Registry; + desktopModeWidgets?: Registry; +}; + +const host = window as RegistryWindow; + +afterEach( () => { + delete host.openStationWidgets; + delete host.desktopModeWidgets; + vi.resetModules(); +} ); + +describe( 'Recent submissions widget registration', () => { + it( 'adds its mount callback without removing another OpenStation widget', async () => { + const other = vi.fn(); + const registry: Registry = { 'other/widget': other }; + host.openStationWidgets = registry; + + const widget = await import( '../../src/widget' ); + + expect( host.openStationWidgets ).toBe( registry ); + expect( host.openStationWidgets[ 'other/widget' ] ).toBe( other ); + expect( host.openStationWidgets[ 'allterrain-forms/recent' ] ).toBe( widget.renderWidget ); + expect( widget.render ).toBe( widget.renderWidget ); + expect( host.desktopModeWidgets ).toBe( registry ); + } ); + + it( 'reuses the legacy registry when OpenStation has not created one', async () => { + const registry: Registry = { 'legacy/widget': vi.fn() }; + host.desktopModeWidgets = registry; + + const widget = await import( '../../src/widget' ); + + expect( host.openStationWidgets ).toBe( registry ); + expect( host.desktopModeWidgets[ 'legacy/widget' ] ).toBeDefined(); + expect( host.desktopModeWidgets[ 'allterrain-forms/recent' ] ).toBe( widget.renderWidget ); + } ); +} );