DEV: Support for running theme test with Ember CLI (third attempt)

The second attempt fixed issues with smoke test.

This one makes sure minification only happens in production mode.
This commit is contained in:
Robin Ward
2022-01-13 15:16:34 -05:00
parent f82f0e1179
commit 6272edd121
30 changed files with 274 additions and 153 deletions

View File

@ -13,9 +13,11 @@ module ApplicationHelper
@extra_body_classes ||= Set.new
end
def discourse_config_environment
def discourse_config_environment(testing: false)
# TODO: Can this come from Ember CLI somehow?
{ modulePrefix: "discourse",
config = {
modulePrefix: "discourse",
environment: Rails.env,
rootURL: Discourse.base_path,
locationType: "auto",
@ -32,7 +34,16 @@ module ApplicationHelper
version: "#{Discourse::VERSION::STRING} #{Discourse.git_version}",
exportApplicationGlobal: true
}
}.to_json
}
if testing
config[:environment] = "test"
config[:locationType] = "none"
config[:APP][:autoboot] = false
config[:APP][:rootElement] = '#ember-testing'
end
config.to_json
end
def google_universal_analytics_json(ua_domain_name = nil)