mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 19:33:44 +08:00
17 lines
523 B
Ruby
17 lines
523 B
Ruby
# frozen_string_literal: true
|
|
|
|
module QunitHelper
|
|
def theme_tests
|
|
theme = Theme.find_by(id: request.env[:resolved_theme_id])
|
|
return "" if theme.blank?
|
|
|
|
_, digest = theme.baked_js_tests_with_digest
|
|
src =
|
|
"#{GlobalSetting.cdn_url}" \
|
|
"#{Discourse.base_path}" \
|
|
"/theme-javascripts/tests/#{theme.id}-#{digest}.js" \
|
|
"?__ws=#{Discourse.current_hostname}"
|
|
"<script defer src='#{src}' data-theme-id='#{theme.id}' nonce='#{csp_nonce_placeholder}'></script>".html_safe
|
|
end
|
|
end
|