From 47a202916154f6765c37ac0a76f17f95793f1a9b Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 11 Aug 2023 12:28:15 +0000 Subject: [PATCH] Bug 33428: Adjust Unit Tests Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 8 ++++---- t/db_dependent/selenium/patrons_search.t | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index c5de741c45..81cbebcab9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -526,13 +526,13 @@ function expandPatronSearchFields(search_fields) { return defaultPatronSearchFields; break; case 'full_address': - return 'streetnumber,streettype,address,address2,city,state,zipcode,country'; + return 'streetnumber|streettype|address|address2|city|state|zipcode|country'; break; case 'all_emails': - return 'email,emailpro,B_email'; + return 'email|emailpro|B_email'; break; case 'all_phones': - return 'phone,phonepro,B_phone,altcontactphone,mobile'; + return 'phone|phonepro|B_phone|altcontactphone|mobile'; break; default: return search_fields; @@ -598,7 +598,7 @@ function buildPatronSearchQuery(term, options) { // Add full search term for each search field let term_subquery_or = []; - search_fields.split('|').forEach(function (field, i) { + search_fields.split('\|').forEach(function (field, i) { term_subquery_or.push( { ["me." + field]: { 'like': leading_wildcard + term + '%' } } ); diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t index d21d3583a1..2b327a30e3 100755 --- a/t/db_dependent/selenium/patrons_search.t +++ b/t/db_dependent/selenium/patrons_search.t @@ -170,18 +170,18 @@ subtest 'Search patrons' => sub { $driver->get( $base_url . "/members/members-home.pl" ); my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.'); - is( $adv_options[0]->get_value(), 'firstname|middle_name|surname|othernames|cardnumber|userid', 'Standard search uses hard coded list when DefaultPatronSearchFields not set'); + is( $adv_options[0]->get_value(), 'standard', 'Standard search uses value "standard"'); my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); is( scalar @filter_options, $nb_standard_fields + 1, 'All standard fields + middle_name are searchable by filter if DefaultPatronSearchFields not set'); - is( $filter_options[0]->get_value(), 'firstname|middle_name|surname|othernames|cardnumber|userid', 'Standard filter uses hard coded list when DefaultPatronSearchFields not set'); + is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses hard coded value "standard" DefaultPatronSearchFields not set'); C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials"); $driver->get( $base_url . "/members/members-home.pl" ); @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); is( scalar @adv_options, $nb_standard_fields, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name disappears, we do not want it if not part of DefaultPatronSearchFields'); - is( $adv_options[0]->get_value(), 'firstname|initials', 'Standard search uses DefaultPatronSearchFields when populated'); + is( $adv_options[0]->get_value(), 'standard', 'Standard search uses value "standard"'); @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field'); - is( $filter_options[0]->get_value(), 'firstname|initials', 'Standard filter uses DefaultPatronSearchFields when populated'); + is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses value "standard"'); C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials|horses"); $driver->get( $base_url . "/members/members-home.pl" ); @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); -- 2.39.5