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

Add a Tester class for VirtualList component #1721

Closed
mshabarov opened this issue Jan 8, 2024 · 2 comments · Fixed by #1797
Closed

Add a Tester class for VirtualList component #1721

mshabarov opened this issue Jan 8, 2024 · 2 comments · Fixed by #1797
Assignees
Labels
enhancement UITest JUnit testing the UI

Comments

@mshabarov
Copy link
Contributor

Create a Tester class for VirtualList

@mshabarov mshabarov added enhancement UITest JUnit testing the UI labels Jan 8, 2024
@joelpop joelpop self-assigned this Apr 17, 2024
@joelpop
Copy link
Collaborator

joelpop commented Apr 17, 2024

What methods should VirtualListTester support?

Because VirtualList is really just a display component (non-interactive), there won't be any methods to set, clear, or select things. Looking at the non-interactive methods of GridTester for inspiration, candidate methods to consider supporting are:

  • int size()
  • T getItem(int index)
  • String getItemText(int index)
  • Component getItemComponent(int index)
  • <V> V getLitRendererPropertyValue(int index, String propertyName, Class<V> propertyClass)
  • void invokeLitRendererFunction(int index, String functionName)

In order to support the latter two, VirtualList must be changed to implement and publicly expose a getRenderer method as Grid.Column does.

Please provide your thoughts on what methods should or shouldn't be provided by this tester, and if you have alternate suggestions for their names and/or parameter names.

@MatthewVaadin
Copy link

At least for the use cases we require, the last two methods would not be necessary. The rest of the API looks perfect for the tests we want to write.

joelpop added a commit that referenced this issue May 21, 2024
mcollovati pushed a commit that referenced this issue May 21, 2024
Adds VirtualListTester to enable VirtualLists to be unit tested with TestBench.

As this tester and GridTester both support LitRenderers, the common code from GridTester was extracted to a utility class so it could be shared by both testers.

Fixes #1721
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement UITest JUnit testing the UI
Projects
Development

Successfully merging a pull request may close this issue.

3 participants