Skip to content
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

Turning switch on/off does not change anything in DOM #2669

Closed
abalakh opened this issue Aug 8, 2019 · 6 comments · Fixed by #2749
Closed

Turning switch on/off does not change anything in DOM #2669

abalakh opened this issue Aug 8, 2019 · 6 comments · Fixed by #2749
Assignees
Labels
PF4 React issues for the PF4 core effort

Comments

@abalakh
Copy link
Contributor

abalakh commented Aug 8, 2019

I'm looking at examples in docs (both patternfly-react.surge.sh and patternfly.org). Switch's input is loaded with or without "checked" attribute (<input class="pf-c-switch__input" ... checked>), but when changing switch state that attr is not added/removed. No classes or anything else are updated as well.
Moreover, both labels (for "on" and "off" states) are present in DOM at the same time, so from test automation perspective i have no idea what state switch is currently in and which label is actually shown.
Making "checked" attr reflect actual switch state (or intoducing some other attr/class/etc) would help a lot.

@abalakh
Copy link
Contributor Author

abalakh commented Aug 8, 2019

Optionally, some attr in labels like "hidden=True" would make it easier to determine what label is shown, and i won't have to write some complex xpath like /span[contains(@class, 'pf-m-on') and preceding-sibling::input[@checked] or contains(@class, 'pf-m-off') and preceding-sibling::input[not(@checked)]] to figure that out. But even such weird xpath will only work if checked actually reflects switch state.

@rachael-phillips
Copy link
Contributor

Hi @abalakh is this bug for PF3 or PF4? Are you currently blocked at this time because of this bug?

@abalakh
Copy link
Contributor Author

abalakh commented Aug 8, 2019

@rachael-phillips PF4 (here or here).
Not currently blocked as i'm just adding support for Switch in our automation, so far it's not yet used in our tests AFAIK, but soon will be for sure, we have switches present on webUI, so if you ask to determine hi/med/low priority, i'd say medium for now.

@rachael-phillips
Copy link
Contributor

Thank you! That's super helpful.

@rachael-phillips
Copy link
Contributor

@abalakh can I close this issue since #39 has merged?

@abalakh
Copy link
Contributor Author

abalakh commented Aug 20, 2019

@rachael-phillips no, that's what i've mentioned in #2669 (comment), it works for initial switch state, but if user clicks the switch - framework won't be able to figure out the state has changed as nothing changes in DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PF4 React issues for the PF4 core effort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants