nexxtway/react-rainbow

View on GitHub
src/components/InternalDropdown/helpers/__test__/isScrollPositionAtMenuBottom.spec.js

Summary

Maintainability
B
4 hrs
Test Coverage
import isScrollPositionAtMenuBottom from '../isScrollPositionAtMenuBottom';

describe('isScrollPositionAtMenuBottom', () => {
    it('should return true when scroll position is at bottom', () => {
        const menuRef = {
            scrollHeight: 925,
            scrollTop: 700,
            clientHeight: 225,
        };

        expect(isScrollPositionAtMenuBottom(menuRef)).toBe(true);
    });
    it('should return false when scroll position is not at bottom', () => {
        const menuRef = {
            scrollHeight: 925,
            scrollTop: 400,
            clientHeight: 225,
        };

        expect(isScrollPositionAtMenuBottom(menuRef)).toBe(false);
    });
});