From 96b3e26f2b57ab61eebdf0ad756844ef25e5392b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir=20=28rar=29?= Date: Tue, 21 Jan 2025 10:53:37 +0000 Subject: [PATCH] [FIX] GridComposer: Fix CellReference pill display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit How to reproduce: - Select a large zone (more than 1 cell) on the grid - Hit enter to start the edition => the cell reference pill is visible even though it functionally should only be visible if we scrolled (changed sheet) while editing. closes odoo/o-spreadsheet#5502 Task: 4501136 X-original-commit: 2754a7c2c15619e3887eb19b7b2c08a94dbdeaed Signed-off-by: Lucas Lefèvre (lul) Signed-off-by: Rémi Rahir (rar) --- src/components/composer/grid_composer/grid_composer.ts | 2 +- tests/composer/composer_integration_component.test.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/composer/grid_composer/grid_composer.ts b/src/components/composer/grid_composer/grid_composer.ts index 59ec0890d3..35bd2d63ec 100644 --- a/src/components/composer/grid_composer/grid_composer.ts +++ b/src/components/composer/grid_composer/grid_composer.ts @@ -200,7 +200,7 @@ export class GridComposer extends Component { return; } const sheetId = this.env.model.getters.getActiveSheetId(); - const zone = this.env.model.getters.getSelectedZone(); + const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell); const rect = this.env.model.getters.getVisibleRect(zone); if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) { this.isCellReferenceVisible = true; diff --git a/tests/composer/composer_integration_component.test.ts b/tests/composer/composer_integration_component.test.ts index d542279d30..e3b0b21624 100644 --- a/tests/composer/composer_integration_component.test.ts +++ b/tests/composer/composer_integration_component.test.ts @@ -21,6 +21,7 @@ import { resizeRows, selectCell, setCellContent, + setSelection, setStyle, } from "../test_helpers/commands_helpers"; import { @@ -248,6 +249,7 @@ describe("Composer interactions", () => { }); test("Starting the edition should not display the cell reference", async () => { + setSelection(model, ["A1:A2"]); await startComposition(); expect(fixture.querySelector(".o-grid div.o-cell-reference")).toBeNull(); });