// Enter max buckets
this.selectOption('max_buckets_mode', 'Custom');
+ cy.get('#max_buckets').should('exist').should('have.value', '1000');
cy.get('#max_buckets').click().clear().type(maxbuckets);
// Click the create button and wait for user to be made
const uname = '000invalid_edit_user';
// creating this user to edit for the test
this.navigateTo('create');
- this.create(uname, 'xxx', 'xxx@xxx', '1');
+ this.create(uname, 'xxx', 'xxx@xxx', '50');
this.navigateEdit(name);
cy.contains('#display_name + .invalid-feedback', 'This field is required.');
// put negative max buckets to make field invalid
- this.expectSelectOption('max_buckets_mode', 'Custom');
+ this.selectOption('max_buckets_mode', 'Disabled');
+ cy.get('#max_buckets').should('not.exist');
+ this.selectOption('max_buckets_mode', 'Custom');
+ cy.get('#max_buckets').should('exist').should('have.value', '50');
cy.get('#max_buckets').clear().type('-5').blur().should('have.class', 'ng-invalid');
cy.contains('#max_buckets + .invalid-feedback', 'The entered value must be >= 1.');
result = _.uniq(result);
return result;
}
+
+ onMaxBucketsModeChange(mode: string) {
+ if (mode === '1') {
+ // If 'Custom' mode is selected, then ensure that the form field
+ // 'Max. buckets' contains a valid value. Set it to default if
+ // necessary.
+ if (!this.userForm.get('max_buckets').valid) {
+ this.userForm.patchValue({
+ max_buckets: 1000
+ });
+ }
+ }
+ }
}