Files
Terminal.Gui/UnitTests/AutocompleteTests.cs
Thomas Nind d60aed79e4 Autocomplete for TextView (#1406)
* Added basic autocomplete style dropdown (not working properly yet)

* Autocomplete basically working but rough around the edges

* Changed to Lists and added CloseKey

* Fixed test, made autocomplete equal length

* Added scrolling through autocomplete list

* Made Accept autocomplete do delete and replace instead of append to support caps changes

* Changed Autocomplete ColorScheme to cyan

* Fixed autocomplete render location when TextView is scrolled

* Fixed scrolling and overspill rendering

* Added wordwrap option to SyntaxHighlighting Scenario

* Moved Autocomplete to be member property of TextView

* Made Suggestions a readonly collection and enabled Autocomplete in Editor Scenario

* Added ClipOrPad tests

* Fixed bad merge

* Delayed init of ColorScheme on Autocomplete until needed

* Changed ColorScheme to match Menu bar
2021-08-24 08:19:43 -07:00

30 lines
625 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terminal.Gui;
using Xunit;
namespace UnitTests {
public class AutocompleteTests {
[Fact][AutoInitShutdown]
public void Test_GenerateSuggestions_Simple()
{
var ac = new Autocomplete ();
ac.AllSuggestions = new List<string> { "fish","const","Cobble"};
var tv = new TextView ();
tv.InsertText ("co");
ac.GenerateSuggestions (tv);
Assert.Equal (2, ac.Suggestions.Count);
Assert.Equal ("const", ac.Suggestions[0]);
Assert.Equal ("Cobble", ac.Suggestions[1]);
}
}
}