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
pull/8828/head
Caolán McNamara 2024-04-17 21:38:05 +01:00 committed by Michael Meeks
parent c63deba8aa
commit c6fbf7e91b
2 changed files with 24 additions and 0 deletions

View File

@ -445,7 +445,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

@ -3,6 +3,7 @@
var helper = require('../../common/helper');
var { insertMultipleComment, setupUIforCommentInsert, createComment } = require('../../common/desktop_helper');
var desktopHelper = require('../../common/desktop_helper');
var calcHelper = require('../../common/calc_helper');
describe(['tagdesktop'], 'Annotation Tests', function() {
var origTestFileName = 'annotation.ods';
@ -83,6 +84,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('#tb_spreadsheet-toolbar_item_insertsheet').click();
calcHelper.assertNumberofSheets(2);
insertMultipleComment('calc', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation').should('exist');
calcHelper.selectOptionFromContextMenu('Delete Sheet...');
cy.cGet('#delete-sheet-modal-response').click();
calcHelper.assertNumberofSheets(1);
cy.cGet('#tb_spreadsheet-toolbar_item_insertsheet').click();
calcHelper.assertNumberofSheets(2);
cy.cGet('#comment-container-1').should('not.exist');
});
});
describe(['tagdesktop'], 'Annotation Autosave Tests', function() {