devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
62 lines (60 loc) • 3.23 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/appointments_new/appointment/base_appointment.test.js)
* Version: 25.2.8
* Build date: Mon Jun 08 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
var _globals = require("@jest/globals");
var _renderer = _interopRequireDefault(require("../../../../core/renderer"));
var _fx = _interopRequireDefault(require("../../../common/core/animation/fx"));
var _base_appointment_view = require("../__mock__/base_appointment_view");
var _const = require("../const");
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
const defaultAppointmentData = {
title: "Test appointment",
startDate: new Date(2024, 0, 1, 9, 0),
endDate: new Date(2024, 0, 1, 10, 0)
};
(0, _globals.describe)("BaseAppointment", () => {
(0, _globals.beforeEach)(() => {
_fx.default.off = true;
const $container = (0, _renderer.default)("<div>").addClass("container").appendTo(document.body);
(0, _renderer.default)("<div>").addClass("root").appendTo($container)
});
(0, _globals.afterEach)(() => {
(0, _renderer.default)(".container").remove();
_fx.default.off = false;
_globals.jest.useRealTimers()
});
(0, _globals.describe)("Classes", () => {
(0, _globals.it)("should have container class", async () => {
const instance = await (0, _base_appointment_view.createBaseAppointment)((0, _base_appointment_view.getBaseAppointmentViewProperties)(defaultAppointmentData));
(0, _globals.expect)(instance.$element().hasClass(_const.APPOINTMENT_CLASSES.CONTAINER)).toBe(true)
});
_globals.it.each([true, false])("should have correct class for isRecurring = %o", async isRecurring => {
const instance = await (0, _base_appointment_view.createBaseAppointment)((0, _base_appointment_view.getBaseAppointmentViewProperties)(Object.assign({}, defaultAppointmentData, {
recurrenceRule: isRecurring ? "FREQ=DAILY;COUNT=5" : void 0
})));
(0, _globals.expect)(instance.$element().hasClass(_const.APPOINTMENT_TYPE_CLASSES.RECURRING)).toBe(isRecurring)
});
_globals.it.each([true, false])("should have correct class for allDay = %o", async allDay => {
const instance = await (0, _base_appointment_view.createBaseAppointment)((0, _base_appointment_view.getBaseAppointmentViewProperties)(Object.assign({}, defaultAppointmentData, {
allDay: allDay
})));
(0, _globals.expect)(instance.$element().hasClass(_const.APPOINTMENT_TYPE_CLASSES.ALL_DAY)).toBe(allDay)
})
});
(0, _globals.describe)("Aria", () => {
(0, _globals.it)("should have role button", async () => {
const instance = await (0, _base_appointment_view.createBaseAppointment)((0, _base_appointment_view.getBaseAppointmentViewProperties)(defaultAppointmentData));
(0, _globals.expect)(instance.$element().attr("role")).toBe("button")
})
})
});