We used many global functions to handle tests when they should be imported like other libraries in our application. This also gets us closer to the way Ember CLI prefers our tests to be laid out.
30 lines
756 B
JavaScript
30 lines
756 B
JavaScript
import { test } from "qunit";
|
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
const CONNECTOR =
|
|
"javascripts/single-test/connectors/user-profile-primary/hello";
|
|
acceptance("Plugin Outlet - Single Template", {
|
|
beforeEach() {
|
|
Ember.TEMPLATES[CONNECTOR] = Ember.HTMLBars.compile(
|
|
`<span class='hello-username'>{{model.username}}</span>`
|
|
);
|
|
},
|
|
|
|
afterEach() {
|
|
delete Ember.TEMPLATES[CONNECTOR];
|
|
},
|
|
});
|
|
|
|
test("Renders a template into the outlet", async (assert) => {
|
|
await visit("/u/eviltrout");
|
|
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"
|
|
);
|
|
});
|