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