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 test for selection of cells outside of the viewport. #535

Merged
merged 14 commits into from
Aug 22, 2019

Conversation

shammamah-zz
Copy link
Contributor

@shammamah-zz shammamah-zz commented Aug 6, 2019

Closes #520.

About

  • Added two tests to replicate the behaviour described in Error selecting cell in virtualized table #447.
  • Changed data-dash-row to point to the actual row in the data as opposed to the row number in the viewport.
  • Added new functions to scroll the table all the way to the bottom/top.

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-535 August 6, 2019 17:56 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-535 August 7, 2019 13:51 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-535 August 7, 2019 14:25 Inactive
@shammamah-zz shammamah-zz temporarily deployed to dash-table-review-pr-535 August 7, 2019 16:41 Inactive
@shammamah-zz shammamah-zz temporarily deployed to dash-table-review-pr-535 August 7, 2019 16:51 Inactive
@shammamah-zz shammamah-zz temporarily deployed to dash-table-review-pr-535 August 7, 2019 16:56 Inactive
@shammamah-zz shammamah-zz temporarily deployed to dash-table-review-pr-535 August 7, 2019 17:14 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-535 August 8, 2019 13:11 Inactive
@@ -28,7 +28,7 @@ class Wrappers {
(column, columnIndex) => this.getWrapper(
false,
false,
rowIndex,
rowIndex + _offset.rows,
Copy link
Contributor

Choose a reason for hiding this comment

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

You can rename _offset to offset. The underscore was there to prevent tslint from flagging it as an unused parameter since it was required for caching purposes but not when calculating.

for (let i = 0; i < 25; i++) {
DOM.focused.type(Key.ArrowDown);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Nothing specific is being validated here. If the down arrow causes an error and/or does not update the selection the test will not fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested this with the version of the table that had this error, and the test did end up failing, since there is a console error (which I thought would be implicitly included in the test failure conditions). Is there another way to catch console errors?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! You're right. Unhandled errors cause the tests to fail by default - did not realize that was the case.
https://docs.cypress.io/api/events/catalog-of-events.html#To-turn-off-all-uncaught-exception-handling

Copy link
Contributor

Choose a reason for hiding this comment

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

Would still like the test do more validation. The implementation could change and the error be swallowed instead of being unhandled. The test would not fail in that case.

@@ -100,6 +107,14 @@ Object.values(BasicModes).forEach(mode => {
DashTable.getCell(4, 2).should('have.class', 'focused');
DashTable.getCell(3, 1).should('not.have.class', 'focused');
});

it('can select a cell outside of the viewport', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the test name could be improved. It's not about selecting a cell outside of viewport but rather about selecting a cell and scrolling it out of the viewport.

Like for the test above, would be interested in checking if there are console errors triggered by these steps. Maybe something like: cypress-io/cypress#300 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

@shammamah From your comment in https://github.com/plotly/dash-table/pull/535/files#r315342988, the console error part is moot.

Co-Authored-By: Marc-André Rivet <Marc-Andre-Rivet@users.noreply.github.com>
@shammamah-zz shammamah-zz merged commit 76af305 into master Aug 22, 2019
@shammamah-zz shammamah-zz deleted the viewport-error-test branch August 22, 2019 19: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.

Virtualized table error when navigating past the lower edge of the viewport
3 participants