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:56 UTC
(superset) 04/04: fix(dataset-editor): query document, not container, for modal's Ace editor
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 5148c2b7da670589c77eaec11b498ddcb1965027
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Oct 1 07:57:19 2026 -0700
fix(dataset-editor): query document, not container, for modal's Ace editor
The underlying antd Modal (no getContainer override) portals its content
to document.body rather than rendering inside RTL's container, so the
new open/close regression test's container.querySelectorAll('.ace_editor')
assertions could never see the modal's Ace instance mount and timed out.
Co-Authored-By: Evan Rusackas <ev...@preset.io>
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.../src/explore/components/controls/TextAreaControl.test.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx b/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
index 88003970373..76d791ed03c 100644
--- a/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/TextAreaControl.test.tsx
@@ -183,12 +183,16 @@ describe('TextArea', () => {
// 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'));
+ // The underlying antd Modal (no `getContainer` override) portals its
+ // content to `document.body` rather than rendering inside RTL's
+ // `container`, so the modal's Ace instance has to be counted via
+ // `document`, not `container`, or this would never see it mount.
await waitFor(() => {
- expect(container.querySelectorAll('.ace_editor')).toHaveLength(2);
+ expect(document.querySelectorAll('.ace_editor')).toHaveLength(2);
});
fireEvent.click(screen.getByTestId('close-modal-btn'));
await waitFor(() => {
- expect(container.querySelectorAll('.ace_editor')).toHaveLength(1);
+ expect(document.querySelectorAll('.ace_editor')).toHaveLength(1);
});
fireEvent.click(screen.getByText('sync'));