bito-code-review[bot] commented on code in PR #41052:
URL: https://github.com/apache/superset/pull/41052#discussion_r3414007821
##########
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 user's assessment is correct. Since the `StandardModal` has been updated
to use `saveText={t('Save')}`, the button label is now 'Save'. Therefore, the
test's existing query `screen.getByRole('button', { name: /save/i })` is
accurate and should not be changed to `/add/i`.
**superset-frontend/src/SqlLab/components/SqlEditorTabHeader/SqlEditorTabHeader.test.tsx**
```
const saveButton = screen.getByRole('button', { name: /save/i });
fireEvent.click(saveButton);
```
--
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]