Teams: Consistency in save/update on the team settings page (#99200)

* make team page consistent

* fmt/linting

* fix tests
pull/98697/head^2
Eric Leijonmarck 5 months ago committed by GitHub
parent c601d79889
commit cf19d6d4b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      public/app/features/teams/TeamSettings.test.tsx
  2. 6
      public/app/features/teams/TeamSettings.tsx

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

Loading…
Cancel
Save