Teams: Consistency in save/update on the team settings page (#99200)
* make team page consistent * fmt/linting * fix tests
This commit is contained in:
@@ -45,7 +45,7 @@ describe('Team settings', () => {
|
||||
await userEvent.clear(screen.getByRole('textbox', { name: /Name/ }));
|
||||
await userEvent.type(screen.getByLabelText(/Email/i), 'team@test.com');
|
||||
// Submitting with userEvent doesn't work here
|
||||
fireEvent.submit(screen.getByRole('button', { name: 'Update' }));
|
||||
fireEvent.submit(screen.getByRole('button', { name: 'Save' }));
|
||||
expect(await screen.findByText('Name is required')).toBeInTheDocument();
|
||||
await waitFor(() => expect(mockUpdate).not.toHaveBeenCalled());
|
||||
});
|
||||
@@ -58,7 +58,7 @@ describe('Team settings', () => {
|
||||
await userEvent.type(screen.getByRole('textbox', { name: /Name/ }), 'New team');
|
||||
await userEvent.type(screen.getByLabelText(/Email/i), 'team@test.com');
|
||||
// Submitting with userEvent doesn't work here
|
||||
fireEvent.submit(screen.getByRole('button', { name: 'Update' }));
|
||||
fireEvent.submit(screen.getByRole('button', { name: 'Save' }));
|
||||
await waitFor(() => expect(mockUpdate).toHaveBeenCalledWith('New team', 'team@test.com'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { connect, ConnectedProps } from 'react-redux';
|
||||
import { ConnectedProps, connect } from 'react-redux';
|
||||
|
||||
import { Input, Field, Button, FieldSet, Stack } from '@grafana/ui';
|
||||
import { Button, Field, FieldSet, Input, Stack } from '@grafana/ui';
|
||||
import { TeamRolePicker } from 'app/core/components/RolePicker/TeamRolePicker';
|
||||
import { useRoleOptions } from 'app/core/components/RolePicker/hooks';
|
||||
import { SharedPreferences } from 'app/core/components/SharedPreferences/SharedPreferences';
|
||||
@@ -75,7 +75,7 @@ export const TeamSettings = ({ team, updateTeam }: Props) => {
|
||||
<Input {...register('email')} placeholder="team@email.com" type="email" id="email-input" />
|
||||
</Field>
|
||||
<Button type="submit" disabled={!canWriteTeamSettings}>
|
||||
Update
|
||||
Save
|
||||
</Button>
|
||||
</FieldSet>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user