mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 12:51:24 +08:00
DEV: Remove Discourse.RAW_TEMPLATES
(#9630)
We were sharing `Discourse` both as an application object and a namespace which complicated things for Ember CLI. This patch moves raw templates into `__DISCOURSE_RAW_TEMPLATES` and adds a couple helper methods to create/remove them.
This commit is contained in:
@ -112,19 +112,19 @@ describe ThemeJavascriptCompiler do
|
||||
|
||||
describe "#append_raw_template" do
|
||||
let(:compiler) { ThemeJavascriptCompiler.new(1, 'marks') }
|
||||
it 'adds the correct template to "Discourse.RAW_TEMPLATES"' do
|
||||
it 'uses the correct template paths' do
|
||||
template = "<h1>hello</h1>"
|
||||
name = "/path/to/templates1"
|
||||
compiler.append_raw_template("#{name}.raw", template)
|
||||
expect(compiler.content.to_s).to include("Discourse.RAW_TEMPLATES[\"#{name}\"]")
|
||||
expect(compiler.content.to_s).to include("addRawTemplate(\"#{name}\"")
|
||||
|
||||
name = "/path/to/templates2"
|
||||
compiler.append_raw_template("#{name}.hbr", template)
|
||||
expect(compiler.content.to_s).to include("Discourse.RAW_TEMPLATES[\"#{name}\"]")
|
||||
expect(compiler.content.to_s).to include("addRawTemplate(\"#{name}\"")
|
||||
|
||||
name = "/path/to/templates3"
|
||||
compiler.append_raw_template("#{name}.hbs", template)
|
||||
expect(compiler.content.to_s).to include("Discourse.RAW_TEMPLATES[\"#{name}.hbs\"]")
|
||||
expect(compiler.content.to_s).to include("addRawTemplate(\"#{name}.hbs\"")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user