0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 09:44:06 +08:00
discourse/plugins/discourse-calendar/test/javascripts/integration/components/description-test.gjs
Gabriel Grubba 2fbfd5d48d
FIX: Add back description to calendar Description component for backwards compatibility (#40280)
On
866ae39d46
we 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.
2026-06-01 12:07:57 -03:00

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();
});
});