mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: allow plugins to overwrite handlebars templates
This commit is contained in:
@ -5,7 +5,7 @@ var lookup = function(lookupString, expectedTemplate, message) {
|
||||
equal(Discourse.__container__.lookup(lookupString, {singleton: false}), expectedTemplate, message);
|
||||
};
|
||||
|
||||
var setTemplates = function(lookupStrings) {
|
||||
var setTemplates = function(lookupStrings) {
|
||||
lookupStrings.forEach(function(lookupString) {
|
||||
Ember.TEMPLATES[lookupString] = lookupString;
|
||||
});
|
||||
@ -95,6 +95,19 @@ test("resolves mobile templates to 'mobile/' namespace", function() {
|
||||
lookup("template:baz", "baz", "falling back to a normal version when mobile version is not present");
|
||||
});
|
||||
|
||||
test("resolves plugin templates to 'javascripts/' namespace", function() {
|
||||
setTemplates([
|
||||
"javascripts/foo",
|
||||
"bar",
|
||||
"javascripts/bar",
|
||||
"baz"
|
||||
]);
|
||||
|
||||
lookup("template:foo", "javascripts/foo", "finding plugin version even if normal one is not present");
|
||||
lookup("template:bar", "javascripts/bar", "preferring plugin version when both versions are present");
|
||||
lookup("template:baz", "baz", "falling back to a normal version when plugin version is not present");
|
||||
});
|
||||
|
||||
test("resolves templates with 'admin' prefix to 'admin/templates/' namespace", function() {
|
||||
setTemplates([
|
||||
"admin/templates/foo",
|
||||
|
Reference in New Issue
Block a user