Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Node Auto Complete in CustomNodeWorkspace #11307

Merged
merged 2 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Notes;
using Dynamo.Graph.Workspaces;
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Search.SearchElements;
using Dynamo.Selection;
using Dynamo.UI;
using Dynamo.UI.Controls;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Wpf.UI;
Expand Down Expand Up @@ -392,6 +390,7 @@ void OnWorkspaceViewDataContextChanged(object sender, DependencyPropertyChangedE
ViewModel.RequestAddViewToOuterCanvas += vm_RequestAddViewToOuterCanvas;
ViewModel.WorkspacePropertyEditRequested += VmOnWorkspacePropertyEditRequested;
ViewModel.RequestSelectionBoxUpdate += VmOnRequestSelectionBoxUpdate;
ViewModel.RequestNodeAutoCompleteSearch += ShowHideNodeAutoCompleteControl;

ViewModel.Loaded();
}
Expand Down
30 changes: 30 additions & 0 deletions test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ public override void Start()
Model.AddZeroTouchNodesToSearch(Model.LibraryServices.GetAllFunctionGroups());
}

[Test]
public void NodeSuggestions_CanAutoCompleteInCustomNodeWorkspace()
{
Open(@"pkgs\EvenOdd2\dyf\EvenOdd.dyf");

// Pick the % node
NodeView nodeView = NodeViewWithGuid(Guid.Parse("1ddf4b4cc39f42acadd578db42bcb6d3").ToString());

var inPorts = nodeView.ViewModel.InPorts;
Assert.AreEqual(2, inPorts.Count());

var port = inPorts[0].PortModel;
var type = port.GetInputPortType();
Assert.AreEqual("var[]..[]", type);

port = inPorts[1].PortModel;
type = port.GetInputPortType();
Assert.AreEqual("var[]..[]", type);

var searchViewModel = ViewModel.CurrentSpaceViewModel.NodeAutoCompleteSearchViewModel;
searchViewModel.PortViewModel = inPorts[1];
var suggestions = searchViewModel.GetMatchingSearchElements();
// No matching search elements should be found
Assert.AreEqual(0, suggestions.Count());

// Show Node AutoCompleteSearchBar in custom node workspace
ViewModel.CurrentSpaceViewModel.OnRequestNodeAutoCompleteSearch(ShowHideFlags.Show);
var currentWs = View.ChildOfType<WorkspaceView>();
Assert.IsTrue(currentWs.NodeAutoCompleteSearchBar.IsOpen);
}

[Test]
public void NodeSuggestions_InputPortZeroTouchNode_AreCorrect()
Expand Down