Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit committed Dec 8, 2023
1 parent fba8e45 commit f7c3fcd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,37 @@ public void SearchNodeAutocompletionSuggestions()
Assert.AreEqual(5 , searchViewModel.FilteredResults.Count());
}

[Test]
public void CloseNodeAutocompleteWhenParentNodeDeleted()
{
Open(@"UI\builtin_inputport_suggestion.dyn");

// Get the node view for a specific node in the graph
NodeView nodeView = NodeViewWithGuid(Guid.Parse("77aad5875f124bf59a4ece6b30813d3b").ToString());

var inPorts = nodeView.ViewModel.InPorts;
Assert.AreEqual(2, inPorts.Count());
var port = inPorts[0].PortModel;
var type = port.GetInputPortType();
Assert.AreEqual("DSCore.Color[]", type);

var searchViewModel = (ViewModel.CurrentSpaceViewModel.NodeAutoCompleteSearchViewModel as NodeAutoCompleteSearchViewModel);
searchViewModel.PortViewModel = inPorts[0];
searchViewModel.dynamoViewModel.PreferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;

// Get the matching node elements for the specific node port.
searchViewModel.PopulateAutoCompleteCandidates();
// Show Node AutoCompleteSearchBar
ViewModel.CurrentSpaceViewModel.OnRequestNodeAutoCompleteSearch(ShowHideFlags.Show);
//remove the parent node
searchViewModel.dynamoViewModel.CurrentSpaceViewModel.Model.RemoveAndDisposeNode(nodeView.ViewModel.NodeModel);

var currentWs = View.ChildOfType<WorkspaceView>();
//confirm if the AutoCompleteSearchBar is closed.
Assert.IsFalse(currentWs.NodeAutoCompleteSearchBar.IsOpen);

}

[Test]
public void NodeSuggestions_SkippedSuggestions()
{
Expand Down

0 comments on commit f7c3fcd

Please sign in to comment.