Skip to content

Test gap: lib/clipboard.ts's execCommand fallback path has no test coverage #322

Description

@Jaydbrown

lib/clipboard.ts exists specifically to fix issue #145 ("Copy" buttons silently failing over plain HTTP where navigator.clipboard is undefined) by falling back to a hidden-textarea + document.execCommand('copy') trick. Despite being the actual fix for a real, previously-reported bug, there's no lib/clipboard.test.ts exercising either path — the preferred navigator.clipboard.writeText branch, the fallback textarea branch, or the "every strategy failed" false-return branch. Since jsdom (already a devDependency, used for the rest of the component test suite) supports mocking both navigator.clipboard and document.execCommand, this is straightforward to cover and would catch any future regression in the exact bug this file was written to prevent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions