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 => 11;
18 use utf8; # tests contain UTF-8 characters and it matters
22 AppendStringToFile($ConfigFile, "\$CommentsPrefix = 'Comments on ';\n");
24 test_page(update_page('2011-07-06', 'Hallo'),
25 'Comments_on_2011-07-06');
26 xpath_test(update_page('Hi', '<journal>'),
27 '//h1/a[text()="2011-07-06"]',
28 '//div[@class="journal"]/div[@class="page"]/p[@class="comment"]/a[text()="Comments on this page"]');
30 add_module('dynamic-comments.pl');
32 xpath_test(get_page('Hi'),
33 '//div[@class="journal"]/div[@class="page"]/p[@class="comment"]/a[@href="http://localhost/wiki.pl/Comments_on_2011-07-06"][text()="Add Comment"]');
35 test_page(update_page('Comments_on_2011-07-06', 'Yo'),
38 xpath_test(get_page('Hi'),
39 '//div[@class="journal"]/div[@class="page"]/p[@class="comment"]/a[@href="javascript:togglecomments(\'id0\')"][text()="Comments on 2011-07-06"]');
42 $page = update_page('2011-07-06_(…)_Dü', 'Hallo Dü');
43 test_page($page, 'Hallo Dü');
44 xpath_test($page, '//p[contains(text(), "Dü")]');
46 update_page('Comments_on_2011-07-06_(…)_Dü', 'Yo');
48 xpath_test(update_page('Hi', '<journal>'),
49 '//h1/a[text()="2011-07-06 (…) Dü"]',
50 '//div[@class="journal"]/div[@class="page"]/p[@class="comment"]/a[text()="Comments on 2011-07-06 (…) Dü"]',
51 '//div[@class="journal"]/div[@class="page"]/p[@class="comment"]/a[@href="javascript:togglecomments(\'id0\')"]');