File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 345
345
filters : this . _mapFilters ( ) ,
346
346
parentItem : cache . parentItem
347
347
} ;
348
-
348
+ this . _debounceIncreasePool && this . _debounceIncreasePool . flush ( ) ;
349
349
this . dataProvider ( params , ( items , size ) => {
350
350
if ( size !== undefined ) {
351
351
cache . size = size ;
Original file line number Diff line number Diff line change 366
366
// Effective size should change in between the data requests
367
367
expect ( renderSpy . called ) . to . be . true ;
368
368
expect ( increasePoolSpy . callCount ) . to . above ( 1 ) ;
369
- expect ( updateItemSpy . callCount ) . to . be . below ( 90 ) ;
369
+ expect ( updateItemSpy . callCount ) . to . be . below ( 180 ) ;
370
370
} ) ;
371
371
372
372
it ( 'should keep item expanded on itemIdPath change' , ( ) => {
Original file line number Diff line number Diff line change 39
39
</ template >
40
40
</ test-fixture >
41
41
42
+ < test-fixture id ="treeGrid ">
43
+ < template >
44
+ < vaadin-grid style ="width: 200px; height: 500px; ">
45
+ < vaadin-grid-tree-column path ="name " header ="foo " item-has-children-path ="hasChildren "> </ vaadin-grid-tree-column >
46
+ </ vaadin-grid >
47
+ </ template >
48
+ </ test-fixture >
42
49
< script >
43
50
describe ( 'Scroll to index' , ( ) => {
44
51
228
235
} ) ;
229
236
230
237
} ) ;
231
- </ script >
238
+ describe ( 'Tree grid' , ( ) => {
239
+
240
+ // Issue https://github.com/vaadin/vaadin-grid/issues/2107
241
+ it ( 'should display correctly when scrolled to bottom immediately after setting dataProvider' , done => {
242
+ const grid = fixture ( 'treeGrid' ) ;
243
+ grid . size = 1 ;
244
+ const numberOfChidren = 250 ;
245
+ grid . itemIdPath = 'name' ;
246
+ const PARENT = { name : 'PARENT' , hasChildren : true } ;
247
+ grid . dataProvider = ( { page, parentItem} , cb ) => {
248
+ setTimeout ( ( ) => {
249
+ if ( ! parentItem ) {
250
+ cb ( [ PARENT ] , 1 ) ;
251
+ return ;
252
+ }
232
253
254
+ const scope = parentItem . name ;
255
+ const offset = page * grid . pageSize ;
256
+ cb ( [ ...new Array ( grid . pageSize ) ] . map ( ( _ , index ) => {
257
+ return { name : 'Child ' + ( offset + index ) , hasChildren : false } ;
258
+ } ) , numberOfChidren ) ;
259
+ if ( page > 0 ) {
260
+ expect ( grid . _physicalCount ) . to . be . above ( 10 ) ;
261
+ done ( ) ;
262
+ }
263
+ } ) ;
264
+ } ;
265
+ grid . expandedItems = [ PARENT ] ;
266
+ grid . scrollToIndex ( 250 ) ;
267
+ } ) ;
268
+
269
+ } ) ;
270
+ </ script >
233
271
</ body >
234
272
235
273
</ html >
You can’t perform that action at this time.
0 commit comments