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

Display input port type specific default suggestions only #11268

Merged
merged 9 commits into from
Nov 25, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,25 @@ internal void PopulateAutoCompleteCandidates()
// If node match searchElements found, use default suggestions
if (!searchElementsCache.Any())
{
searchElementsCache = DefaultResults.Select(e => e.Model).ToList();
FilteredResults = DefaultResults;
searchElementsCache = DefaultResults.Select(e => e.Model).ToList();
switch (PortViewModel.PortModel.GetInputPortType())
{
case "int":
FilteredResults = DefaultResults.Where(e => e.Name == "Number Slider" || e.Name == "Integer Slider").ToList();
break;
case "double":
FilteredResults = DefaultResults.Where(e => e.Name == "Number Slider" || e.Name == "Integer Slider").ToList();
break;
case "string":
FilteredResults = DefaultResults.Where(e => e.Name == "String").ToList();
break;
case "bool":
FilteredResults = DefaultResults.Where(e => e.Name == "Boolean").ToList();
break;
default:
FilteredResults = DefaultResults;
break;
}
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions test/DynamoCoreWpfTests/NodeAutoCompleteSearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ public void NodeSuggestions_SkippedSuggestions()

// The initial list will fill the FilteredResults with a list of default options
searchViewModel.PopulateAutoCompleteCandidates();
Assert.AreEqual(5, searchViewModel.FilteredResults.Count());
Assert.AreEqual("String", searchViewModel.FilteredResults.FirstOrDefault().Name);
Assert.AreEqual(2, searchViewModel.FilteredResults.Count());
Assert.AreEqual("Number Slider", searchViewModel.FilteredResults.FirstOrDefault().Name);
}
}
}