diff --git a/test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs b/test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs index 0f5f511d018..47a6d075287 100644 --- a/test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs +++ b/test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs @@ -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(); + //confirm if the AutoCompleteSearchBar is closed. + Assert.IsFalse(currentWs.NodeAutoCompleteSearchBar.IsOpen); + + } + [Test] public void NodeSuggestions_SkippedSuggestions() {