Files
oddmuse/t/css.t

66 lines
3.3 KiB
Perl
Raw Normal View History

# Copyright (C) 20072015 Alex Schroeder <alex@gnu.org>
2007-07-04 13:35:02 +00:00
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
2007-07-04 13:35:02 +00:00
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
2007-07-04 13:35:02 +00:00
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
2007-07-04 13:35:02 +00:00
require 't/test.pl';
package OddMuse;
2015-10-26 00:34:57 +02:00
use Test::More tests => 16;
2007-07-04 13:35:02 +00:00
AppendStringToFile($ConfigFile, "\$StyleSheetPage = 'css';\n");
2007-07-04 13:35:02 +00:00
# Default
xpath_test(get_page('HomePage'),
'//link[@type="text/css"][@rel="stylesheet"][@href="https://oddmuse.org/default.css"]');
2007-07-04 13:35:02 +00:00
# StyleSheetPage
update_page('css', "em { font-weight: bold; }", 'some css', 0, 1);
$page = get_page('HomePage');
negative_xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="https://oddmuse.org/default.css"]');
2007-07-04 13:35:02 +00:00
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://localhost/wiki.pl?action=browse;id=css;raw=1;mime-type=text/css"]');
# StyleSheet option
AppendStringToFile($ConfigFile, "\$StyleSheet = 'http://example.org/test.css';\n");
$page = get_page('HomePage');
negative_xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="https://oddmuse.org/default.css"]',
2007-07-04 13:35:02 +00:00
'//link[@type="text/css"][@rel="stylesheet"][@href="http://localhost/wiki.pl?action=browse;id=css;raw=1;mime-type=text/css"]');
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/test.css"]');
# StyleSheet option (multiple css files)
AppendStringToFile($ConfigFile, "\$StyleSheet = ['http://example.org/test.css', 'http://example.org/another.css'];\n");
$page = get_page('HomePage');
negative_xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="https://oddmuse.org/default.css"]',
'//link[@type="text/css"][@rel="stylesheet"][@href="http://localhost/wiki.pl?action=browse;id=css;raw=1;mime-type=text/css"]');
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/test.css"]');
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/another.css"]');
2007-07-04 13:35:02 +00:00
# Parameter
$page = get_page('action=browse id=HomePage css=http://example.org/my.css');
negative_xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="https://oddmuse.org/default.css"]',
2007-07-04 13:35:02 +00:00
'//link[@type="text/css"][@rel="stylesheet"][@href="http://localhost/wiki.pl?action=browse;id=css;raw=1;mime-type=text/css"]',
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/test.css"]');
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/my.css"]');
$page = get_page('action=browse id=HomePage css=http://example.org/my.css%20http://example.org/your.css');
xpath_test($page,
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/my.css"]',
'//link[@type="text/css"][@rel="stylesheet"][@href="http://example.org/your.css"]');