@@ -609,7 +609,7 @@ def get_count(doctype, filters=None): | |||||
conditions.append(join_condition) | conditions.append(join_condition) | ||||
return frappe.db.sql_list("""select count(*) from {0} | return frappe.db.sql_list("""select count(*) from {0} | ||||
where {1}""".format(','.join(tables), ' and '.join(conditions)), debug=1) | |||||
where {1}""".format(','.join(tables), ' and '.join(conditions)), debug=0) | |||||
def is_parent_only_filter(doctype, filters): | def is_parent_only_filter(doctype, filters): | ||||
#check if filters contains only parent doctype | #check if filters contains only parent doctype | ||||
@@ -0,0 +1,34 @@ | |||||
QUnit.module('Setup'); | |||||
QUnit.test("Test List Count", function(assert) { | |||||
assert.expect(3); | |||||
const done = assert.async(); | |||||
frappe.run_serially([ | |||||
() => frappe.set_route('List', 'DocType'), | |||||
() => frappe.timeout(0.5), | |||||
() => { | |||||
let count = $('.list-row-right').text().split(' ')[0]; | |||||
assert.equal(cur_list.data.length, count, "Correct Count"); | |||||
}, | |||||
() => frappe.timeout(1), | |||||
() => cur_list.filter_list.add_filter('Doctype', 'module', '=', 'Desk'), | |||||
() => frappe.click_button('Refresh'), | |||||
() => { | |||||
let count = $('.list-row-right').text().split(' ')[0]; | |||||
assert.equal(cur_list.data.length, count, "Correct Count"); | |||||
}, | |||||
() => cur_list.filter_list.clear_filters(), | |||||
() => frappe.timeout(1), | |||||
() => { | |||||
cur_list.filter_list.push_new_filter('DocField', 'fieldname', 'like', 'owner'); | |||||
frappe.click_button('Apply'); | |||||
let count = $('.list-row-right').text().split(' ')[0]; | |||||
assert.equal(cur_list.data.length, count, "Correct Count"); | |||||
}, | |||||
done | |||||
]); | |||||
}); |
@@ -17,3 +17,4 @@ frappe/tests/ui/test_control_html.js | |||||
frappe/tests/ui/test_control_geolocation.js | frappe/tests/ui/test_control_geolocation.js | ||||
frappe/core/doctype/role_profile/test_role_profile.js | frappe/core/doctype/role_profile/test_role_profile.js | ||||
frappe/core/doctype/user/test_user_with_role_profile.js | frappe/core/doctype/user/test_user_with_role_profile.js | ||||
frappe/tests/ui/test_list_count.js |