Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/helpers/reference_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Token } from "../formulas";
import { EnrichedToken, composerTokenize } from "../formulas/composer_tokenizer";
import { Locale } from "../types";
import { getCanonicalSymbolName } from "./misc";
import { getFullReference, splitReference } from "./references";

type FixedReferenceType = "col" | "row" | "colrow" | "none";
Expand Down Expand Up @@ -53,7 +54,7 @@ function getTokenNextReferenceType(xc: string): string {
export function setXcToFixedReferenceType(xc: string, referenceType: FixedReferenceType): string {
let sheetName;
({ sheetName, xc } = splitReference(xc));
sheetName = sheetName ? sheetName + "!" : "";
sheetName = sheetName ? getCanonicalSymbolName(sheetName) + "!" : "";

xc = xc.replace(/\$/g, "");
const splitIndex = xc.indexOf(":");
Expand Down
8 changes: 8 additions & 0 deletions tests/composer/standalone_composer_component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ describe("Spreadsheet integrations tests", () => {
expect(composerEl.textContent).toBe("=Sheet1!A1");
});

test("content with references from another sheet having space in name adds single quotes", async () => {
await openSidePanelWithComposer({ defaultStatic: true });
await editStandaloneComposer(composerSelector, "=", { confirm: false });
createSheet(model, { sheetId: "sheet2", name: "second sheet", activate: true });
await simulateClick(".o-grid-overlay", 300, 200);
expect(composerEl.textContent).toBe("='second sheet'!$D$9");
});

test("display the content from the props when inactive", async () => {
await openSidePanelWithComposer({ composerContent: "content from props" });
await editStandaloneComposer(composerSelector, "edited", { confirm: false });
Expand Down