albraa911sa-lgtm commented on code in PR #41052:
URL: https://github.com/apache/superset/pull/41052#discussion_r3414006484
##########
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:
No change needed here. The previous commit already added
`saveText={t('Save')}` to `StandardModal`, so the button now renders 'Save' —
the test's `/save/i` query is correct as-is. Changing to `/add/i` would be
wrong: 'Add' is not the right label 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]