devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
59 lines (58 loc) • 2.16 kB
JavaScript
/**
* DevExtreme (esm/__internal/grids/pivot_grid/field_chooser/utils.test.js)
* Version: 25.2.7
* Build date: Tue May 05 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 {
shouldCancelDragging
} from "./utils";
describe("shouldCancelDragging", () => {
it("should return false when field is undefined", () => {
expect(shouldCancelDragging(void 0, "column")).toBe(false);
expect(shouldCancelDragging(void 0, "row")).toBe(false);
expect(shouldCancelDragging(void 0, "filter")).toBe(false);
expect(shouldCancelDragging(void 0, "data")).toBe(false)
});
it("should return true when isMeasure is true and target is column", () => {
expect(shouldCancelDragging({
isMeasure: true
}, "column")).toBe(true)
});
it("should return true when isMeasure is true and target is row", () => {
expect(shouldCancelDragging({
isMeasure: true
}, "row")).toBe(true)
});
it("should return true when isMeasure is true and target is filter", () => {
expect(shouldCancelDragging({
isMeasure: true
}, "filter")).toBe(true)
});
it("should return false when isMeasure is true and target is data", () => {
expect(shouldCancelDragging({
isMeasure: true
}, "data")).toBe(false)
});
it("should return true when isMeasure is false and target is data", () => {
expect(shouldCancelDragging({
isMeasure: false
}, "data")).toBe(true)
});
it("should return false when isMeasure is false and target is column", () => {
expect(shouldCancelDragging({
isMeasure: false
}, "column")).toBe(false)
});
it("should return false when isMeasure is undefined", () => {
expect(shouldCancelDragging({}, "data")).toBe(false);
expect(shouldCancelDragging({}, "column")).toBe(false)
})
});