Web components - Input: Create unit tests#79
Web components - Input: Create unit tests#79mahoneycm wants to merge 7 commits intoal-text-input-alphafrom
Conversation
mejiaj
left a comment
There was a problem hiding this comment.
@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.
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.
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.
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.jsfile as well as basic tests to check for internal content and an associated label tagMajor changes
Testing and review
npm test