* Running the tests only in the ember cli env hid the fact that the pending posts feature wasn't working in the legacy environment * Tests were using ember-cli-only APIs while there are widely used testing APIs in Discourse that support both ember envs * `ember-test-selectors` was in both dependencies and devDependencies in discourse/package.json * `qunit-dom` in package.json was not only unused but also defunct, as it wasn't pulled into the legacy env app A followup to #14501, and #15128.
36 lines
997 B
JavaScript
36 lines
997 B
JavaScript
import { discourseModule, query } from "discourse/tests/helpers/qunit-helpers";
|
|
import componentTest, {
|
|
setupRenderingTest,
|
|
} from "discourse/tests/helpers/component-test";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import createStore from "discourse/tests/helpers/create-store";
|
|
|
|
discourseModule("Integration | Component | pending-post", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
componentTest("it renders", {
|
|
template: hbs`<PendingPost @post={{this.post}}/>`,
|
|
|
|
beforeEach() {
|
|
const store = createStore();
|
|
store.createRecord("category", { id: 2 });
|
|
const post = store.createRecord("pending-post", {
|
|
id: 1,
|
|
topic_url: "topic-url",
|
|
username: "USERNAME",
|
|
category_id: 2,
|
|
raw_text: "**bold text**",
|
|
});
|
|
this.set("post", post);
|
|
},
|
|
|
|
test(assert) {
|
|
assert.strictEqual(
|
|
query("p.excerpt").textContent.trim(),
|
|
"bold text",
|
|
"renders the cooked text"
|
|
);
|
|
},
|
|
});
|
|
});
|