-
Notifications
You must be signed in to change notification settings - Fork 39
MMT-4004: Build a UI schema and JSON schema for building the form #1353
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
Conversation
render(<KeywordForm initialData={{}} />) | ||
const preferredLabelInput = screen.getByLabelText('Preferred Label') | ||
fireEvent.change(preferredLabelInput, { target: { value: 'New Keyword' } }) | ||
expect(preferredLabelInput).toHaveValue('New Keyword') |
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.
I think it would be better to verify formData has the information you type, than to just check the input field.
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.
at this point, formData won't have that information until we implement the save button, correct?
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.
I think you might be able to spyOn handleChange
to check if the form data is being updated?
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.
I've tried a few different things with this now, but spyOn is meant for objects or class prototypes, not for functions defined within the component's scope.
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.
I took a few minutes and looked, there are ways but I don't really like any of them. I think maybe rename the test then, "test('updates formData when a change occurs', async () => {" -- you are not really checking formData, you are just verifying whatever you type shows up in the textfield, is there some processing going on that you are testing in terms of specific lines of code, maybe you can verify that part..., otherwise you are just testing standard html behavior, that what you type shows up in a field.
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.
Okay! Created a function to be called with the newly created object that's made onHandleChange. Let me know what you think.
static/src/js/pages/KeywordManagerPage/__tests__/KeywordManagerPage.test.jsx
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1353 +/- ##
==========================================
- Coverage 97.74% 97.23% -0.51%
==========================================
Files 370 374 +4
Lines 5901 5977 +76
Branches 1225 1250 +25
==========================================
+ Hits 5768 5812 +44
- Misses 132 157 +25
- Partials 1 8 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Overview
What is the feature?
Create a UI schema, JSON schema for this form.
The UI Schema/JSON schema should include all fields (pref label, reference, narrower, broader, etc.)
Render the form when element in tree is clicked.
What is the Solution?
Implemented these elements much like our other concepts
What areas of the application does this impact?
KeywordManager
Testing
Reproduction steps
Attachments
N/a
Checklist