UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

83 lines (81 loc) 2.84 kB
/** * DevExtreme (cjs/__internal/scheduler/r1/utils/agenda.pacific.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 02:00 DST", (() => { (0, _globals.expect)((0, _agenda.calculateRows)([{ groupIndex: 0, startDateUTC: createDate(2016, 10, 5, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 5, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 6, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 6, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 6, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 7, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 7, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 10, 8, 0) }], 7, new Date(2016, 10, 5), 0)).toEqual([ [2, 3, 2, 1, 0, 0, 0] ]) })); (0, _globals.it)("should count rows through summer 02:00 DST", (() => { (0, _globals.expect)((0, _agenda.calculateRows)([{ groupIndex: 0, startDateUTC: createDate(2016, 2, 12, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 12, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 13, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 13, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 13, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 14, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 14, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 2, 15, 0) }], 7, new Date(2016, 2, 11), 0)).toEqual([ [0, 2, 3, 2, 1, 0, 0] ]) })) }));