discourse/plugins/discourse-calendar/test/javascripts/acceptance/topic-calendar-holidays-test.js
Joffrey JAFFEUX 361029ad4d
DEV: full calendar v6 (#33737)
This commit makes the following changes:
- uses fullcalendar 6
- replaces the server generated upcoming dates for recurring events with
a frontend implementation of the RRULE standard (using the fullcalendar
RRULE plugin)
- displays a preview of the event on click on the upcoming events
calendar

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Martin Brennan <martin@discourse.org>
2025-08-26 10:35:05 +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("Discourse Calendar - 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"
);
});
});