-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix selected cluster type ui in Checks catalog view #3229
Conversation
97146d2
to
94f552c
Compare
94f552c
to
7543726
Compare
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.
Sweet!
eb332f5
to
b812f47
Compare
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 @EMaksy!
b812f47
to
d79e746
Compare
@@ -93,12 +93,15 @@ context('Checks catalog', () => { | |||
}); | |||
|
|||
describe('Filtering', () => { | |||
const selectedIconSelector = |
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 @EMaksy :
why did you create this constant and put in all the array entries?
I mean, you could simply have the constant and use it in the test, right?
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.
Very fair point, when working on this first i thought the ui selector would be different, but nope.
You are right we can just test directly, will create a follow up pr
Description
This pr will restore the previous ui behaviour in the checks catalog view. When selecting a cluster type in the checks catalog the green svg icon is not rendered.
With the latest changes in #3210 we now not only pass a string as value, which was handled by the built in headless ui
selected
boolean, but also an object{ type, hanaScenario }
. Check out the official docs https://headlessui.com/v1/react/listbox#listbox-optionWith using the lodash isEqual we now use a "deep comparison" to ensure accurate evaluation of selected options.
For this we use the "by" value provided by Listbox:
You can also pass your own comparison function to the by prop if you'd like complete control over how objects are compared
Source: https://headlessui.com/v1/react/listbox#binding-objects-as-values
Demo:
Screencast.From.2025-01-14.17-16-08.mp4
Test
Enriched existing e2e test to test that the SVG is rendered