Skip to content

feat: add GridSorterElement and GridTHTDElement.getSorter() - #10378

Merged
sissbruecker merged 1 commit into
mainfrom
feat/grid-sorter-testbench-element
Oct 9, 2026
Merged

sissbruecker merged 1 commit into
mainfrom
feat/grid-sorter-testbench-element

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review risk: two-way door — additive TestBench API in vaadin-grid-testbench plus test-only changes; no impact on the Grid component itself.

Summary

Adds a TestBench element for <vaadin-grid-sorter> and a getter on header cells, so you can sort a Grid column in a TestBench test with grid.getHeaderCell(0).getSorter().click() and check the sort state without querying the sorter by tag name. Clicking the header cell itself does nothing, since only the sorter reacts to clicks.

What changed

  • New GridSorterElement (@Element("vaadin-grid-sorter")) with isAscending() and isDescending().
  • New GridTHTDElement.getSorter(), which returns the cell's sorter, or null when the cell has no sorter (following the TestBench convention of returning null for absent elements).
  • Grid and TreeGrid sorting-related integration tests now use the new API in place of $("vaadin-grid-sorter"), findElements(By.tagName("vaadin-grid-sorter")), raw direction property checks, and an inline JS helper.

Test summary

  • Ran every updated Grid/TreeGrid integration test class locally in headless Chrome: 87 tests, all passing.
  • The getSorter() returning-null path is exercised by the filtering and header/footer row tests, which check that a header cell has no sorter.

API Changes

com.vaadin.flow.component.grid.testbench.GridSorterElement

// Added
@Element("vaadin-grid-sorter") public class GridSorterElement extends TestBenchElement
public boolean isAscending()
public boolean isDescending()

com.vaadin.flow.component.grid.testbench.GridTHTDElement

// Added
public GridSorterElement getSorter() // null if the cell has no sorter

Fixes #7450

🤖 Generated with Claude Code

Add a TestBench element for <vaadin-grid-sorter> with isAscending()
and isDescending() helpers, and a getSorter() getter on header cells
that returns null when the cell has no sorter. Update the Grid
sorting integration tests to use the new API instead of querying
the sorter by tag name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@TatuLund
TatuLund marked this pull request as ready for review October 8, 2026 15:15

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Nothing to flag — the changes look good.

@sissbruecker
sissbruecker self-requested a review October 9, 2026 08:09
@sissbruecker
sissbruecker added this pull request to the merge queue Oct 9, 2026
@sissbruecker
sissbruecker removed this pull request from the merge queue due to a manual request Oct 9, 2026
@sissbruecker
sissbruecker added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit d35f49b Oct 9, 2026
27 checks passed
@sissbruecker
sissbruecker deleted the feat/grid-sorter-testbench-element branch October 9, 2026 09:07
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.4.0-alpha3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid Header click() does nothing - should sort column

3 participants