0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.js
Jarek Radosz 893fcf714b
DEV: Remove plugin names from test titles (#39418)
Those are now automatically included in testem's output.
2026-04-21 19:19:52 +02:00

52 lines
1.4 KiB
JavaScript
Vendored

import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { cloneJSON } from "discourse/lib/object";
import { acceptance, fakeTime } from "discourse/tests/helpers/qunit-helpers";
import eventTopicFixture from "../helpers/event-topic-fixture";
acceptance("Topic Calendar Holidays", function (needs) {
needs.hooks.beforeEach(function () {
this.clock = fakeTime("2023-12-10T00:00:00", "America/Los_Angeles", true);
});
needs.hooks.afterEach(function () {
this.clock.restore();
});
needs.settings({
calendar_enabled: true,
});
needs.pretender((server, helper) => {
const clonedEventTopicFixture = cloneJSON(eventTopicFixture);
clonedEventTopicFixture.post_stream.posts[0].calendar_details = [
{
type: "grouped",
from: "2023-12-25T05:00:00.000Z",
timezone: "Europe/Rome",
name: "Natale",
users: [
{
username: "gmt+1_user",
timezone: "Europe/Rome",
},
],
},
];
server.get("/t/252.json", () => {
return helper.response(clonedEventTopicFixture);
});
});
test("renders calendar holidays with fullDay='true'", async (assert) => {
await visit("/t/-/252");
assert
.dom(".fc-daygrid-body tr:nth-of-type(5) .fc-event-title")
.hasText(
"gmt+1_user",
"Italian Christmas Day is displayed on Monday 2023-12-25"
);
});
});