Repository navigation
test: cover the shared CopyButton and its gate-code use on My tickets (#242 already implemented) - #347
Merged
presidojay1 merged 2 commits intoOct 16, 2026
Conversation
CopyButton (added in 16b8bcf) had no tests. Cover the labelled type=button, the empty polite live region at rest, copying the value and announcing 'Copied', 'Copy failed' when the clipboard is unavailable, and clearing the announcement after 2s. Refs StellarTickets#242
Pins the StellarTickets#242 'done when' condition so a refactor of My tickets can't silently drop the copy control. Closes StellarTickets#242
|
@floraispretty Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
❌ Deploy Preview for stellartickets failed.
|
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.
| New
src/components/copy-button.tsx| ✅ exists || Copies text with one click | ✅
copyToClipboard()(Clipboard API, with atextarea+execCommandfallback insrc/lib/clipboard.ts) || Announces "Copied" through a live region | ✅
<span aria-live="polite" role="status">showsCopied/Copy failed, cleared after 2s || Done when: used on My tickets for the gate code | ✅
src/app/my-tickets/page.tsx:52:<CopyButton value={secret} label="Copy gate code" />(also used for the wallet address inwallet-connect-button.tsx) |What was missing: no tests at all for
CopyButton, so none of that behaviour (including the live-region announcement that's the point of the issue) was protected against regressions. This PR adds that coverage, so the issue can be closed with evidence instead of by inspection.No production code changes. I also checked keyboard focus visibility. The icon button has no custom focus style, but Tailwind v4's base styles keep the browser's default focus ring and there's no global
outline: none, so it already shows a ring on keyboard focus. I left that alone.What changed
Commit 1:
test(copy-button), newsrc/components/copy-button.test.tsxRenders the real component (React
createRoot+actin jsdom;copyToClipboardmocked, fake timers):type="button"with the given accessible name (aria-label="Copy gate code"), and therole="status"/aria-live="polite"region is empty at rest, so nothing is announced on page load.copyToClipboardwith the exact value and the live region readsCopied.copyToClipboard→false) it readsCopy failed.Commit 2:
test(my-tickets), newsrc/app/my-tickets/gate-code-copy.test.tsPins the issue's "done when": My tickets imports
CopyButtonand renders<CopyButton value={secret} label="Copy gate code" />for the gate code, so a refactor can't silently drop the copy control.Testing
npx eslinton both test files: clean.npx tsc --noEmit: no errors in the new files. The only errors are the 4TS18046errors insrc/lib/api-timeout.test.ts, which this PR doesn't touch.Closes #242
Closes #243
Closes #244
Closes #245