Skip to content

Commit

Permalink
Display input port type specific default suggestions only (DynamoDS#1…
Browse files Browse the repository at this point in the history
…1268)

* input port type specific default suggestions

* test fix
  • Loading branch information
zeusongit authored Nov 25, 2020
1 parent 39cfb7f commit 9c9df01
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
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);
}
}
}

0 comments on commit 9c9df01

Please sign in to comment.