Reset to page 1 on a new search. Fix test.

This commit is contained in:
barnold 2022-09-18 12:56:15 +01:00
parent e253331a5e
commit 94b888f0f5
2 changed files with 3 additions and 2 deletions

View File

@ -11,7 +11,7 @@ $t->get_ok('/account')->status_is(302);
$t->get_ok('/auth')->status_is(200)->content_like(qr/login/i);
$t->post_ok('/login' => form => { logname => 'Dobby' });
$t->get_ok('/')->status_is(200)->content_like(qr/dobby/i);
$t->get_ok('/book/page/1')->status_is(200)->content_like(qr/book count/i);
$t->get_ok('/book/page/1')->status_is(200)->content_like(qr/[[:digit:]] books found/i);
$t->get_ok('/logout')->status_is(302);
# Can't do "content_unlike()" so check it offers login now.
$t->get_ok('/')->status_is(200)->content_like(qr/login/i);

View File

@ -2,7 +2,8 @@
% title 'Books';
<h1>Book page</h1>
%= form_for book_page => begin
<%# On a new search, reset the page number to 1. %>
%= form_for book_page => { page_number => 1 } => begin
%= label_for title_like => 'Title like'
%= text_field title_like => flash('title_like')
%= submit_button "Search"