Skip to content

test: add missing type attribute and behavior tests for Button component#1875

Open
Peersheik wants to merge 2 commits intoRocketChat:mainfrom
Peersheik:main
Open

test: add missing type attribute and behavior tests for Button component#1875
Peersheik wants to merge 2 commits intoRocketChat:mainfrom
Peersheik:main

Conversation

@Peersheik
Copy link
Copy Markdown

Adds missing unit tests for the Button component to verify:

  1. Button defaults to type="button" to prevent accidental form submissions
  2. Button allows overriding type attribute when explicitly passed
  3. Button renders as anchor tag when is="a" prop is passed

The existing tests only checked rendering and accessibility (a11y).
There were no tests verifying the Button's type attribute behavior,
which is critical to prevent accidental form submissions in apps
using Fuselage components.

Issue(s):
Closes #1813

Further comments:
This PR adds test coverage for the default type="button" behavior
discussed in #1813. The Button component already correctly sets
type="button" as default, but there were no tests to verify this
behavior and prevent future regressions.

Tests added:

  • Verifies Button renders with type="button" by default
  • Verifies type attribute can be overridden when explicitly passed
  • Verifies Button renders as anchor when is="a" prop is passed

Adds missing unit tests for the Button component to verify:

1. Button defaults to type="button" to prevent accidental form submissions
2. Button allows overriding type attribute when explicitly passed
3. Button renders as anchor tag when is="a" prop is passed

The existing tests only checked rendering and accessibility (a11y).
There were no tests verifying the Button's type attribute behavior,
which is critical to prevent accidental form submissions in apps
using Fuselage components.

Issue(s):
Closes RocketChat#1813

Further comments:
This PR adds test coverage for the default type="button" behavior 
discussed in RocketChat#1813. The Button component already correctly sets 
type="button" as default, but there were no tests to verify this 
behavior and prevent future regressions.

Tests added:
- Verifies Button renders with type="button" by default
- Verifies type attribute can be overridden when explicitly passed
- Verifies Button renders as anchor when is="a" prop is passed
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 28, 2026

⚠️ No Changeset found

Latest commit: 943eec3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(fuselage): ensure Button defaults to type="button" to prevent accidental form submissions Body:

2 participants