-
Notifications
You must be signed in to change notification settings - Fork 99
(feat) O3-4315: Add support for workspace-launcher rendering type #410
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
base: main
Are you sure you want to change the base?
Conversation
Hi @NethmiRodrigo , could you review this PR Thanks! |
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.
@rdwaynedehoedt Please add a video demonstrating that everything still behaves as expected & add unit test covering this change.
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.
Thanks @rdwaynedehoedt! Good work! Please look at the comments and include a screenshot of the UI and how it works in the description. Its also preferred to add unit tests for new functionality, similar to how the other inputs do.
...ion/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.component.tsx
Outdated
Show resolved
Hide resolved
...ion/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.component.tsx
Outdated
Show resolved
Hide resolved
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.
Almost there @rdwaynedehoedt! Some minor changes. Excellent test cases!
...ion/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.component.tsx
Outdated
Show resolved
Hide resolved
...ion/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.component.tsx
Outdated
Show resolved
Hide resolved
...question/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.test.tsx
Outdated
Show resolved
Hide resolved
...question/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.test.tsx
Outdated
Show resolved
Hide resolved
...question/question-form/rendering-types/inputs/workspace-launcher/workspace-launcher.test.tsx
Outdated
Show resolved
Hide resolved
… callback pattern - Remove unnecessary test setup - Use userEvent instead of fireEvent in tests
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.
Thanks @rdwaynedehoedt! One last thing :)
await user.clear(workspaceNameInput); | ||
await user.type(workspaceNameInput, newValue); | ||
|
||
expect(mockSetFormField).toHaveBeenCalled(); |
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.
This is good to have, but we can make it a bit better by checking if it got called with the right object. Here's a place where you can use for guidance -
Lines 115 to 129 in d80c228
// Gets all calls made to our mock function, the arguments from the first call and the first argument of the first call | |
const updateFn = mockSetFormField.mock.calls[0][0]; | |
// Execute the update function with the previous state | |
const resultState = updateFn(formField); | |
// Check that the result has the expected values | |
expect(resultState).toEqual({ | |
...formField, | |
datePickerFormat: 'calendar', | |
questionOptions: { | |
...formField.questionOptions, | |
concept: '456', | |
}, | |
}); |
Pinging @rdwaynedehoedt, are you stuck on any part of updating the tests, if so do let me know and I'll try to help out |
Requirements
Summary
This PR implements the workspace-launcher rendering type for form questions as specified in O3-4315. The workspace-launcher allows form creators to add buttons that launch different workspaces or sub-forms within the OpenMRS application, enhancing clinical workflow integration.
The implementation includes:
workspace-launcher.component.tsx
component with input fields forbuttonLabel
andworkspaceName
QuestionOptions
interface intypes.ts
to include these new propertiesThis feature is part of the O3 Form Builder v3 epic (O3-1144).
Related Issue
https://openmrs.atlassian.net/browse/O3-4315
Other
The workspace-launcher rendering type follows the specified JSON structure: