Ver a proveniência

fix: Sider Issues

version-14
Hussain Nagaria há 4 anos
ascendente
cometimento
ea38895f1a
5 ficheiros alterados com 9 adições e 7 eliminações
  1. +2
    -0
      .eslintrc
  2. +2
    -2
      cypress/fixtures/data_field_validation_doctype.js
  3. +2
    -2
      cypress/integration/data_field_form_validation.js
  4. +1
    -1
      frappe/public/js/frappe/utils/datatype.js
  5. +2
    -2
      frappe/utils/__init__.py

+ 2
- 0
.eslintrc Ver ficheiro

@@ -80,6 +80,7 @@
"validate_email": true, "validate_email": true,
"validate_name": true, "validate_name": true,
"validate_phone": true, "validate_phone": true,
"validate_url": true,
"get_number_format": true, "get_number_format": true,
"format_number": true, "format_number": true,
"format_currency": true, "format_currency": true,
@@ -144,6 +145,7 @@
"cy": true, "cy": true,
"it": true, "it": true,
"expect": true, "expect": true,
"describe": true,
"context": true, "context": true,
"before": true, "before": true,
"beforeEach": true, "beforeEach": true,


+ 2
- 2
cypress/fixtures/data_field_validation_doctype.js Ver ficheiro

@@ -11,13 +11,13 @@ export default {
fieldname: 'email', fieldname: 'email',
fieldtype: 'Data', fieldtype: 'Data',
label: 'Email', label: 'Email',
options: 'Email'
options: 'Email'
}, },
{ {
fieldname: 'URL', fieldname: 'URL',
fieldtype: 'Data', fieldtype: 'Data',
label: 'URL', label: 'URL',
options: 'URL'
options: 'URL'
}, },
{ {
fieldname: 'Phone', fieldname: 'Phone',


+ 2
- 2
cypress/integration/data_field_form_validation.js Ver ficheiro

@@ -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'); 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', () => { it('should validate email address', () => {
cy.new_form(doctype_name); cy.new_form(doctype_name);
validateField('email', 'captian', 'hello@test.com'); validateField('email', 'captian', 'hello@test.com');
@@ -35,5 +35,5 @@ context('Data Field Input Validation in New Form', () => {
it('should validate name', () => { it('should validate name', () => {
validateField('person_name', ' 777Hello', 'James Bond'); validateField('person_name', ' 777Hello', 'James Bond');
}); });
});
});
}); });

+ 1
- 1
frappe/public/js/frappe/utils/datatype.js Ver ficheiro

@@ -54,7 +54,7 @@ window.validate_name = function(txt) {


window.validate_url = function(txt) { window.validate_url = function(txt) {
return frappe.utils.validate_type(txt, "url"); return frappe.utils.validate_type(txt, "url");
}
};


window.nth = function(number) { window.nth = function(number) {
number = cint(number); number = cint(number);


+ 2
- 2
frappe/utils/__init__.py Ver ficheiro

@@ -166,12 +166,12 @@ def validate_url(txt, throw=False):
url = urlparse(txt).netloc url = urlparse(txt).netloc
if not url: if not url:
raise frappe.ValidationError raise frappe.ValidationError
except Exception as e:
except Exception:
if throw: if throw:
frappe.throw( frappe.throw(
frappe._( frappe._(
"'{0}' is not a valid URL" "'{0}' is not a valid URL"
).format('<strong>' + +'</strong>')
).format('<strong>' + txt +'</strong>')
) )
return False return False


Carregando…
Cancelar
Guardar