UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

120 lines (119 loc) 3.74 kB
/** * DevExtreme (esm/__internal/scheduler/appointments/resizing/get_delta_time.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 { VIEW_TYPES } from "../../utils/options/constants_view"; import { getDeltaTime } from "./get_delta_time"; describe("getDeltaTime", () => { VIEW_TYPES.forEach(view => { it(`should return zero for not resized appointment in ${view} view`, () => { expect(getDeltaTime({ width: 100, height: 100 }, { width: 100, height: 100 }, { viewType: view, cellSize: { width: 50, height: 50 }, resizableStep: 50, cellDurationInMinutes: 30, isAllDayPanel: true })).toBe(0) }) }); ["day", "week", "workWeek"].forEach(view => { it(`should return correct delta in px for resized appointment in vertical ${view} view`, () => { expect(getDeltaTime({ width: 100, height: 50 }, { width: 100, height: 100 }, { viewType: view, cellSize: { width: 50, height: 50 }, resizableStep: 50, cellDurationInMinutes: 30, isAllDayPanel: false })).toBe(-18e5) }); it(`should return correct delta in px for resized all day appointment in vertical ${view} view`, () => { expect(getDeltaTime({ width: 50, height: 100 }, { width: 100, height: 100 }, { viewType: view, cellSize: { width: 50, height: 50 }, resizableStep: 50, cellDurationInMinutes: 30, isAllDayPanel: true })).toBe(-864e5) }) }); ["timelineMonth", "month"].forEach(view => { it(`should return correct delta in px for resized appointment in ${view} view`, () => { expect(getDeltaTime({ width: 50, height: 100 }, { width: 100, height: 100 }, { viewType: view, cellSize: { width: 50, height: 50 }, resizableStep: 50, cellDurationInMinutes: 30, isAllDayPanel: false })).toBe(-864e5) }) }); ["timelineDay", "timelineWeek", "timelineWorkWeek"].forEach(view => { it(`should return zero for not resized appointment in horizontal ${view} view`, () => { expect(getDeltaTime({ width: 50, height: 100 }, { width: 100, height: 100 }, { viewType: view, cellSize: { width: 50, height: 50 }, resizableStep: 50, cellDurationInMinutes: 30, isAllDayPanel: false })).toBe(-18e5) }) }) });