diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6
index 00a4307d7cb..b56ea69f080 100644
--- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6
+++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6
@@ -61,6 +61,11 @@ function findOutlets(collection, callback) {
});
}
+export function clearCache() {
+ _connectorCache = null;
+ _rawCache = null;
+}
+
function buildConnectorCache() {
_connectorCache = {};
_rawCache = {};
diff --git a/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6 b/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6
new file mode 100644
index 00000000000..7c306aef8af
--- /dev/null
+++ b/test/javascripts/acceptance/plugin-outlet-multi-template-test.js.es6
@@ -0,0 +1,28 @@
+import { acceptance } from "helpers/qunit-helpers";
+import { clearCache } from 'discourse/helpers/plugin-outlet';
+
+const HELLO = 'javascripts/multi-test/connectors/user-profile-primary/hello';
+const GOODBYE = 'javascripts/multi-test/connectors/user-profile-primary/goodbye';
+
+acceptance("Plugin Outlet - Multi Template", {
+ setup() {
+ Ember.TEMPLATES[HELLO] = Ember.HTMLBars.compile(`Hello`);
+ Ember.TEMPLATES[GOODBYE] = Ember.HTMLBars.compile(`Goodbye`);
+ },
+
+ teardown() {
+ delete Ember.TEMPLATES[HELLO];
+ delete Ember.TEMPLATES[GOODBYE];
+ clearCache();
+ }
+});
+
+test("Renders a template into the outlet", assert => {
+ visit("/users/eviltrout");
+ andThen(() => {
+ assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
+ assert.ok(find('.user-profile-primary-outlet.goodbye').length === 1, 'it has class names');
+ assert.equal(find('.hello-span').text(), 'Hello', 'it renders into the outlet');
+ assert.equal(find('.bye-span').text(), 'Goodbye', 'it renders into the outlet');
+ });
+});
diff --git a/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6 b/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6
new file mode 100644
index 00000000000..492ab6611bb
--- /dev/null
+++ b/test/javascripts/acceptance/plugin-outlet-single-template-test.js.es6
@@ -0,0 +1,32 @@
+import { acceptance } from "helpers/qunit-helpers";
+import { clearCache } from 'discourse/helpers/plugin-outlet';
+
+const CONNECTOR = 'javascripts/single-test/connectors/user-profile-primary/hello';
+acceptance("Plugin Outlet - Single Template", {
+ setup() {
+ Ember.TEMPLATES[CONNECTOR] = Ember.HTMLBars.compile(
+ `
+ {{model.username}}
+
+ {{model.email}}
+ `
+ );
+ },
+
+ teardown() {
+ delete Ember.TEMPLATES[CONNECTOR];
+ clearCache();
+ }
+});
+
+test("Renders a template into the outlet", assert => {
+ visit("/users/eviltrout");
+ andThen(() => {
+ assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
+ assert.equal(find('.hello-username').text(), 'eviltrout', 'it renders into the outlet');
+ });
+ click('.hello-check-email');
+ andThen(() => {
+ assert.equal(find('.hello-email').text(), 'eviltrout@example.com', 'actions delegate properly');
+ });
+});
diff --git a/test/javascripts/helpers/create-pretender.js.es6 b/test/javascripts/helpers/create-pretender.js.es6
index a9a6d769e44..bfb071f90c0 100644
--- a/test/javascripts/helpers/create-pretender.js.es6
+++ b/test/javascripts/helpers/create-pretender.js.es6
@@ -63,6 +63,10 @@ export default function() {
}] });
});
+ this.get(`/users/eviltrout/emails.json`, () => {
+ return response({ email: 'eviltrout@example.com' });
+ });
+
this.get('/users/eviltrout.json', () => {
const json = fixturesByUrl['/users/eviltrout.json'];
json.user.can_edit = loggedIn();