Преглед изворни кода

[test] test_customize_form.js

version-14
Rushabh Mehta пре 8 година
родитељ
комит
805633860f
1 измењених фајлова са 19 додато и 10 уклоњено
  1. +19
    -10
      frappe/custom/doctype/customize_form/test_customize_form.js

+ 19
- 10
frappe/custom/doctype/customize_form/test_customize_form.js Прегледај датотеку

@@ -9,15 +9,24 @@ QUnit.test("test customize form", function(assert) {
() => frappe.set_route('Form', 'Customize Form'),
() => frappe.timeout(1),
() => 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
() => 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),

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

// 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()
]);
});

Loading…
Откажи
Сачувај