您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

43 行
1.4 KiB

  1. import data_field_validation_doctype from '../fixtures/data_field_validation_doctype';
  2. const doctype_name = data_field_validation_doctype.name;
  3. context('URL Data Field Input', () => {
  4. before(() => {
  5. cy.login();
  6. cy.visit('/app/website');
  7. return cy.insert_doc('DocType', data_field_validation_doctype, true);
  8. });
  9. describe('URL Data Field Input ', () => {
  10. it('should not show URL link button without focus', () => {
  11. cy.new_form(doctype_name);
  12. cy.get_field('url').clear().type('https://frappe.io');
  13. cy.get_field('url').blur().wait(500);
  14. cy.get('.link-btn').should('not.be.visible');
  15. });
  16. it('should show URL link button on focus', () => {
  17. cy.get_field('url').focus().wait(500);
  18. cy.get('.link-btn').should('be.visible');
  19. });
  20. it('should not show URL link button for invalid URL', () => {
  21. cy.get_field('url').clear().type('fuzzbuzz');
  22. cy.get('.link-btn').should('not.be.visible');
  23. });
  24. it('should have valid URL link with target _blank', () => {
  25. cy.get_field('url').clear().type('https://frappe.io');
  26. cy.get('.link-btn .btn-open').should('have.attr', 'href', 'https://frappe.io');
  27. cy.get('.link-btn .btn-open').should('have.attr', 'target', '_blank');
  28. });
  29. it('should inject anchor tag in read-only URL data field', () => {
  30. cy.get('[data-fieldname="read_only_url"]')
  31. .find('a')
  32. .should('have.attr', 'target', '_blank');
  33. });
  34. });
  35. });