Skip to content

Commit 96dbae5

Browse files
committed
Add tests for isVirtualized prop
1 parent bd13b2b commit 96dbae5

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/react-sortable-tree.test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PropTypes } from 'react';
33
import { mount } from 'enzyme';
44
import jasmineEnzyme from 'jasmine-enzyme';
55

6-
import { AutoSizer } from 'react-virtualized';
6+
import { List, AutoSizer } from 'react-virtualized';
77
import SortableTree from './react-sortable-tree';
88
import sortableTreeStyles from './react-sortable-tree.scss';
99
import TreeNode from './tree-node';
@@ -173,6 +173,28 @@ describe('<SortableTree />', () => {
173173
expect(wrapper.find(TreeNode).last()).toHaveStyle('height', 43);
174174
});
175175

176+
it('should toggle virtualization according to isVirtualized prop', () => {
177+
const virtualized = mount(
178+
<SortableTree
179+
treeData={[{ title: 'a' }, { title: 'b' }]}
180+
onChange={() => {}}
181+
isVirtualized
182+
/>
183+
);
184+
185+
expect(virtualized.find(List).length).toEqual(1);
186+
187+
const notVirtualized = mount(
188+
<SortableTree
189+
treeData={[{ title: 'a' }, { title: 'b' }]}
190+
onChange={() => {}}
191+
isVirtualized={false}
192+
/>
193+
);
194+
195+
expect(notVirtualized.find(List).length).toEqual(0);
196+
});
197+
176198
it('should change scaffold width according to scaffoldBlockPxWidth prop', () => {
177199
const wrapper = mount(
178200
<SortableTree

0 commit comments

Comments
 (0)