You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
951 B

  1. import React from 'react';
  2. import { mount } from 'enzyme';
  3. import Column from '../column';
  4. import ColumnHeader from '../column_header';
  5. describe('<Column />', () => {
  6. describe('<ColumnHeader /> click handler', () => {
  7. it('runs the scroll animation if the column contains scrollable content', () => {
  8. const wrapper = mount(
  9. <Column heading='notifications'>
  10. <div className='scrollable' />
  11. </Column>,
  12. );
  13. const scrollToMock = jest.fn();
  14. wrapper.find(Column).find('.scrollable').getDOMNode().scrollTo = scrollToMock;
  15. wrapper.find(ColumnHeader).find('button').simulate('click');
  16. expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 });
  17. });
  18. it('does not try to scroll if there is no scrollable content', () => {
  19. const wrapper = mount(<Column heading='notifications' />);
  20. wrapper.find(ColumnHeader).find('button').simulate('click');
  21. });
  22. });
  23. });