devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
58 lines (57 loc) • 1.51 kB
JavaScript
/**
* DevExtreme (esm/__internal/scheduler/r1/utils/agenda.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/
*/
import {
describe,
expect,
it
} from "@jest/globals";
import {
calculateRows
} from "./agenda";
const items = [{
groupIndex: 0,
startDateUTC: Date.UTC(2020, 0, 10, 5)
}, {
groupIndex: 0,
startDateUTC: Date.UTC(2020, 0, 11, 5)
}, {
groupIndex: 0,
startDateUTC: Date.UTC(2020, 0, 15, 5)
}, {
groupIndex: 0,
startDateUTC: Date.UTC(2020, 0, 10, 15)
}, {
groupIndex: 1,
startDateUTC: Date.UTC(2020, 0, 14, 5)
}, {
groupIndex: 1,
startDateUTC: Date.UTC(2020, 0, 11, 5)
}, {
groupIndex: 1,
startDateUTC: Date.UTC(2020, 0, 11, 15)
}, {
groupIndex: 1,
startDateUTC: Date.UTC(2020, 0, 14, 15)
}, {
groupIndex: 1,
startDateUTC: Date.UTC(2020, 0, 12, 5)
}];
describe("calculateRows", () => {
it("should count rows for no grouping", () => {
expect(calculateRows(items.slice(0, 4), 7, new Date(2020, 0, 10), 0)).toEqual([
[2, 1, 0, 0, 0, 1, 0]
])
});
it("should count rows for grouped items", () => {
expect(calculateRows(items, 7, new Date(2020, 0, 10), 2)).toEqual([
[2, 1, 0, 0, 0, 1, 0],
[0, 2, 1, 0, 2, 0, 0]
])
})
});