mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Replace the placeholder TextBlock with the real layout: a TextBox at the top bound two-way to SearchPaneModel.SearchTerm (UpdateSourceTrigger PropertyChanged so the orchestrator reacts on every keystroke once it lands), a ComboBox bound to SearchModes / SelectedSearchMode, and a ListBox that renders each SearchResult as three trimmed columns (Name / Location / Assembly). Assisted-by: Claude:claude-opus-4-7:Claude Codepull/3755/head
2 changed files with 106 additions and 3 deletions
@ -0,0 +1,76 @@ |
|||||||
|
// Copyright (c) 2026 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System.Linq; |
||||||
|
using System.Threading.Tasks; |
||||||
|
|
||||||
|
using Avalonia.Controls; |
||||||
|
using Avalonia.Headless.NUnit; |
||||||
|
|
||||||
|
using AwesomeAssertions; |
||||||
|
|
||||||
|
using ILSpy.AppEnv; |
||||||
|
using ILSpy.Search; |
||||||
|
using ILSpy.Views; |
||||||
|
|
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Tests.Search; |
||||||
|
|
||||||
|
[TestFixture] |
||||||
|
public class SearchPaneViewTests |
||||||
|
{ |
||||||
|
[AvaloniaTest] |
||||||
|
public async Task SearchPane_Hosts_The_Required_Three_Controls_For_Search_Input_Mode_And_Results() |
||||||
|
{ |
||||||
|
// The pane's contract — used by every downstream commit in this series — is
|
||||||
|
// that the view exposes three named controls bound to the view-model: a TextBox
|
||||||
|
// for the query (SearchInput), a ComboBox for the mode picker (SearchModePicker),
|
||||||
|
// and a ListBox that renders incoming results (SearchResults).
|
||||||
|
|
||||||
|
var window = AppComposition.Current.GetExport<MainWindow>(); |
||||||
|
window.Show(); |
||||||
|
var pane = await window.WaitForComponent<SearchPane>(); |
||||||
|
|
||||||
|
var input = pane.FindControl<TextBox>("SearchInput"); |
||||||
|
((object?)input).Should().NotBeNull("the query TextBox is what the user types into"); |
||||||
|
|
||||||
|
var modePicker = pane.FindControl<ComboBox>("SearchModePicker"); |
||||||
|
((object?)modePicker).Should().NotBeNull("the mode picker drives which ILSpyX strategy runs"); |
||||||
|
modePicker!.ItemCount.Should().Be(12, |
||||||
|
"the picker must populate from SearchPaneModel.SearchModes — twelve entries"); |
||||||
|
|
||||||
|
var results = pane.FindControl<ListBox>("SearchResults"); |
||||||
|
((object?)results).Should().NotBeNull("the results list is the binding sink for the streaming orchestrator"); |
||||||
|
} |
||||||
|
|
||||||
|
[AvaloniaTest] |
||||||
|
public async Task Typing_Into_The_Search_Input_Writes_Through_To_SearchTerm() |
||||||
|
{ |
||||||
|
var window = AppComposition.Current.GetExport<MainWindow>(); |
||||||
|
window.Show(); |
||||||
|
var pane = await window.WaitForComponent<SearchPane>(); |
||||||
|
var vm = (SearchPaneModel)pane.DataContext!; |
||||||
|
|
||||||
|
var input = pane.FindControl<TextBox>("SearchInput"); |
||||||
|
input!.Text = "Enumerable"; |
||||||
|
|
||||||
|
vm.SearchTerm.Should().Be("Enumerable", |
||||||
|
"the TextBox is bound two-way to SearchPaneModel.SearchTerm"); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue