From 2c93eafa44f653f02f353bf34d8754bbeb1a333f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Fri, 14 May 2021 20:53:36 +0200 Subject: [PATCH] (core) Null or undefined value on the Integer / Numeric cell Summary: Text editor for Integer and Numeric column was showing null or undefined when the underlying value was null. Test Plan: Browser test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2817 --- app/client/widgets/NTextEditor.ts | 2 +- app/client/widgets/TextEditor.js | 2 +- test/nbrowser/gristUtils.ts | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/client/widgets/NTextEditor.ts b/app/client/widgets/NTextEditor.ts index 874adff0..7a006150 100644 --- a/app/client/widgets/NTextEditor.ts +++ b/app/client/widgets/NTextEditor.ts @@ -33,7 +33,7 @@ export class NTextEditor extends NewBaseEditor { this._contentSizer = dom('div.celleditor_content_measure'), this.textInput = dom('textarea', dom.cls('celleditor_text_editor'), dom.style('text-align', this._alignment), - dom.prop('value', undefDefault(options.editValue, String(options.cellValue))), + dom.prop('value', undefDefault(options.editValue, String(options.cellValue ?? ""))), this.commandGroup.attach(), // Resize the textbox whenever user types in it. dom.on('input', () => this.resizeInput()) diff --git a/app/client/widgets/TextEditor.js b/app/client/widgets/TextEditor.js index d261d7cd..48f0f248 100644 --- a/app/client/widgets/TextEditor.js +++ b/app/client/widgets/TextEditor.js @@ -39,7 +39,7 @@ function TextEditor(options) { this.textInput = dom('textarea.celleditor_text_editor', kd.attr('placeholder', options.placeholder || ''), kd.style('text-align', this._alignment), - kd.value(gutil.undefDefault(options.editValue, String(options.cellValue))), + kd.value(gutil.undefDefault(options.editValue, String(options.cellValue == null ? "" : options.cellValue))), this.commandGroup.attach(), // Resize the textbox whenever user types in it. diff --git a/test/nbrowser/gristUtils.ts b/test/nbrowser/gristUtils.ts index 773b7e4f..f00705e2 100644 --- a/test/nbrowser/gristUtils.ts +++ b/test/nbrowser/gristUtils.ts @@ -1422,6 +1422,20 @@ export function hexToRgb(hex: string) { return `rgba(${r}, ${g}, ${b}, 1)`; } +/** + * Adds new column to the table. + * @param name Name of the column + */ +export async function addColumn(name: string) { + await scrollIntoView(await driver.find('.active_section .mod-add-column')); + await driver.find('.active_section .mod-add-column').click(); + await waitForServer(); + await waitAppFocus(false); + await driver.sendKeys(name); + await driver.sendKeys(Key.ENTER); + await waitForServer(); +} + } // end of namespace gristUtils