UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

83 lines (81 loc) 2.83 kB
/** * DevExtreme (cjs/__internal/scheduler/r1/utils/agenda.santiago.test.js) * Version: 25.2.3 * Build date: Fri Dec 12 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; var _globals = require("@jest/globals"); var _m_utils_time_zone = _interopRequireDefault(require("../../m_utils_time_zone")); var _agenda = require("./agenda"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e } } const createDate = (year, month, day, hours) => { const dateUTC = _m_utils_time_zone.default.createUTCDateWithLocalOffset(new Date(year, month, day, hours)).getTime(); return dateUTC }; (0, _globals.describe)("calculateRows", (() => { (0, _globals.it)("should count rows through winter 00:00 DST", (() => { (0, _globals.expect)((0, _agenda.calculateRows)([{ groupIndex: 0, startDateUTC: createDate(2016, 8, 6, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 6, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 8, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 8, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 9, 0) }], 7, new Date(2016, 8, 6), 0)).toEqual([ [2, 3, 2, 1, 0, 0, 0] ]) })); (0, _globals.it)("should count rows through summer 00:00 DST", (() => { (0, _globals.expect)((0, _agenda.calculateRows)([{ groupIndex: 0, startDateUTC: createDate(2016, 3, 3, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 3, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 5, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 5, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 6, 0) }], 7, new Date(2016, 3, 2), 0)).toEqual([ [0, 2, 3, 2, 1, 0, 0] ]) })) }));