diff --git a/dashboard/src/validators/NotNullValidator.js b/dashboard/src/validators/NotNullValidator.js index aa00b535a4..677b965af6 100644 --- a/dashboard/src/validators/NotNullValidator.js +++ b/dashboard/src/validators/NotNullValidator.js @@ -18,7 +18,7 @@ import { extend } from 'vee-validate'; const validator = { message: (field) => `Null is not allowed for ${field}`, validate(value) { - return !value || value.toLowerCase() !== 'null'; + return !value || value.trim().toLowerCase() !== 'null'; }, }; diff --git a/e2e-tests/cypress/e2e/projects_modal_validation_spec.js b/e2e-tests/cypress/e2e/projects_modal_validation_spec.js index 7862148ce7..5a79b7bb33 100644 --- a/e2e-tests/cypress/e2e/projects_modal_validation_spec.js +++ b/e2e-tests/cypress/e2e/projects_modal_validation_spec.js @@ -359,9 +359,9 @@ describe('Projects Modal Validation Tests', () => { cy.get('[data-cy=projectNameError]').should('not.be.visible') cy.get('[data-cy=idError]').should('not.be.visible') - // verify validator is case insensitive + // verify validator is case-insensitive and trims whitespace cy.get('[data-cy="projectName"]').clear() - .type('NUlL'); + .type(' NUlL '); cy.get('[data-cy=projectNameError]') .contains('Null is not allowed for Project Name') .should('be.visible');