File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import React, { PropTypes } from 'react';
33import { mount } from 'enzyme' ;
44import jasmineEnzyme from 'jasmine-enzyme' ;
55
6- import { AutoSizer } from 'react-virtualized' ;
6+ import { List , AutoSizer } from 'react-virtualized' ;
77import SortableTree from './react-sortable-tree' ;
88import sortableTreeStyles from './react-sortable-tree.scss' ;
99import 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
You can’t perform that action at this time.
0 commit comments