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:
Robin Ward
2020-05-05 12:15:03 -04:00
committed by GitHub
parent 657facb1d5
commit 612284cef3
20 changed files with 75 additions and 53 deletions

View File

@@ -1,17 +1,23 @@
import { acceptance } from "helpers/qunit-helpers";
import compile from "handlebars-compiler";
import {
addRawTemplate,
removeRawTemplate
} from "discourse-common/lib/raw-templates";
const CONNECTOR =
"javascripts/raw-test/connectors/topic-list-before-status/lala";
acceptance("Raw Plugin Outlet", {
beforeEach() {
Discourse.RAW_TEMPLATES[CONNECTOR] = compile(
`<span class='topic-lala'>{{context.topic.id}}</span>`
addRawTemplate(
CONNECTOR,
compile(`<span class='topic-lala'>{{context.topic.id}}</span>`)
);
},
afterEach() {
delete Discourse.RAW_TEMPLATES[CONNECTOR];
removeRawTemplate(CONNECTOR);
}
});