File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1221,6 +1221,30 @@ public async Task ShowToolbar_Ok()
12211221 Assert . Contains ( "test-toolbar-template" , cut . Markup ) ;
12221222 }
12231223
1224+ [ Fact ]
1225+ public async Task AllowDrag_Ok ( )
1226+ {
1227+ TreeViewDragContext < TreeFoo > ? treeDragContext = null ;
1228+ var cut = Context . RenderComponent < TreeView < TreeFoo > > ( pb =>
1229+ {
1230+ pb . Add ( a => a . AllowDrag , true ) ;
1231+ pb . Add ( a => a . Items , TreeFoo . GetTreeItems ( ) ) ;
1232+ pb . Add ( a => a . OnDragItemEndAsync , context =>
1233+ {
1234+ treeDragContext = context ;
1235+ return Task . CompletedTask ;
1236+ } ) ;
1237+ } ) ;
1238+
1239+ await cut . Instance . TriggerDragEnd ( 1 , 2 , false ) ;
1240+ cut . SetParametersAndRender ( ) ;
1241+
1242+ Assert . NotNull ( treeDragContext ) ;
1243+ Assert . NotNull ( treeDragContext . Target ) ;
1244+ Assert . NotNull ( treeDragContext . Source ) ;
1245+ Assert . False ( treeDragContext . IsChildren ) ;
1246+ }
1247+
12241248 class MockTree < TItem > : TreeView < TItem > where TItem : class
12251249 {
12261250 public bool TestComparerItem ( TItem ? a , TItem ? b ) => base . Equals ( a , b ) ;
You can’t perform that action at this time.
0 commit comments