bito-code-review[bot] commented on code in PR #41052:
URL: https://github.com/apache/superset/pull/41052#discussion_r3414001218


##########
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:
   <!-- Bito Reply -->
   The suggestion provided by the reviewer is appropriate. By adding 
`saveText={t('Save')}` to the `StandardModal`, the button label is updated to 
'Save', which correctly aligns with the test's expectation of finding a button 
with the name '/save/i' and provides a more semantically accurate label for a 
rename action.
   
   
**superset-frontend/src/SqlLab/components/SqlEditorTabHeader/SqlEditorTabHeader.test.tsx**
   ```
   -      const saveButton = screen.getByRole('button', { name: /save/i });
   -      fireEvent.click(saveButton);
   +      const addButton = screen.getByRole('button', { name: /add/i });
   +      fireEvent.click(addButton);
   ```



-- 
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