mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 23:41:52 +00:00
Add unit tests for https://github.com/tootsuite/mastodon/pull/1574 (#1584)
This commit is contained in:
parent
3064ef96a1
commit
08fce08217
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user