diff --git a/.eslintrc b/.eslintrc index d123023a68..2d17d7937b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -80,6 +80,7 @@ "validate_email": true, "validate_name": true, "validate_phone": true, + "validate_url": true, "get_number_format": true, "format_number": true, "format_currency": true, @@ -144,6 +145,7 @@ "cy": true, "it": true, "expect": true, + "describe": true, "context": true, "before": true, "beforeEach": true, diff --git a/cypress/fixtures/data_field_validation_doctype.js b/cypress/fixtures/data_field_validation_doctype.js index 75fa88554e..469ff8ca24 100644 --- a/cypress/fixtures/data_field_validation_doctype.js +++ b/cypress/fixtures/data_field_validation_doctype.js @@ -11,13 +11,13 @@ export default { fieldname: 'email', fieldtype: 'Data', label: 'Email', - options: 'Email' + options: 'Email' }, { fieldname: 'URL', fieldtype: 'Data', label: 'URL', - options: 'URL' + options: 'URL' }, { fieldname: 'Phone', diff --git a/cypress/integration/data_field_form_validation.js b/cypress/integration/data_field_form_validation.js index 17a7f8e154..e6f6f13df6 100644 --- a/cypress/integration/data_field_form_validation.js +++ b/cypress/integration/data_field_form_validation.js @@ -18,7 +18,7 @@ context('Data Field Input Validation in New Form', () => { cy.get(`.frappe-control[data-fieldname="${fieldname}"]`).should('not.have.class', 'has-error'); } - describe('Data Field Options', () => { + describe('Data Field Options', () => { it('should validate email address', () => { cy.new_form(doctype_name); validateField('email', 'captian', 'hello@test.com'); @@ -35,5 +35,5 @@ context('Data Field Input Validation in New Form', () => { it('should validate name', () => { validateField('person_name', ' 777Hello', 'James Bond'); }); - }); + }); }); \ No newline at end of file diff --git a/frappe/public/js/frappe/utils/datatype.js b/frappe/public/js/frappe/utils/datatype.js index ad0fd4324c..944d3fca1a 100644 --- a/frappe/public/js/frappe/utils/datatype.js +++ b/frappe/public/js/frappe/utils/datatype.js @@ -54,7 +54,7 @@ window.validate_name = function(txt) { window.validate_url = function(txt) { return frappe.utils.validate_type(txt, "url"); -} +}; window.nth = function(number) { number = cint(number); diff --git a/frappe/utils/__init__.py b/frappe/utils/__init__.py index 5992fdb6db..2fdaa05404 100644 --- a/frappe/utils/__init__.py +++ b/frappe/utils/__init__.py @@ -166,12 +166,12 @@ def validate_url(txt, throw=False): url = urlparse(txt).netloc if not url: raise frappe.ValidationError - except Exception as e: + except Exception: if throw: frappe.throw( frappe._( "'{0}' is not a valid URL" - ).format('' + +'') + ).format('' + txt +'') ) return False