This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/integration/components/widgets/post-cooked-test.js
Jarek Radosz 241e92a1c8
FIX: Don't crash on incomplete/invalid quotes
Previously it would throw if a quote had no username and an invalid post/topic id.
2022-09-19 23:22:18 +02:00

22 lines
839 B
JavaScript

import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { render } from "@ember/test-helpers";
import { query } from "discourse/tests/helpers/qunit-helpers";
import { hbs } from "ember-cli-htmlbars";
module("Integration | Component | Widget | post-cooked", function (hooks) {
setupRenderingTest(hooks);
test("quotes with no username and no valid topic", async function (assert) {
this.set("args", {
cooked: `<aside class=\"quote no-group quote-post-not-found\" data-post=\"1\" data-topic=\"123456\">\n<blockquote>\n<p>abcd</p>\n</blockquote>\n</aside>\n<p>Testing the issue</p>`,
});
await render(
hbs`<MountWidget @widget="post-cooked" @args={{this.args}} />`
);
assert.strictEqual(query("blockquote").innerText, "abcd");
});
});