refactor: move section assignment and add test
This commit is contained in:
parent
c8e0b7b0ab
commit
7cca7ca0e7
4 changed files with 26 additions and 24 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue