formHelper.expectErrorChange('user_id', '', 'required', true);
});
- it(
- 'should validate that username is valid',
- fakeAsync(() => {
- formHelper.setValue('user_id', 'ab', true);
- tick(500);
- formHelper.expectValid('user_id');
- })
- );
-
- it(
- 'should validate that username is invalid',
- fakeAsync(() => {
- formHelper.setValue('user_id', 'abc', true);
- tick(500);
- formHelper.expectError('user_id', 'notUnique');
- })
- );
+ it('should validate that username is valid', fakeAsync(() => {
+ formHelper.setValue('user_id', 'ab', true);
+ tick(500);
+ formHelper.expectValid('user_id');
+ }));
+
+ it('should validate that username is invalid', fakeAsync(() => {
+ formHelper.setValue('user_id', 'abc', true);
+ tick(500);
+ formHelper.expectError('user_id', 'notUnique');
+ }));
});
+
+ describe('onSubmit', () => {
+ it('should be able to clear the mail field on update', () => {
+ spyOn(rgwUserService, 'update');
+ component.editing = true;
+ formHelper.setValue('email', '', true);
+ component.onSubmit();
+ expect(rgwUserService.update).toHaveBeenCalledWith(null, {
+ display_name: null,
+ email: '',
+ max_buckets: 1000,
+ suspended: false
+ });
+ });
+ });
});