32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
|
import { hasHorizontalOverflow, hasVerticalOverflow, hasOverflow } from './overflow';
|
||
|
describe('overflow', function () {
|
||
|
it('returns false when no overflow is present', function () {
|
||
|
expect(hasOverflow({
|
||
|
clientWidth: 10,
|
||
|
clientHeight: 10,
|
||
|
scrollWidth: 10,
|
||
|
scrollHeight: 10,
|
||
|
})).toEqual(false);
|
||
|
});
|
||
|
it('detects horizontal overflow', function () {
|
||
|
var elementWithOverflow = {
|
||
|
clientWidth: 10,
|
||
|
clientHeight: 10,
|
||
|
scrollWidth: 20,
|
||
|
scrollHeight: 10,
|
||
|
};
|
||
|
expect(hasOverflow(elementWithOverflow)).toEqual(true);
|
||
|
expect(hasHorizontalOverflow(elementWithOverflow)).toEqual(true);
|
||
|
});
|
||
|
it('detects vertical overflow', function () {
|
||
|
var elementWithOverflow = {
|
||
|
clientWidth: 10,
|
||
|
clientHeight: 10,
|
||
|
scrollWidth: 10,
|
||
|
scrollHeight: 20,
|
||
|
};
|
||
|
expect(hasOverflow(elementWithOverflow)).toEqual(true);
|
||
|
expect(hasVerticalOverflow(elementWithOverflow)).toEqual(true);
|
||
|
});
|
||
|
});
|
||
|
//# sourceMappingURL=overflow.test.js.map
|