File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { mount } from 'enzyme' ;
22import React from 'react' ;
3- import { Builder , IBuilderFieldProps } from './builder' ;
3+ import { Builder , defaultComponents , IBuilderFieldProps } from './builder' ;
44
55export const fields : IBuilderFieldProps [ ] = [
66 {
@@ -467,4 +467,52 @@ describe('#components/Builder', () => {
467467 ) . toEqual ( 0 ) ;
468468 expect ( wrapper . find ( '[data-test="DragHandle"]' ) . hostNodes ( ) . length ) . toEqual ( 0 ) ;
469469 } ) ;
470+
471+ it ( 'Keeps the boundary drop zone before a locked sibling group' , ( ) => {
472+ const wrapper = mount (
473+ < Builder
474+ fields = { fields }
475+ draggable
476+ components = { {
477+ ...defaultComponents ,
478+ DropZone : ( { index, parentId } ) => (
479+ < div
480+ data-test = "DropZone"
481+ data-index = { index }
482+ data-parent-id = { parentId || 'root' }
483+ />
484+ ) ,
485+ } }
486+ data = { [
487+ {
488+ type : 'GROUP' ,
489+ value : 'AND' ,
490+ isNegated : false ,
491+ children : [
492+ {
493+ type : 'GROUP' ,
494+ value : 'AND' ,
495+ isNegated : false ,
496+ children : [ ] ,
497+ } ,
498+ {
499+ type : 'GROUP' ,
500+ value : 'AND' ,
501+ isNegated : false ,
502+ readOnly : true ,
503+ children : [ ] ,
504+ } ,
505+ ] ,
506+ } ,
507+ ] }
508+ />
509+ ) ;
510+
511+ expect (
512+ wrapper
513+ . find ( '[data-test="DropZone"]' )
514+ . hostNodes ( )
515+ . filterWhere ( ( node ) => node . prop ( 'data-index' ) === 1 ) . length
516+ ) . toEqual ( 1 ) ;
517+ } ) ;
470518} ) ;
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export const Iterator: FC<IIteratorProps> = ({
122122 ) ;
123123
124124 if ( ! canSortAtLevel || isGroupReadOnly ) {
125- return [ group ( ) ] ;
125+ return [ ! isCollapsedSourceBoundary ? leadingDropZone : null , group ( ) ] ;
126126 }
127127
128128 return [
@@ -150,7 +150,7 @@ export const Iterator: FC<IIteratorProps> = ({
150150 ) ;
151151
152152 if ( ! canSortAtLevel || isRuleReadOnly ) {
153- return [ rule ( ) ] ;
153+ return [ ! isCollapsedSourceBoundary ? leadingDropZone : null , rule ( ) ] ;
154154 }
155155
156156 return [
You can’t perform that action at this time.
0 commit comments