Skip to content

Commit

Permalink
[se] Fix bug 61855
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitryOrlov committed Jan 29, 2025
1 parent 632ccae commit 344ac2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,15 @@
}
}

/* If we haven't received the formulaResult, calculate with those arguments that exist in the array */
if (res && !res.functionResult && args && sArguments) {
let defaultRes = ws.calculateWizardFormula(name + '(' + sArguments + ')');
res.functionResult = defaultRes ? defaultRes.str : "";
if (defaultRes.obj && defaultRes.obj.type !== AscCommonExcel.cElementType.error) {
res.formulaResult = defaultRes.str;
}
}

return res;
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/cell/spreadsheet-calculation/SheetStructureTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3337,6 +3337,17 @@ $(function () {
wb.dependencyFormulas._foreachDefName(function(defName) {
wb.dependencyFormulas.removeDefName(undefined, defName.name);
});

// for bug 61855
let insertArgsRes = api.wb.insertArgumentsInFormula(["1"], 0, 0, "SUM", true/*bEndInsertArg*/);
assert.strictEqual(insertArgsRes && insertArgsRes.functionResult, "1", "Calculation result for SUM function when insert first argument in formula");

insertArgsRes = api.wb.insertArgumentsInFormula(["1,2"], 1, 0, "SUM", true);
assert.strictEqual(insertArgsRes && insertArgsRes.functionResult, "3", "Calculation result for SUM function when insert second argument in formula");

insertArgsRes = api.wb.insertArgumentsInFormula(["1"], 1, 0, "SUM", true);
assert.strictEqual(insertArgsRes && insertArgsRes.functionResult, "1", "Calculation result for SUM function when delete second argument in formula");

});

QUnit.test('autoCompleteFormula', function (assert) {
Expand Down

0 comments on commit 344ac2b

Please sign in to comment.