@@ -5021,6 +5021,78 @@ describe('dockviewComponent', () => {
5021
5021
expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5022
5022
} ) ;
5023
5023
5024
+ test ( 'grid -> floating -> popout -> floating' , async ( ) => {
5025
+ const container = document . createElement ( 'div' ) ;
5026
+
5027
+ window . open = ( ) => setupMockWindow ( ) ;
5028
+
5029
+ const dockview = new DockviewComponent ( container , {
5030
+ createComponent ( options ) {
5031
+ switch ( options . name ) {
5032
+ case 'default' :
5033
+ return new PanelContentPartTest (
5034
+ options . id ,
5035
+ options . name
5036
+ ) ;
5037
+ default :
5038
+ throw new Error ( `unsupported` ) ;
5039
+ }
5040
+ } ,
5041
+ } ) ;
5042
+
5043
+ dockview . layout ( 1000 , 500 ) ;
5044
+
5045
+ const panel1 = dockview . addPanel ( {
5046
+ id : 'panel_1' ,
5047
+ component : 'default' ,
5048
+ } ) ;
5049
+
5050
+ const panel2 = dockview . addPanel ( {
5051
+ id : 'panel_2' ,
5052
+ component : 'default' ,
5053
+ } ) ;
5054
+
5055
+ const panel3 = dockview . addPanel ( {
5056
+ id : 'panel_3' ,
5057
+ component : 'default' ,
5058
+ position : { direction : 'right' } ,
5059
+ } ) ;
5060
+
5061
+ expect ( panel1 . api . location . type ) . toBe ( 'grid' ) ;
5062
+ expect ( panel2 . api . location . type ) . toBe ( 'grid' ) ;
5063
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5064
+
5065
+ dockview . addFloatingGroup ( panel2 . group ) ;
5066
+
5067
+ expect ( panel1 . api . location . type ) . toBe ( 'floating' ) ;
5068
+ expect ( panel2 . api . location . type ) . toBe ( 'floating' ) ;
5069
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5070
+
5071
+ await dockview . addPopoutGroup ( panel2 . group ) ;
5072
+
5073
+ expect ( panel1 . api . location . type ) . toBe ( 'popout' ) ;
5074
+ expect ( panel2 . api . location . type ) . toBe ( 'popout' ) ;
5075
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5076
+
5077
+ dockview . addFloatingGroup ( panel2 . group ) ;
5078
+
5079
+ expect ( panel1 . api . location . type ) . toBe ( 'floating' ) ;
5080
+ expect ( panel2 . api . location . type ) . toBe ( 'floating' ) ;
5081
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5082
+
5083
+ await dockview . addPopoutGroup ( panel2 . group ) ;
5084
+
5085
+ expect ( panel1 . api . location . type ) . toBe ( 'popout' ) ;
5086
+ expect ( panel2 . api . location . type ) . toBe ( 'popout' ) ;
5087
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5088
+
5089
+ panel2 . group . api . moveTo ( { group : panel3 . group } ) ;
5090
+
5091
+ expect ( panel1 . api . location . type ) . toBe ( 'grid' ) ;
5092
+ expect ( panel2 . api . location . type ) . toBe ( 'grid' ) ;
5093
+ expect ( panel3 . api . location . type ) . toBe ( 'grid' ) ;
5094
+ } ) ;
5095
+
5024
5096
test ( 'that panel is rendered when moving from popout to new group' , async ( ) => {
5025
5097
const container = document . createElement ( 'div' ) ;
5026
5098
0 commit comments