(core) Fix bug with pasting in the presence of link-filtering.

Summary:
The bug manifested when multiple grid cells were selected, and then user
selected a record in another section that caused the grid to show a different
set of rows. Paste would then go into multiple rows even when they are not
visibly selected.

The test includes some porting of hacks from old browser tests to support
copy-pasting. In particular gu.sendKeys() is a useful alternative to
driver.find('body').sendKeys() which we've been using to work around
driver.sendKeys() limitations, but which apparently causes flakiness with
focus.

Test Plan: Browser test reproduces the bug before the fix.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2692
pull/3/head
Dmitry S 4 years ago
parent 9f806de64b
commit 12a7059bde

@ -212,7 +212,7 @@ function BaseView(gristDoc, viewSectionModel, options) {
}));
// Reset cursor to the first row when filtering changes.
this.autoDispose(this._linkingFilter.subscribe((x) => this.setCursorPos({rowIndex: 0})));
this.autoDispose(this._linkingFilter.subscribe((x) => this.onLinkFilterChange()));
// When sorting changes, reset the cursor to the first row. (The alternative of moving the
// cursor to stay at the same record is sometimes better, but sometimes more annoying.)
@ -604,6 +604,13 @@ BaseView.prototype.onResize = function() {
BaseView.prototype.onRowResize = function(rowModels) {
};
/**
* Called when user selects a different row which drives the link-filtering of this section.
*/
BaseView.prototype.onLinkFilterChange = function(rowId) {
this.setCursorPos({rowIndex: 0});
};
/**
* Called before and after printing this section.
*/

@ -963,6 +963,11 @@ GridView.prototype.onRowResize = function(rowModels) {
this.scrolly.resetItemHeights(rowModels);
};
GridView.prototype.onLinkFilterChange = function(rowId) {
BaseView.prototype.onLinkFilterChange.call(this, rowId);
this.clearSelection();
};
// ======================================================================================
// SELECTOR STUFF

Loading…
Cancel
Save