Commit 67277507 authored by Faris Ansari's avatar Faris Ansari Committed by Rushabh Mehta
Browse files

[hotfix] Linked with and List item click (#3803)

* [hotfix] Linked with and List item click

* Run a single test using Test Runner

* Add test for Linked With

* [minor] List view fixes
parent a7fd1691
Showing with 33 additions and 5 deletions
+33 -5
......@@ -11,7 +11,8 @@ frappe.ui.form.on('Test Runner', {
// all tests
frappe.call({
method: 'frappe.core.doctype.test_runner.test_runner.get_test_js'
method: 'frappe.core.doctype.test_runner.test_runner.get_test_js',
args: { test_path: frm.doc.module_path }
}).always((data) => {
$("<div id='qunit'></div>").appendTo(wrapper.empty());
frm.events.run_tests(frm, data.message);
......
......@@ -10,9 +10,10 @@ class TestRunner(Document):
pass
@frappe.whitelist()
def get_test_js():
def get_test_js(test_path=None):
'''Get test + data for app, example: app/tests/ui/test_name.js'''
test_path = frappe.db.get_single_value('Test Runner', 'module_path')
if not test_path:
test_path = frappe.db.get_single_value('Test Runner', 'module_path')
test_js = []
# split
......
......@@ -271,7 +271,10 @@ frappe.views.ListRenderer = Class.extend({
setup_filterable: function () {
var me = this;
this.list_view.wrapper &&
this.list_view.wrapper.on('click', '.result-list .filterable', function (e) {
e.stopPropagation();
var filters = $(this).attr('data-filter').split('|');
var added = false;
......@@ -294,7 +297,9 @@ frappe.views.ListRenderer = Class.extend({
me.list_view.refresh(true);
}
});
this.wrapper.on('click', '.list-item', function (e) {
this.list_view.wrapper &&
this.list_view.wrapper.on('click', '.list-item', function (e) {
// don't open in case of checkbox, like, filterable
if ($(e.target).hasClass('filterable')
|| $(e.target).hasClass('octicon-heart')
......
......@@ -87,6 +87,7 @@ frappe.ui.FilterList = Class.extend({
}
var filter = this.push_new_filter(doctype, fieldname, condition, value);
if (!filter) return;
if(this.wrapper.find('.clear-filters').hasClass("hide")) {
this.wrapper.find('.clear-filters').removeClass("hide");
......
QUnit.module('form');
QUnit.test("Test Linked With", function(assert) {
assert.expect(2);
const done = assert.async();
frappe.run_serially([
() => frappe.set_route('Form', 'Module Def', 'Contacts'),
() => frappe.tests.click_page_head_item('Menu'),
() => frappe.tests.click_dropdown_item('Links'),
() => frappe.timeout(4),
() => {
assert.equal(cur_dialog.title, 'Linked With', 'Linked with dialog is opened');
const link_tables_count = cur_dialog.$wrapper.find('.list-item-table').length;
assert.equal(link_tables_count, 2, 'Two DocTypes are linked with Contacts');
},
done
]);
});
\ No newline at end of file
......@@ -2,4 +2,5 @@ frappe/tests/ui/test_number_format.js
frappe/tests/ui/test_list/test_list_filter.js
frappe/tests/ui/test_list/test_list_paging.js
frappe/tests/ui/test_module_view.js
frappe/tests/ui/test_calendar_view.js
\ No newline at end of file
frappe/tests/ui/test_calendar_view.js
frappe/tests/ui/test_linked_with.js
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment