-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for Windows SearchBar MaxLength > 0 not working properly. (#24919)
* Fix Windows SearchBar MaxLength property * Fix issue * fix-5669-Fix for Windows SearchBar MaxLength > 0 not working properly. * fix-5669-Taking child for AutoSuggestBox code has been moved to SearchBarExtension.cs. * fix-5669-Removed unwanted parameter UpdateMaxLength(). * fix-5669-Changes committed for PublicAPI file. * fix-5669-Getting Child of TextBox using GetChildren() method instead of using FindChildOfType. * fix-5669-Optimized the code in the UpdateMaxLength() method. * fix-5669-Removed Child count check for AutoSuggestBox Control. * fix-5669-Updated the proper naming for the variable. * Fix-5669-Removed unwanted space. * fix-5669-Added missing namespace. * fix-5669-Fix for Windows SearchBar MaxLength > 0 not working properly. * fix-5669-Taking child for AutoSuggestBox code has been moved to SearchBarExtension.cs. * fix-5669-Removed unwanted parameter UpdateMaxLength(). * fix-5669-Changes committed for PublicAPI file. * fix-5669-Getting Child of TextBox using GetChildren() method instead of using FindChildOfType. * fix-5669-Optimized the code in the UpdateMaxLength() method. * fix-5669-Removed Child count check for AutoSuggestBox Control. * fix-5669-Updated the proper naming for the variable. * Fix-5669-Removed unwanted space. * fix-5669-Added missing namespace. * fix-5669-Added testcase images. * fix-5669-Updated testcase images. * fix-5669-Removed the Linq related codes. * fix-5669-Unwanted code removed. * fix-5669-Updated iOS testcase image. --------- Co-authored-by: Javier Suárez Ruiz <javiersuarezruiz@hotmail.com>
- Loading branch information
1 parent
ddb222c
commit 7f56f6c
Showing
7 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+28.4 KB
...Controls/tests/TestCases.Android.Tests/snapshots/android/SearchBarMaxLength.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
src/Controls/tests/TestCases.HostApp/Issues/Issue5669.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue5669"> | ||
<ContentPage.Content> | ||
<StackLayout> | ||
<SearchBar x:Name="searchbar" Text="Searchbar Control" MaxLength="3" AutomationId="SearchBar"/> | ||
<HorizontalStackLayout> | ||
<Label Text="MaxLength value is: "/> | ||
<Label Text="{Binding Source={x:Reference searchbar}, Path=MaxLength}"/> | ||
</HorizontalStackLayout> | ||
<Button AutomationId="ChangeValue" Text="Change Value" x:Name="button" Clicked="Button_Clicked"/> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
17 changes: 17 additions & 0 deletions
17
src/Controls/tests/TestCases.HostApp/Issues/Issue5669.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 5669, "Windows SearchBar MaxLength > 0 not working properly", PlatformAffected.UWP)] | ||
public partial class Issue5669 : ContentPage | ||
{ | ||
public Issue5669() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Button_Clicked(object sender, EventArgs e) | ||
{ | ||
searchbar.MaxLength = 4; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5669.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#if !MACCATALYST | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue5669: _IssuesUITest | ||
{ | ||
public override string Issue => "Windows SearchBar MaxLength > 0 not working properly"; | ||
public Issue5669(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
|
||
[Test] | ||
[Category(UITestCategories.SearchBar)] | ||
public void SearchBarMaxLength() | ||
{ | ||
App.WaitForElement("SearchBar"); | ||
App.EnterText("SearchBar", "r"); | ||
App.Click("ChangeValue"); | ||
App.EnterText("SearchBar", "r"); | ||
App.EnterText("SearchBar", "c"); | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} | ||
#endif |
Binary file added
BIN
+8.15 KB
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/SearchBarMaxLength.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+101 KB
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/SearchBarMaxLength.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters