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.

30 lines
1.1 KiB

  1. import { expect } from 'chai';
  2. import { mount } from 'enzyme';
  3. import sinon from 'sinon';
  4. import React from 'react';
  5. import Column from '../../../../../../app/javascript/mastodon/features/ui/components/column';
  6. import ColumnHeader from '../../../../../../app/javascript/mastodon/features/ui/components/column_header';
  7. describe('<Column />', () => {
  8. describe('<ColumnHeader /> click handler', () => {
  9. beforeEach(() => {
  10. global.requestAnimationFrame = sinon.spy();
  11. });
  12. it('runs the scroll animation if the column contains scrollable content', () => {
  13. const wrapper = mount(
  14. <Column heading="notifications">
  15. <div className="scrollable" />
  16. </Column>
  17. );
  18. wrapper.find(ColumnHeader).simulate('click');
  19. expect(global.requestAnimationFrame.called).to.equal(true);
  20. });
  21. it('does not try to scroll if there is no scrollable content', () => {
  22. const wrapper = mount(<Column heading="notifications" />);
  23. wrapper.find(ColumnHeader).simulate('click');
  24. expect(global.requestAnimationFrame.called).to.equal(false);
  25. });
  26. });
  27. });