if a sheet is removed or moved, re-request comment positions

a problem since:

commit 72b2ce4bb6
Author: Caolán McNamara <caolan.mcnamara@collabora.com>
Date:   Wed Oct 25 19:19:08 2023 +0100
    we don't need to round-trip through core to reposition notes

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If00ae17a8e80ca3f8d2a530efa6cdba90207be56
This commit is contained in:
Caolán McNamara 2024-04-17 21:38:05 +01:00 committed by Miklos Vajna
parent 06a6059235
commit b95395434e
2 changed files with 24 additions and 0 deletions

View file

@ -440,7 +440,12 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({
this._documentInfo = textMsg;
var partNames = textMsg.match(/[^\r\n]+/g);
// only get the last matches
var oldPartNames = this._partNames;
this._partNames = partNames.slice(partNames.length - this._parts);
// if the number of parts, or order has changed then refresh comment positions
if (oldPartNames !== this._partNames) {
app.socket.sendMessage('commandvalues command=.uno:ViewAnnotationsPosition');
}
this._map.fire('updateparts', {
selectedPart: this._selectedPart,
parts: this._parts,

View file

@ -2,6 +2,7 @@
var helper = require('../../common/helper');
var desktopHelper = require('../../common/desktop_helper');
var calcHelper = require('../../common/calc_helper');
describe(['tagdesktop'], 'Annotation Tests', function() {
var origTestFileName = 'annotation.ods';
@ -82,6 +83,24 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
cy.cGet('body').contains('.context-menu-item','Remove').click();
cy.cGet('#comment-container-1').should('not.exist');
});
it('Delete then Create Sheet should not retain comment',function() {
calcHelper.assertNumberofSheets(1);
cy.cGet('#spreadsheet-toolbar #insertsheet').click();
calcHelper.assertNumberofSheets(2);
desktopHelper.insertComment();
cy.cGet('.cool-annotation').should('exist');
calcHelper.selectOptionFromContextMenu('Delete Sheet...');
cy.cGet('#delete-sheet-modal-response').click();
calcHelper.assertNumberofSheets(1);
cy.cGet('#spreadsheet-toolbar #insertsheet').click();
calcHelper.assertNumberofSheets(2);
cy.cGet('#comment-container-1').should('not.exist');
});
});
describe(['tagdesktop'], 'Annotation Autosave Tests', function() {