mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-05-17 03:59:39 +03:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { isNumber, isPlainObject } from 'support/utils/types';
|
|
import { absoluteCoordinates, offsetCoordinates } from 'support/dom/offset';
|
|
|
|
describe('dom offset', () => {
|
|
describe('absoluteCoordinates', () => {
|
|
test('DOM element', () => {
|
|
const result = absoluteCoordinates(document.body);
|
|
expect(isPlainObject(result)).toBe(true);
|
|
expect(isNumber(result.x)).toBe(true);
|
|
expect(isNumber(result.y)).toBe(true);
|
|
});
|
|
|
|
test('null', () => {
|
|
const result = absoluteCoordinates(null);
|
|
expect(isPlainObject(result)).toBe(true);
|
|
expect(result.x).toBe(0);
|
|
expect(result.y).toBe(0);
|
|
});
|
|
});
|
|
|
|
describe('offsetCoordinates', () => {
|
|
test('DOM element', () => {
|
|
const result = offsetCoordinates(document.body);
|
|
expect(isPlainObject(result)).toBe(true);
|
|
expect(isNumber(result.x)).toBe(true);
|
|
expect(isNumber(result.y)).toBe(true);
|
|
});
|
|
|
|
test('null', () => {
|
|
const result = offsetCoordinates(null);
|
|
expect(isPlainObject(result)).toBe(true);
|
|
expect(result.x).toBe(0);
|
|
expect(result.y).toBe(0);
|
|
});
|
|
});
|
|
});
|