This repository has been archived by the owner on Sep 5, 2019. It is now read-only.
forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for mastodon#1574 (mastodon#1584)
- Loading branch information
1 parent
b8a5d65
commit 15827de
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
spec/javascript/components/features/ui/components/column.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}); |