Repository navigation
Fix TG: Call to Action button links to an empty href when no link is set - #95
Conversation
…s set Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Cleanup must verify the widget deletion response instead of silently allowing failed cleanup.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes the CTA widget so an unset button link renders href="#" instead of an empty URL.
Changes:
- Uses
empty()for the CTA URL fallback. - Adds REST-based E2E regression coverage and WordPress helpers.
- Registers widget paths in the QA suite.
| File | Summary |
|---|---|
tests/e2e/utils/wp.ts |
Adds WordPress helpers; cleanup should assert deletion responses to detect failures. |
tests/e2e/specs/widgets/cta-empty-link.spec.ts |
Adds regression coverage for empty CTA links. |
inc/widgets/accelerate-call-to-action-widget.php |
Falls back to # when no CTA URL is set. |
.themegrill-qa/suite.json |
Maps widget-related paths to the widgets QA area. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| await page.request.post(`/?rest_route=/wp/v2/widgets/${id}&force=true`, { | ||
| headers: { "X-WP-Nonce": await restNonce(page), "X-HTTP-Method-Override": "DELETE" }, | ||
| }); |
There was a problem hiding this comment.
Valid, fixed in 29d3421. removeWidget() now asserts res.ok() and reports the HTTP status, like deletePage(). Checked: deleting a non-existent widget now fails with "removing test widget … failed: HTTP 404". In addLegacyWidget() the cleanup after a failed placement swallows its own error, so the placement error (the real cause) is the one reported.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Fixes themegrill/accelerate-pro#54 in Free (Pro fix: themegrill/accelerate-pro#130).
Reported by @iamprazol.
Cause: the widget always saves
button_url(as""when left empty), so theisset()fallback to#never applied, and the button renderedhref="", which reloads the page.Fix:
empty()instead ofisset(), so it falls back to#.How to test: add TG: Call To Action with button text and no Button Redirect Link, then inspect the button. Before:
href="". After:href="#". With a link set, the link is kept.Testing done: new
@freshspecwidgets/cta-empty-link(REST-built widget, cleaned up; addstests/e2e/utils/wp.tsadmin helpers) fails ondevelopand passes here; full suite passes.PHPCS (repo
phpcs.xml.dist): 0 new violations; file errors 128 → 127, warnings unchanged (19, pre-existing).Changelog: Fix - TG: Call to Action button links to an empty href when no link is set.
🤖 Generated with Claude Code