albraa911sa-lgtm commented on code in PR #41052:
URL: https://github.com/apache/superset/pull/41052#discussion_r3413999763


##########
superset-frontend/src/SqlLab/components/SqlEditorTabHeader/SqlEditorTabHeader.test.tsx:
##########
@@ -133,16 +133,22 @@ describe('SqlEditorTabHeader', () => {
       );
     });
 
-    test('should dispatch queryEditorSetTitle action', async () => {
+    test('should open rename modal and dispatch queryEditorSetTitle on save', 
async () => {
       await waitFor(() =>
-        
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
+        
expect(screen.getByTestId('rename-tab-menu-option')).toBeInTheDocument(),
       );
-      const expectedTitle = 'typed text';
-      const mockPrompt = jest
-        .spyOn(window, 'prompt')
-        .mockImplementation(() => expectedTitle);
+
       fireEvent.click(screen.getByTestId('rename-tab-menu-option'));
 
+      const input = await screen.findByTestId('rename-tab-input');
+      expect(input).toBeInTheDocument();
+
+      const expectedTitle = 'typed text';
+      fireEvent.change(input, { target: { value: expectedTitle } });
+
+      const saveButton = screen.getByRole('button', { name: /save/i });

Review Comment:
   Fixed: added `saveText={t('Save')}` to `StandardModal` so the button label 
is 'Save' rather than the 'Add' default — the test's `/save/i` query now 
matches correctly, and the label is semantically appropriate for a rename 
action.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to