Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Add unit tests for mastodon#1574 (mastodon#1584)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrycatalinismith authored and thurloat committed Apr 13, 2017
1 parent b8a5d65 commit 15827de
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/javascript/components/features/ui/components/column.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { expect } from 'chai';
import { mount } from 'enzyme';
import sinon from 'sinon';

import Column from '../../../../../../app/assets/javascripts/components/features/ui/components/column';
import ColumnHeader from '../../../../../../app/assets/javascripts/components/features/ui/components/column_header';

describe('<Column />', () => {
describe('<ColumnHeader /> click handler', () => {
beforeEach(() => {
global.requestAnimationFrame = sinon.spy();
});

it('runs the scroll animation if the column contains scrollable content', () => {
const wrapper = mount(
<Column heading="notifications">
<div className="scrollable" />
</Column>
);
wrapper.find(ColumnHeader).simulate('click');
expect(global.requestAnimationFrame.called).to.equal(true);
});

it('does not try to scroll if there is no scrollable content', () => {
const wrapper = mount(<Column heading="notifications" />);
wrapper.find(ColumnHeader).simulate('click');
expect(global.requestAnimationFrame.called).to.equal(false);
});
});
});

0 comments on commit 15827de

Please sign in to comment.