-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web components - Input: Create unit tests #79
base: al-text-input-alpha
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahoneycm thanks for creating these tests. I've added some thoughts. If the component is mainly light DOM and we're not doing any custom functionality — there isn't much to test.
We should look into how this component will support the variants and test that custom functionality.
` | ||
}); | ||
|
||
it("Should show props", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: This test might only be necessary if we progressively enhance the component.
describe("usa-text-input component", async () => { | ||
beforeEach(async () => { | ||
document.body.innerHTML = ` | ||
<usa-text-input> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: For discussion, are there any props we want to support in this custom element?
For example: disabled
, error
, success
, width
?
Last three are from USWDS text input variants.
}); | ||
|
||
it("Should show props", () => { | ||
expect(getInputElement().getAttribute("id")).toContain("input-type-text"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: Might not be necessary if we're not progressively enhancing or doing validation.
Summary
Created basic unit tests for Input alpha
Related PR
#17
Preview link
Text input →
Problem statement
Text input needed unit tests for alpha release
Solution
This change added a
usa-text-input.spec.js
file as well as basic tests to check for internal content and an associated label tagMajor changes
Testing and review
npm test