Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] range: Support ranges with no Rangeparts #3459

Closed
wants to merge 1 commit into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plugins/core/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ export class RangeAdapter implements CommandHandler<CoreCommand> {
* Get a Xc string that represent a part of a range
*/
private getRangePartString(range: RangeImpl, part: 0 | 1): string {
const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);

let str = "";
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/range.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ describe("range plugin", () => {
expect(m.getters.getRangeString(undefined, "not there")).toBe(INCORRECT_RANGE_STRING);
});

test("requesting a range without parts", () => {
const r = m.getters.getRangeFromSheetXC("s1", "A1");
const rNoParts = r.clone({ parts: [] });
expect(m.getters.getRangeString(rNoParts, "forceSheetName")).toBe("s1!A1");
});

test.each(["Sheet 0", "<Sheet1>", "&Sheet2", "Sheet4;", "Sheet5🐻"])(
"sheet name with special character %s",
(name) => {
Expand Down