Mercurial > hg > soundsoftware-site
comparison .svn/pristine/42/42b1bbf27cdf5d0a4cb209640b30af429ee5814c.svn-base @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2014 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.expand_path('../../../../test_helper', __FILE__) | |
19 | |
20 class ThemesTest < ActionController::IntegrationTest | |
21 | |
22 def setup | |
23 @theme = Redmine::Themes.themes.last | |
24 Setting.ui_theme = @theme.id | |
25 end | |
26 | |
27 def teardown | |
28 Setting.ui_theme = '' | |
29 end | |
30 | |
31 def test_application_css | |
32 get '/' | |
33 | |
34 assert_response :success | |
35 assert_select "link[rel=stylesheet][href^=/themes/#{@theme.dir}/stylesheets/application.css]" | |
36 end | |
37 | |
38 def test_without_theme_js | |
39 get '/' | |
40 | |
41 assert_response :success | |
42 assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 0 | |
43 end | |
44 | |
45 def test_with_theme_js | |
46 # Simulates a theme.js | |
47 @theme.javascripts << 'theme' | |
48 get '/' | |
49 | |
50 assert_response :success | |
51 assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 1 | |
52 ensure | |
53 @theme.javascripts.delete 'theme' | |
54 end | |
55 | |
56 def test_use_default_favicon_if_theme_provides_none | |
57 get '/' | |
58 | |
59 assert_response :success | |
60 assert_select 'link[rel=shortcut icon][href^=/favicon.ico]' | |
61 end | |
62 | |
63 def test_use_theme_favicon_if_theme_provides_one | |
64 # Simulate a theme favicon | |
65 @theme.favicons << 'a.ico' | |
66 get '/' | |
67 | |
68 assert_response :success | |
69 assert_select "link[rel=shortcut icon][href^=/themes/#{@theme.dir}/favicon/a.ico]" | |
70 ensure | |
71 @theme.favicons.delete 'a.ico' | |
72 end | |
73 | |
74 def test_use_only_one_theme_favicon_if_theme_provides_many | |
75 @theme.favicons.concat %w{b.ico a.png} | |
76 get '/' | |
77 | |
78 assert_response :success | |
79 assert_select "link[rel=shortcut icon]", 1 | |
80 assert_select "link[rel=shortcut icon][href^=/themes/#{@theme.dir}/favicon/b.ico]" | |
81 ensure | |
82 @theme.favicons.delete("b.ico") | |
83 @theme.favicons.delete("a.png") | |
84 end | |
85 | |
86 def test_with_sub_uri | |
87 Redmine::Utils.relative_url_root = '/foo' | |
88 @theme.javascripts << 'theme' | |
89 @theme.favicons << 'a.ico' | |
90 get '/' | |
91 | |
92 assert_response :success | |
93 assert_select "link[rel=stylesheet][href^=/foo/themes/#{@theme.dir}/stylesheets/application.css]" | |
94 assert_select "script[src^=/foo/themes/#{@theme.dir}/javascripts/theme.js]" | |
95 assert_select "link[rel=shortcut icon][href^=/foo/themes/#{@theme.dir}/favicon/a.ico]" | |
96 ensure | |
97 Redmine::Utils.relative_url_root = '' | |
98 end | |
99 end |