mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
Revert "Revert Ember 2.10+ for a short while"
This reverts commit 21682fd60b92414348a0e4aecdab1bc5278e14e6.
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { extraConnectorClass } from 'discourse/lib/plugin-connectors';
|
||||
|
||||
const PREFIX = "javascripts/single-test/connectors";
|
||||
acceptance("Plugin Outlet - Connector Class", {
|
||||
setup() {
|
||||
extraConnectorClass('user-profile-primary/hello', {
|
||||
actions: {
|
||||
sayHello() {
|
||||
this.set('hello', 'hello!');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
extraConnectorClass('user-profile-primary/dont-render', {
|
||||
shouldRender(args) {
|
||||
return args.model.get('username') !== 'eviltrout';
|
||||
}
|
||||
});
|
||||
|
||||
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`] = Ember.HTMLBars.compile(
|
||||
`<span class='hello-username'>{{model.username}}</span>
|
||||
<button class='say-hello' {{action "sayHello"}}></button>
|
||||
<span class='hello-result'>{{hello}}</span>`
|
||||
);
|
||||
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`] = Ember.HTMLBars.compile(
|
||||
`I'm not rendered!`
|
||||
);
|
||||
},
|
||||
|
||||
teardown() {
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
|
||||
}
|
||||
});
|
||||
|
||||
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.dont-render').length, "doesn't render");
|
||||
});
|
||||
click('.say-hello');
|
||||
andThen(() => {
|
||||
assert.equal(find('.hello-result').text(), 'hello!', 'actions delegate properly');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user