end
def test_stylesheet_link_tag_should_pick_the_default_stylesheet
- assert_match 'href="/stylesheets/styles.css"', stylesheet_link_tag("styles")
+ assert_match 'href="/assets/styles.css"', stylesheet_link_tag("styles")
end
def test_stylesheet_link_tag_for_plugin_should_pick_the_plugin_stylesheet
- assert_match 'href="/plugin_assets/foo/stylesheets/styles.css"',
+ assert_match 'href="/assets/plugin_assets/foo/styles.css"',
stylesheet_link_tag("styles", :plugin => :foo)
end
def test_image_tag_should_pick_the_default_image
- assert_match 'src="/images/image.png"', image_tag("image.png")
+ assert_match 'src="/assets/image.png"', image_tag("image.png")
end
def test_image_tag_should_pick_the_theme_image_if_it_exists
theme.images << 'image.png'
with_settings :ui_theme => theme.id do
- assert_match %|src="/themes/#{theme.dir}/images/image.png"|, image_tag("image.png")
- assert_match %|src="/images/other.png"|, image_tag("other.png")
+ assert_match %|src="/assets/themes/#{theme.dir}/image.png"|, image_tag("image.png")
+ assert_match %|src="/assets/other.png"|, image_tag("other.png")
end
ensure
theme.images.delete 'image.png'
end
def test_image_tag_sfor_plugin_should_pick_the_plugin_image
- assert_match 'src="/plugin_assets/foo/images/image.png"', image_tag("image.png", :plugin => :foo)
+ assert_match 'src="/assets/plugin_assets/foo/image.png"', image_tag("image.png", :plugin => :foo)
end
def test_javascript_include_tag_should_pick_the_default_javascript
- assert_match 'src="/javascripts/scripts.js"', javascript_include_tag("scripts")
+ assert_match 'src="/assets/scripts.js"', javascript_include_tag("scripts")
end
def test_javascript_include_tag_for_plugin_should_pick_the_plugin_javascript
- assert_match 'src="/plugin_assets/foo/javascripts/scripts.js"', javascript_include_tag("scripts", :plugin => :foo)
+ assert_match 'src="/assets/plugin_assets/foo/scripts.js"', javascript_include_tag("scripts", :plugin => :foo)
end
def test_raw_json_should_escape_closing_tags
end
def test_avatar_with_anonymous_user
- assert_match %r{src="/images/anonymous.png(\?\d+)?"}, avatar(User.anonymous)
+ assert_match %r{src="/assets/anonymous(-\w+)?.png"}, avatar(User.anonymous)
end
def test_avatar_with_group
- assert_match %r{src="/images/group.png(\?\d+)?"}, avatar(Group.first)
+ assert_match %r{src="/assets/group(-\w+)?.png"}, avatar(Group.first)
end
def test_avatar_with_invalid_arg_should_return_nil
Role.anonymous.add_permission! :add_issues
get '/projects/ecookbook/issues/new'
- assert_select 'head script[src^=?]', '/javascripts/jstoolbar/jstoolbar.js?'
+ assert_select "head script:match('src',?)", %r{/assets/jstoolbar/jstoolbar-\w+.js}
assert_include "var userHlLanguages = #{UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS.to_json};", response.body
end
def test_calendar_header_tags
with_settings :default_language => 'fr' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-fr.js", response.body
+ assert_match %r{/assets/i18n/datepicker-fr-\w+.js}, response.body
end
with_settings :default_language => 'en-GB' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-en-GB.js", response.body
+ assert_match %r{/assets/i18n/datepicker-en-GB-\w+.js}, response.body
end
with_settings :default_language => 'en' do
get '/issues'
- assert_not_include "/javascripts/i18n/datepicker", response.body
+ assert_not_include "/assets/i18n/datepicker", response.body
end
with_settings :default_language => 'es' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-es.js", response.body
+ assert_match %r{/assets/i18n/datepicker-es-\w+.js}, response.body
end
with_settings :default_language => 'es-PA' do
with_settings :default_language => 'zh' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-zh-CN.js", response.body
+ assert_match %r{/assets/i18n/datepicker-zh-CN-\w+.js}, response.body
end
with_settings :default_language => 'zh-TW' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-zh-TW.js", response.body
+ assert_match %r{/assets/i18n/datepicker-zh-TW-\w+.js}, response.body
end
with_settings :default_language => 'pt' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-pt.js", response.body
+ assert_match %r{/assets/i18n/datepicker-pt-\w+.js}, response.body
end
with_settings :default_language => 'pt-BR' do
get '/issues'
- assert_include "/javascripts/i18n/datepicker-pt-BR.js", response.body
+ assert_match %r{/assets/i18n/datepicker-pt-BR-\w+.js}, response.body
end
end
Redmine::Hook.add_listener(ProjectBasedTemplate)
get '/projects/ecookbook'
- assert_select 'head link[href=?]', '/stylesheets/ecookbook.css'
+ assert_select 'head link[href=?]', '/assets/ecookbook.css'
end
def test_empty_sidebar_should_be_hidden
get '/'
assert_response :success
- assert_select "link[rel=stylesheet][href^=?]", "/themes/#{@theme.dir}/stylesheets/application.css"
+ assert_select "link[rel=stylesheet]:match('href', ?)", %r{/assets/themes/#{@theme.dir}/application-\w+\.css}
end
def test_without_theme_js
get '/'
assert_response :success
- assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 0
+ assert_select "script[src^=?]", "/assets/themes/#{@theme.dir}/theme.js", 0
end
def test_with_theme_js
get '/'
assert_response :success
- assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 1
+ assert_select "script[src^=?]", "/assets/themes/#{@theme.dir}/theme.js", 1
ensure
@theme.javascripts.delete 'theme'
end
get '/'
assert_response :success
- assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/a.ico"
+ assert_select 'link[rel="shortcut icon"][href^=?]', "/assets/themes/#{@theme.dir}/a.ico"
ensure
@theme.favicons.delete 'a.ico'
end
assert_response :success
assert_select 'link[rel="shortcut icon"]', 1
- assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/b.ico"
+ assert_select 'link[rel="shortcut icon"][href^=?]', "/assets/themes/#{@theme.dir}/b.ico"
ensure
@theme.favicons.delete("b.ico")
@theme.favicons.delete("a.png")
get '/'
assert_response :success
- assert_select "link[rel=stylesheet][href^=?]", "/foo/themes/#{@theme.dir}/stylesheets/application.css"
- assert_select "script[src^=?]", "/foo/themes/#{@theme.dir}/javascripts/theme.js"
- assert_select 'link[rel="shortcut icon"][href^=?]', "/foo/themes/#{@theme.dir}/favicon/a.ico"
+ assert_select "link[rel=stylesheet]:match('href', ?)", %r{/foo/assets/themes/#{@theme.dir}/application-\w+\.css}
+ assert_select "script[src^=?]", "/foo/assets/themes/#{@theme.dir}/theme.js"
+ assert_select 'link[rel="shortcut icon"][href^=?]', "/foo/assets/themes/#{@theme.dir}/a.ico"
ensure
Redmine::Utils.relative_url_root = ''
end
class HelperTest < ActionView::TestCase
include Redmine::I18n
+ include Propshaft::Helper
def setup
super