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

Keep expand/collapse state of tree nodes when changing the tree filter #1173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rowo360
Copy link
Contributor

@rowo360 rowo360 commented Jan 15, 2025

This PR is another contribution to the test filter functionality (#1148, #1161, #1147).

This PR propose to keep the expand/collapse state of the tree nodes constant, whenever a test filter is modified. For example if a user expanded certain tree nodes and afterwards apply a test filter, all those tree nodes which are still visible after the filtering should remain their expand/collapse state.

The idea is that the user is familiar with the view after the filtering and does not have to adjust the expand/collapse state again right away. So overal this PR tries to improve the usability when working with test filters.

@rowo360
Copy link
Contributor Author

rowo360 commented Jan 15, 2025

I have the impression that I don't have to invent anything new for this functionality. Instead the expand/collapse state is already handled by the VisualState file, so I just want to apply it in this use case.

Whenever a test filter is modified, the DisplayStrategy.Reload() method is invoked. This method in turn calls the OnTestLoaded(TestNode, VisualState) method. So far the second parameter was set to null, which means that some default handling for expanding/collapsing tree nodes is applied.
Now I determine the VisualState first and pass it to the OnTestLoaded method - that's all to keep the expand/collapse state constant.

@rowo360
Copy link
Contributor Author

rowo360 commented Jan 15, 2025

Just for the sake of completeness here are two screenshots showing the existing code when no VisualState is passed to the OnTestLoaded() method:

@rowo360 rowo360 self-assigned this Jan 18, 2025
@rowo360 rowo360 requested a review from CharliePoole January 18, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant