diff --git a/cypress/integration/form.js b/cypress/integration/form.js index 43ab5350b7..ce895323eb 100644 --- a/cypress/integration/form.js +++ b/cypress/integration/form.js @@ -1,3 +1,19 @@ +const jump_to_field = (field_label) => { + cy.get("body") + .type("{esc}") // lose focus if any + .type("{ctrl+j}") // jump to field + .type(field_label) + .wait(500) + .type("{enter}") + .wait(200) + .type("{enter}") + .wait(500); +}; + +const type_value = (value) => { + cy.focused().clear().type(value).type("{esc}"); +}; + context("Form", () => { before(() => { cy.login(); @@ -104,23 +120,16 @@ context("Form", () => { }); }); + it("Jump to field in collapsed section", { scrollBehavior: false }, () => { + cy.new_form("User"); + + jump_to_field("Location"); // this is in collapsed section + type_value("Bermuda"); + + cy.get_field("location").should("have.value", "Bermuda"); + }); + it("let user undo/redo field value changes", { scrollBehavior: false }, () => { - const jump_to_field = (field_label) => { - cy.get("body") - .type("{esc}") // lose focus if any - .type("{ctrl+j}") // jump to field - .type(field_label) - .wait(500) - .type("{enter}") - .wait(200) - .type("{enter}") - .wait(500); - }; - - const type_value = (value) => { - cy.focused().clear().type(value).type("{esc}"); - }; - const undo = () => cy.get("body").type("{esc}").type("{ctrl+z}").wait(500); const redo = () => cy.get("body").type("{esc}").type("{ctrl+y}").wait(500); diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index db121f1c24..096db8dcd1 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -267,16 +267,11 @@ frappe.ui.form.Form = class FrappeForm { this.form_editor = new frappe.ui.form.FormEditor({ frm: this, }); - //this.form_editor.setup(); // workflow state this.states = new frappe.ui.form.States({ frm: this, }); - - this.form_editor = new frappe.ui.form.FormEditor({ - frm: this, - }); } watch_model_updates() { diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index d1a51f2349..508d35b462 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -211,8 +211,6 @@ frappe.ui.form.Layout = class Layout { this.section.add_field(fieldobj); this.column.add_field(fieldobj); - fieldobj.section = this.section; - if (this.current_tab) { this.current_tab.add_field(fieldobj); } diff --git a/frappe/public/js/frappe/form/section.js b/frappe/public/js/frappe/form/section.js index af40b0aa48..a692cbac0d 100644 --- a/frappe/public/js/frappe/form/section.js +++ b/frappe/public/js/frappe/form/section.js @@ -85,7 +85,7 @@ export default class Section { add_field(fieldobj) { this.fields_list.push(fieldobj); this.fields_dict[fieldobj.fieldname] = fieldobj; - fieldobj.section = this.section; + fieldobj.section = this; } refresh(hide) {