overflowList.test.js 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { mount } from 'enzyme';
  3. import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/base/constants';
  4. import OverflowList from '../index';
  5. describe('OverflowList', () => {
  6. // it('render basic', () => {
  7. // const node = mount(
  8. // <OverflowList
  9. // items={[{ key: 'alarm' }, { key: 'bookmark' }, { key: 'camera' }, { key: 'duration' }]}
  10. // visibleItemRenderer={item => <div>{item.key}</div>}
  11. // overflowRenderer={() => null}
  12. // />
  13. // );
  14. // expect(node.find(`.${BASE_CLASS_PREFIX}-overflow-list`).exists()).toEqual(true);
  15. // // expect(node.find(`.${BASE_CLASS_PREFIX}-overflow-list-spacer`).exists()).toEqual(true);
  16. // });
  17. it('render scroll', () => {
  18. const node = mount(
  19. <OverflowList
  20. items={[{ key: 'alarm' }, { key: 'bookmark' }, { key: 'camera' }, { key: 'duration' }]}
  21. visibleItemRenderer={item => <div>{item.key}</div>}
  22. overflowRenderer={() => [null, null]}
  23. renderMode="scroll"
  24. />
  25. );
  26. expect(node.find(`.${BASE_CLASS_PREFIX}-overflow-list`).exists()).toEqual(true);
  27. expect(node.find(`.${BASE_CLASS_PREFIX}-overflow-list-scroll-wrapper`).exists()).toEqual(true);
  28. node.unmount();
  29. });
  30. });