@@ -8,8 +8,10 @@ import ArrayStore from 'common/data/array_store';
88import 'ui/list' ;
99
1010const LIST_ITEM_CLASS = 'dx-list-item' ;
11+ const LIST_ITEMS_CLASS = 'dx-list-items' ;
1112const LIST_ITEM_SELECTED_CLASS = 'dx-list-item-selected' ;
1213const LIST_GROUP_CLASS = 'dx-list-group' ;
14+ const LIST_GROUP_HEADER_CLASS = 'dx-list-group-header' ;
1315const LIST_SELECT_ALL_CHECKBOX_CLASS = 'dx-list-select-all-checkbox' ;
1416const LIST_SELECT_ALL_CLASS = 'dx-list-select-all' ;
1517const SELECT_CHECKBOX_CLASS = 'dx-list-select-checkbox' ;
@@ -316,6 +318,102 @@ QUnit.module('keyboard navigation', {
316318
317319 assert . deepEqual ( list . option ( 'items' ) , items , 'items were reordered' ) ;
318320 } ) ;
321+
322+ QUnit . module ( 'grouped' , {
323+ beforeEach : function ( ) {
324+ this . getInitialItems = ( ) => {
325+ return [ {
326+ items : [ '1-1' , '1-2' ] ,
327+ } , {
328+ items : [ '2-1' , '2-2' ] ,
329+ } ] ;
330+ } ;
331+ this . items = this . getInitialItems ( ) ;
332+ this . $list = $ ( '#list' ) . dxList ( {
333+ items : this . getInitialItems ( ) ,
334+ grouped : true ,
335+ collapsibleGroups : true ,
336+ itemDragging : {
337+ allowReordering : true
338+ } ,
339+ focusStateEnabled : true
340+ } ) ;
341+ this . list = this . $list . dxList ( 'instance' ) ;
342+ this . keyboard = keyboardMock ( this . $list . find ( '[tabindex=0]' ) ) ;
343+ }
344+ } , ( ) => {
345+ QUnit . test ( 'shift+arrowDown on first group last item should not move item out of group (T1281674)' , function ( assert ) {
346+ const $firstGroupLastItem = this . $list
347+ . find ( `.${ LIST_GROUP_CLASS } ` ) . eq ( 0 )
348+ . find ( `.${ LIST_ITEM_CLASS } ` ) . last ( ) ;
349+
350+ $firstGroupLastItem . trigger ( 'dxpointerdown' ) ;
351+ this . clock . tick ( 10 ) ;
352+ this . keyboard . keyDown ( 'arrowDown' , { shiftKey : true } ) ;
353+
354+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items are not reordered' ) ;
355+ } ) ;
356+
357+ QUnit . test ( 'shift+arrowDown on a last group last item should not move item out of group (T1281674)' , function ( assert ) {
358+ const $lastGroupLastItem = this . $list
359+ . find ( `.${ LIST_GROUP_CLASS } ` ) . last ( )
360+ . find ( `.${ LIST_ITEM_CLASS } ` ) . last ( ) ;
361+
362+ $lastGroupLastItem . trigger ( 'dxpointerdown' ) ;
363+ this . clock . tick ( 10 ) ;
364+ this . keyboard . keyDown ( 'arrowDown' , { shiftKey : true } ) ;
365+
366+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items are not reordered' ) ;
367+ } ) ;
368+
369+ QUnit . test ( 'shift+arrowUp on first group first item should not move item out of group (T1281674)' , function ( assert ) {
370+ const $firstGroupFirstItem = this . $list
371+ . find ( `.${ LIST_GROUP_CLASS } ` ) . eq ( 0 )
372+ . find ( `.${ LIST_ITEM_CLASS } ` ) . eq ( 0 ) ;
373+
374+ $firstGroupFirstItem . trigger ( 'dxpointerdown' ) ;
375+ this . clock . tick ( 10 ) ;
376+ this . keyboard . keyDown ( 'arrowUp' , { shiftKey : true } ) ;
377+
378+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items are not reordered' ) ;
379+ } ) ;
380+
381+ QUnit . test ( 'shift+arrowUp on last group first item should not move item out of group (T1281674)' , function ( assert ) {
382+ const $lastGroupFirstItem = this . $list
383+ . find ( `.${ LIST_GROUP_CLASS } ` ) . last ( )
384+ . find ( `.${ LIST_ITEM_CLASS } ` ) . eq ( 0 ) ;
385+
386+ $lastGroupFirstItem . trigger ( 'dxpointerdown' ) ;
387+ this . clock . tick ( 10 ) ;
388+ this . keyboard . keyDown ( 'arrowUp' , { shiftKey : true } ) ;
389+
390+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items are not reordered' ) ;
391+ } ) ;
392+
393+ QUnit . test ( 'shift+arrowDown should not move group header (T1281673)' , function ( assert ) {
394+ const $lastGroupHeader = this . $list . find ( `.${ LIST_GROUP_HEADER_CLASS } ` ) . last ( ) ;
395+
396+ $lastGroupHeader . trigger ( 'dxclick' ) ;
397+ const $initialItemsSnapshot = this . $list . find ( `.${ LIST_ITEMS_CLASS } ` ) . html ( ) ;
398+ this . keyboard . keyDown ( 'arrowDown' , { shiftKey : true } ) ;
399+
400+ const $itemsSnapshot = this . $list . find ( `.${ LIST_ITEMS_CLASS } ` ) . html ( ) ;
401+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items option is not changed' ) ;
402+ assert . deepEqual ( $itemsSnapshot , $initialItemsSnapshot , 'DOM is not changed' ) ;
403+ } ) ;
404+
405+ QUnit . test ( 'shift+arrowUp should not move group header (T1281673)' , function ( assert ) {
406+ const $lastGroupHeader = this . $list . find ( `.${ LIST_GROUP_HEADER_CLASS } ` ) . last ( ) ;
407+
408+ $lastGroupHeader . trigger ( 'dxclick' ) ;
409+ const $initialItemsSnapshot = this . $list . find ( `.${ LIST_ITEMS_CLASS } ` ) . html ( ) ;
410+ this . keyboard . keyDown ( 'arrowUp' , { shiftKey : true } ) ;
411+
412+ const $itemsSnapshot = this . $list . find ( `.${ LIST_ITEMS_CLASS } ` ) . html ( ) ;
413+ assert . deepEqual ( this . list . option ( 'items' ) , this . items , 'items option is not changed' ) ;
414+ assert . deepEqual ( $itemsSnapshot , $initialItemsSnapshot , 'DOM is not changed' ) ;
415+ } ) ;
416+ } ) ;
319417} ) ;
320418
321419QUnit . module ( 'deleting in grouped list with dataSource' , {
0 commit comments