You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/10/01 15:05:55 UTC
(superset) 03/04: fix(dataset-editor): type editor callbacks, fix ambiguous modal-trigger test query
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix-datasource-editor-sort-and-stale-sql
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d11b023b9ff889ed170d29b81c66421dfc274df6
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Oct 1 04:21:13 2026 -0700
fix(dataset-editor): type editor callbacks, fix ambiguous modal-trigger test query
TextAreaEditor's onLoad/onChange prop types resolve to any through the
AsyncAceEditor HOC, so the wrapping arrow functions need explicit param
types to satisfy noImplicitAny.
The new "edit in modal" test matched role="button" by accessible name,
but ModalTrigger wraps a <Button> triggerNode in its own
role="button" div, producing two matches; target the wrapper's
data-test id instead, consistent with the existing close-modal-btn query.
Co-Authored-By: Evan Rusackas <ev...@preset.io>
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.../src/explore/components/controls/TextAreaControl.test.tsx | 6 +++++-
.../src/explore/components/controls/TextAreaControl.tsx | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx b/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
index ae6d33c8a7a..88003970373 100644
--- a/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
@@ -178,7 +178,11 @@ describe('TextArea', () => {
// mounts and is destroyed (destroyOnHidden) in the process; this used
// to leave the single shared editor ref pointing at that destroyed
// instance instead of the still-visible inline editor.
- fireEvent.click(screen.getByRole('button', { name: /edit.*in modal/i }));
+ // ModalTrigger wraps its triggerNode in its own role="button" element,
+ // so a <Button> triggerNode (as used here) yields two nested elements
+ // matching role "button" with the same accessible name; target the
+ // wrapper directly via its data-test id instead.
+ fireEvent.click(screen.getByTestId('span-modal-trigger'));
await waitFor(() => {
expect(container.querySelectorAll('.ace_editor')).toHaveLength(2);
});
diff --git a/superset-frontend/src/explore/components/controls/TextAreaControl.tsx b/superset-frontend/src/explore/components/controls/TextAreaControl.tsx
index 82670b20bda..96467b8b9dc 100644
--- a/superset-frontend/src/explore/components/controls/TextAreaControl.tsx
+++ b/superset-frontend/src/explore/components/controls/TextAreaControl.tsx
@@ -300,12 +300,16 @@ function TextAreaControl({
minLines={effectiveMinLines}
maxLines={inModal ? 1000 : maxLines}
editorProps={{ $blockScrolling: true }}
- onLoad={editor => onEditorLoad(editor, inModal)}
+ onLoad={(editor: AceEditorHandle) =>
+ onEditorLoad(editor, inModal)
+ }
defaultValue={initialValue ?? value}
readOnly={readOnly}
key={name}
{...restProps}
- onChange={val => handleChange(val, inModal)}
+ onChange={(val: string | { target: { value: string } }) =>
+ handleChange(val, inModal)
+ }
/>
</div>
</EditorUnmountGuard>