Pārlūkot izejas kodu

[test] test_customize_form.js

version-14
Rushabh Mehta pirms 8 gadiem
vecāks
revīzija
805633860f
1 mainītis faili ar 19 papildinājumiem un 10 dzēšanām
  1. +19
    -10
      frappe/custom/doctype/customize_form/test_customize_form.js

+ 19
- 10
frappe/custom/doctype/customize_form/test_customize_form.js Parādīt failu

@@ -9,15 +9,24 @@ QUnit.test("test customize form", function(assert) {
() => frappe.set_route('Form', 'Customize Form'), () => frappe.set_route('Form', 'Customize Form'),
() => frappe.timeout(1), () => frappe.timeout(1),
() => cur_frm.set_value('doc_type', 'ToDo'), () => cur_frm.set_value('doc_type', 'ToDo'),
() => frappe.timeout(1),
() => frappe.click_button('Reset to defaults'),
() => frappe.click_button('Submit'),
() => frappe.timeout(1),
() => assert.equal(cur_frm.doc.fields[1].fieldname, 'status',
'check if second field is "status"'),

() => frappe.timeout(2),
() => {
// find the status column as there may be other custom fields like
// kanban etc.
frappe.row_idx = 0;
cur_frm.doc.fields.every((d, i) => {
if(d.fieldname==='status') {
frappe.row_idx = i;
return false;
} else {
return true;
}
});
assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status',
'check if selected field is "status"');
},
// open "status" row // open "status" row
() => cur_frm.fields_dict.fields.grid.grid_rows[1].toggle_view(),
() => cur_frm.fields_dict.fields.grid.grid_rows[frappe.row_idx].toggle_view(),
() => frappe.timeout(0.5), () => frappe.timeout(0.5),


// try deleting it // try deleting it
@@ -28,8 +37,8 @@ QUnit.test("test customize form", function(assert) {
() => frappe.timeout(0.5), () => frappe.timeout(0.5),


// status still exists // status still exists
() => assert.equal(cur_frm.doc.fields[1].fieldname, 'status',
'check if second field is still "status"'),
() => assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status',
'check if selected field is still "status"'),
() => done() () => done()
]); ]);
}); });

Notiek ielāde…
Atcelt
Saglabāt