mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
[se] Fix bug 61855 (#590)
[se] Fix bug 61855 Co-authored-by: Dmitriy Orlov <dmitriy.orlov@onlyoffice.com> Co-committed-by: Dmitriy Orlov <dmitriy.orlov@onlyoffice.com>
This commit is contained in:
committed by
Igor Zotov
parent
6a318af1d9
commit
5c3ecc4053
@ -3244,16 +3244,17 @@
|
||||
this.cellEditor.changeCellText(sArguments);
|
||||
|
||||
if (name) {
|
||||
|
||||
var res = new AscCommonExcel.CFunctionInfo(name);
|
||||
let res = new AscCommonExcel.CFunctionInfo(name);
|
||||
if (needChange) {
|
||||
res.asc_setArguments(args);
|
||||
}
|
||||
res.argumentsResult = [];
|
||||
var argCalc = ws.calculateWizardFormula(args[argNum], argType);
|
||||
let argCalc = ws.calculateWizardFormula(args[argNum], argType);
|
||||
res.argumentsResult[argNum] = argCalc.str;
|
||||
if (argCalc.obj && argCalc.obj.type !== AscCommonExcel.cElementType.error) {
|
||||
var funcCalc = ws.calculateWizardFormula(name + '(' + sArguments + ')');
|
||||
//second condition: if we haven't received the formulaResult, calculate with those arguments that exist in the array
|
||||
if ((argCalc.obj && argCalc.obj.type !== AscCommonExcel.cElementType.error) ||
|
||||
(argCalc.obj === null && res && !res.functionResult && args && sArguments)) {
|
||||
let funcCalc = ws.calculateWizardFormula(name + '(' + sArguments + ')');
|
||||
res.functionResult = funcCalc.str;
|
||||
if (funcCalc.obj && funcCalc.obj.type !== AscCommonExcel.cElementType.error) {
|
||||
res.formulaResult = ws.calculateWizardFormula(this.cellEditor.getText().substring(1)).str;
|
||||
|
||||
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user