-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(rules): rules can be enabled/disabled #533
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.
Look great to me!
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.
It looks good to me as well.
521295a
to
26ede8a
Compare
Rebased and added a small commit that uses the WebSocket notification channel to update the rules table to reflect the rules' updated state, rather than refreshing the whole table with a GET query. |
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.
Looks good :D Probably, we should a test to check the UI when receiving the new RuleUpdated
notifications?
I'm having a hard time getting that test to work. Within the testing context it seems like the switch's styling isn't rendering how I expect it to, and in the DOM both the "on" and "off" states of the switch appear to be visible at the same time... |
Oh yess interesting! I guess we could find the span element with class |
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.
Feels and looks good!
That's what I've been trying. I committed the current state of my test, but skipped so that it doesn't fail the build. At the end of const labels = container.querySelectorAll('label');
expect(labels).toHaveLength(1);
const label = labels[0];
const spans = label.querySelectorAll(':scope > .pf-c-switch__label');
expect(spans).toHaveLength(2);
const onState = label.querySelector(':scope > .pf-c-switch__label.pf-m-on');
expect(onState).toBeInTheDocument();
expect(onState).not.toBeVisible();
const offState = label.querySelector(':scope > .pf-c-switch__label.pf-m-off');
expect(offState).toBeInTheDocument();
expect(offState).toBeVisible(); but, both |
I guess those elements are hidden by the Patternfly css applying |
Heh. Yea, the reason I set the label explicitly to the empty string is that if it isn't specified then the component falls back to displaying the I could remove both the |
Right! Make sense! But I think probably there is an icon in-place if label is not set https://www.patternfly.org/v4/components/switch/#without-label? Though, this would not solve the issue. I checked the element style in |
I think so. I don't think any CSS even gets loaded by our test setup. The real application hooks the css in in |
Just went throught some js-dom issue and saw this: testing-library/jest-dom#209 (comment). Could be the root issue? I guess a hack for test would be adding an additional class in |
That issue sounds related and perhaps would be a blocker for any fix on our end where we do try to load the PF CSS. Anyway, hacking it by adding a specific |
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.
Looks good :D
Fixes #525