fly_out_nav_spec.js 599 字节
Newer Older
P
Phil Hughes 已提交
1
import { calculateTop } from '~/fly_out_nav';
2 3 4 5 6 7

describe('Fly out sidebar navigation', () => {
  describe('calculateTop', () => {
    it('returns boundingRect top', () => {
      const boundingRect = {
        top: 100,
8
        height: 100,
9 10 11 12 13 14 15 16 17
      };

      expect(
        calculateTop(boundingRect, 100),
      ).toBe(100);
    });

    it('returns boundingRect - bottomOverflow', () => {
      const boundingRect = {
18 19
        top: window.innerHeight - 50,
        height: 100,
20 21 22 23
      };

      expect(
        calculateTop(boundingRect, 100),
24
      ).toBe(window.innerHeight - 50);
25 26 27
    });
  });
});