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

test: add a test for item click on edit column cell #6331

Merged
merged 2 commits into from
May 29, 2024

Conversation

tomivirkki
Copy link
Member

@tomivirkki tomivirkki commented May 29, 2024

Description

Add a test case to verify vaadin/web-components#7453 fixes the item click listener regression in Grid Pro which manifested after this addition to the grid connector.

Related to vaadin/web-components#637

Type of change

Tests

Comment on lines 150 to 156
GridTHTDElement cell = grid.getCell(0, 2);
cell.click();

assertCellEnterEditModeOnDoubleClick(0, 2, "vaadin-combo-box");
String eventsPanelText = getPanelText("events-panel");
Assert.assertEquals(1, eventsPanelText.split("ItemClicked").length - 1);
Assert.assertTrue(eventsPanelText
Copy link
Contributor

@vursen vursen May 29, 2024

Choose a reason for hiding this comment

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

nit: Could the test be made slightly stricter?

Suggested change
GridTHTDElement cell = grid.getCell(0, 2);
cell.click();
assertCellEnterEditModeOnDoubleClick(0, 2, "vaadin-combo-box");
String eventsPanelText = getPanelText("events-panel");
Assert.assertEquals(1, eventsPanelText.split("ItemClicked").length - 1);
Assert.assertTrue(eventsPanelText
GridTHTDElement cell = grid.getCell(0, 2);
cell.click();
Assert.assertEquals(1, eventsPanelText.split("ItemClicked").length - 1);
assertCellEnterEditModeOnDoubleClick(0, 2, "vaadin-combo-box");
String eventsPanelText = getPanelText("events-panel");
Assert.assertEquals(1, eventsPanelText.split("ItemClicked").length - 1);
Assert.assertTrue(eventsPanelText

Copy link
Member Author

@tomivirkki tomivirkki May 29, 2024

Choose a reason for hiding this comment

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

That assertCellEnterEditModeOnDoubleClick line serves no purpose in the test at all. The helper method doesn't actually perform a double-click on the line but dispatches a "dblclick" event manually.

Removed the accidental line altogether since it isn't related to the test case. An actual double-click on the row would dispatch 2 additional item click listener invocations.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@tomivirkki tomivirkki merged commit 42cce0a into main May 29, 2024
5 checks passed
@tomivirkki tomivirkki deleted the test/grid-pro/edit-column-cell-item-click-listener branch May 29, 2024 10:19
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.

4 participants