Fix TG: Call to Action button links to an empty href when no link is set - #95
Open
rajatgautam755421 wants to merge 2 commits into
Open
rajatgautam755421 wants to merge 2 commits into
rajatgautam755421 wants to merge 2 commits into
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.
Comment on lines
+62
to
+64
| await page.request.post(`/?rest_route=/wp/v2/widgets/${id}&force=true`, { | ||
| headers: { "X-WP-Nonce": await restNonce(page), "X-HTTP-Method-Override": "DELETE" }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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