1 # Copyright (C) 2011 Alex Schroeder <alex@gnu.org>
3 # This program is free software: you can redistribute it and/or modify it under
4 # the terms of the GNU General Public License as published by the Free Software
5 # Foundation, either version 3 of the License, or (at your option) any later
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License along with
13 # this program. If not, see <http://www.gnu.org/licenses/>.
17 use Test::More tests => 34;
21 update_page('2011-12-17', "today");
22 update_page('2011-12-16', "yesterday");
23 update_page('2011-12-15', "before yesterday");
24 update_page('2011-12-14', "this Wednesday");
25 update_page('2011-12-13', "this Tuesday");
27 update_page('2011-12-12', "this Monday");
28 update_page('2011-12-11', "last Sunday");
29 update_page('2011-12-10', "last Saturday");
30 update_page('2011-12-09', "last Friday");
31 update_page('2011-12-08', "Thursday a week ago");
33 # check that the limit is taken into account
34 $page = update_page('Summary', "This is my journal:\n\n<journal 5>");
36 test_page($page, '2011-12-17', '2011-12-16', '2011-12-15',
37 '2011-12-14', '2011-12-13');
38 test_page_negative($page, '2011-12-12', '2011-12-11', '2011-12-10',
39 '2011-12-09', '2011-12-08');
41 xpath_test($page, '//a[@href="http://localhost/wiki.pl?action=more;num=5;regexp=^\d\d\d\d-\d\d-\d\d;search=;mode=;offset=5"][text()="More..."]');
43 # check that the link for more actually works
45 $page = get_page("action=more num=5 offset=5 ");
47 test_page_negative($page, '2011-12-17', '2011-12-16', '2011-12-15',
48 '2011-12-14', '2011-12-13');
49 test_page($page, '2011-12-12', '2011-12-11', '2011-12-10',
50 '2011-12-09', '2011-12-08');
51 xpath_test_negative($page, '//a[text()="More..."]');
53 # check that the link for more appears correctly
55 $page = get_page("action=more num=5 offset=4 ");
57 test_page_negative($page, '2011-12-17', '2011-12-16', '2011-12-15',
58 '2011-12-14', '2011-12-08');
59 test_page($page, '2011-12-13', '2011-12-12', '2011-12-11',
60 '2011-12-10', '2011-12-09');
61 xpath_test($page, '//a[text()="More..."]');
65 xpath_test_negative(get_page("action=more num=5 offset=6 "),
66 '//a[text()="More..."]');