mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 09:44:06 +08:00
On866ae39d46we added `description_html` and updated `/discourse-post-event/description.gjs` to only use it, but previously we used `description` in the outlet:b4643f7151/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/index.gjs (L251-L256)In this pr we add back the description to the component so that it maintains backwards compatibility with plugins that use the description outlet.
46 lines
1.5 KiB
Text
Vendored
46 lines
1.5 KiB
Text
Vendored
import { render } from "@ember/test-helpers";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import Description from "../../discourse/components/discourse-post-event/description";
|
|
|
|
module("Integration | Component | Description", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("renders plain text description", async function (assert) {
|
|
await render(
|
|
<template>
|
|
<Description @descriptionHtml="Just some plain text" />
|
|
</template>
|
|
);
|
|
|
|
assert.dom(".event-description__text").hasText("Just some plain text");
|
|
assert.dom(".event-description__text a").doesNotExist();
|
|
});
|
|
|
|
test("renders linkified description HTML", async function (assert) {
|
|
const html =
|
|
'Check out <a href="https://example.com">https://example.com</a> for details';
|
|
|
|
await render(
|
|
<template><Description @descriptionHtml={{html}} /></template>
|
|
);
|
|
|
|
assert
|
|
.dom(".event-description__text a")
|
|
.hasAttribute("href", "https://example.com")
|
|
.hasText("https://example.com");
|
|
});
|
|
|
|
test("falls back to plain text @description when @descriptionHtml is absent", async function (assert) {
|
|
await render(
|
|
<template>
|
|
<Description @description="Plain text via legacy argument" />
|
|
</template>
|
|
);
|
|
|
|
assert
|
|
.dom(".event-description__text")
|
|
.hasText("Plain text via legacy argument");
|
|
assert.dom(".event-description__text a").doesNotExist();
|
|
});
|
|
});
|