|
Lines 568-574
subtest 'Search patrons' => sub {
Link Here
|
| 568 |
}; |
568 |
}; |
| 569 |
|
569 |
|
| 570 |
subtest 'Search patrons in modal' => sub { |
570 |
subtest 'Search patrons in modal' => sub { |
| 571 |
plan tests => 2; |
571 |
plan tests => 3; |
| 572 |
|
572 |
|
| 573 |
setup(); |
573 |
setup(); |
| 574 |
|
574 |
|
|
Lines 835-842
subtest 'Search patrons in modal' => sub {
Link Here
|
| 835 |
); |
835 |
); |
| 836 |
}; |
836 |
}; |
| 837 |
|
837 |
|
| 838 |
teardown(); |
838 |
subtest 'no clause for extended_attributes when none are default searchable' => sub { |
|
|
839 |
plan tests => 2; |
| 840 |
|
| 841 |
$attribute_type_searchable_1->update( { searched_by_default => 0 } ); |
| 842 |
$attribute_type_searchable_2->update( { searched_by_default => 0 } ); |
| 843 |
|
| 844 |
$driver->get( $base_url . "/members/members-home.pl" ); |
| 845 |
|
| 846 |
$driver->execute_script( <<'EOF', 'capture_ajax_data' ); |
| 847 |
jQuery( document ).on( "ajaxSend", function( event, request, settings ) { |
| 848 |
jQuery('.patron_search_form').after('<div id="capture_ajax_data_was_executed"></div>'); |
| 849 |
var url = new URL(window.location.origin + settings.url); |
| 850 |
var parts = url.search.substring(1).split('&'); |
| 851 |
var q; |
| 852 |
for (var i = 0 ; i < parts.length ; i++) { |
| 853 |
var p = parts[i].split('='); |
| 854 |
if (p[0] === 'q') { |
| 855 |
q = JSON.parse(decodeURIComponent(p[1])); |
| 856 |
break; |
| 857 |
} |
| 858 |
} |
| 859 |
|
| 860 |
for (var i = 0; i < q.length; i++) { |
| 861 |
var q0 = q[i]['-and']; |
| 862 |
for (var j = 0; q0 && j < q0.length; j++) { |
| 863 |
for (var k = 0; k < q0[j].length; k++) { |
| 864 |
if (q0[j][k].hasOwnProperty('extended_attributes.code')) { |
| 865 |
jQuery('.patron_search_form').after('<div id="had_extended_attributes_clause"></div>'); |
| 866 |
} |
| 867 |
} |
| 868 |
} |
| 869 |
} |
| 870 |
} ); |
| 871 |
EOF |
| 872 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
| 873 |
$s->submit_form; |
| 874 |
sleep $DT_delay && $s->wait_for_ajax; |
| 875 |
my $e1 = $driver->find_elements( 'capture_ajax_data_was_executed', 'id' ); |
| 876 |
is( scalar(@$e1), 1, 'the capture script was executed' ); |
| 877 |
my $e2 = $driver->find_elements( 'had_extended_attributes_clause', 'id' ); |
| 878 |
is( scalar(@$e2), 0, 'there were no extended attributes on the search clause' ); |
| 839 |
|
879 |
|
|
|
880 |
}; |
| 881 |
|
| 882 |
teardown(); |
| 840 |
}; |
883 |
}; |
| 841 |
|
884 |
|
| 842 |
sub is_patron_shown { |
885 |
sub is_patron_shown { |
| 843 |
- |
|
|