Mercurial > hg > soundsoftware-site
comparison test/integration/lib/redmine/themes_test.rb @ 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 | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
30 | 30 |
31 def test_application_css | 31 def test_application_css |
32 get '/' | 32 get '/' |
33 | 33 |
34 assert_response :success | 34 assert_response :success |
35 assert_tag :tag => 'link', | 35 assert_select "link[rel=stylesheet][href^=/themes/#{@theme.dir}/stylesheets/application.css]" |
36 :attributes => {:href => %r{^/themes/#{@theme.dir}/stylesheets/application.css}} | |
37 end | 36 end |
38 | 37 |
39 def test_without_theme_js | 38 def test_without_theme_js |
40 get '/' | 39 get '/' |
41 | 40 |
42 assert_response :success | 41 assert_response :success |
43 assert_no_tag :tag => 'script', | 42 assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 0 |
44 :attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}} | |
45 end | 43 end |
46 | 44 |
47 def test_with_theme_js | 45 def test_with_theme_js |
48 # Simulates a theme.js | 46 # Simulates a theme.js |
49 @theme.javascripts << 'theme' | 47 @theme.javascripts << 'theme' |
50 get '/' | 48 get '/' |
51 | 49 |
52 assert_response :success | 50 assert_response :success |
53 assert_tag :tag => 'script', | 51 assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 1 |
54 :attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}} | |
55 | |
56 ensure | 52 ensure |
57 @theme.javascripts.delete 'theme' | 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") | |
58 end | 84 end |
59 | 85 |
60 def test_with_sub_uri | 86 def test_with_sub_uri |
61 Redmine::Utils.relative_url_root = '/foo' | 87 Redmine::Utils.relative_url_root = '/foo' |
62 @theme.javascripts << 'theme' | 88 @theme.javascripts << 'theme' |
89 @theme.favicons << 'a.ico' | |
63 get '/' | 90 get '/' |
64 | 91 |
65 assert_response :success | 92 assert_response :success |
66 assert_tag :tag => 'link', | 93 assert_select "link[rel=stylesheet][href^=/foo/themes/#{@theme.dir}/stylesheets/application.css]" |
67 :attributes => {:href => %r{^/foo/themes/#{@theme.dir}/stylesheets/application.css}} | 94 assert_select "script[src^=/foo/themes/#{@theme.dir}/javascripts/theme.js]" |
68 assert_tag :tag => 'script', | 95 assert_select "link[rel=shortcut icon][href^=/foo/themes/#{@theme.dir}/favicon/a.ico]" |
69 :attributes => {:src => %r{^/foo/themes/#{@theme.dir}/javascripts/theme.js}} | |
70 | |
71 ensure | 96 ensure |
72 Redmine::Utils.relative_url_root = '' | 97 Redmine::Utils.relative_url_root = '' |
73 end | 98 end |
74 end | 99 end |