-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autocomplete | Fix FreeTypingNotFoundTemplate not showing
- Loading branch information
1 parent
584be17
commit bd3c642
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
Tests/BasicTestApp.Client/Autocomplete_5038Component.razor
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,30 @@ | ||
<Autocomplete TItem="string" | ||
TValue="string" | ||
Data="@colors" | ||
Placeholder="Search..." | ||
Filter="AutocompleteFilter.StartsWith" | ||
FreeTyping | ||
TextField="@(( item ) => item)" | ||
ValueField="@(( item ) => item)"> | ||
<FreeTypingNotFoundTemplate> | ||
Add "@context" | ||
</FreeTypingNotFoundTemplate> | ||
</Autocomplete> | ||
|
||
@code { | ||
private List<string> colors = new List<string> | ||
{ | ||
"Red", | ||
"Orange", | ||
"Yellow", | ||
"Bright Green", | ||
"Dark Green", | ||
"Sky Blue", | ||
"Blue", | ||
"Purple", | ||
"Hot Pink", | ||
"Black", | ||
"White", | ||
"Gray" | ||
}; | ||
} |
35 changes: 35 additions & 0 deletions
35
Tests/Blazorise.E2E.Tests/Tests/Extensions/Autocomplete/Autocomplete_5038_Tests.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,35 @@ | ||
namespace Blazorise.E2E.Tests.Tests.Extensions.Autocomplete; | ||
|
||
[Parallelizable( ParallelScope.Self )] | ||
[TestFixture] | ||
public class Autocomplete_5038_Tests : BlazorisePageTest | ||
{ | ||
|
||
[SetUp] | ||
public async Task Init() | ||
{ | ||
await SelectTestComponent<Autocomplete_5038Component>(); | ||
} | ||
|
||
/// <summary> | ||
/// When a value is already set, setting a different value programmatically and then revisiting should have updated the Current Search Value and options shown. | ||
/// </summary> | ||
/// <returns></returns> | ||
[Test] | ||
public async Task Test() | ||
{ | ||
var sut = Page.Locator( ".b-is-autocomplete input[type=search]" ); | ||
var dropdownMenu = Page.Locator( ".dropdown-menu.show" ); | ||
|
||
await sut.ClickAsync(); | ||
await sut.FillAsync( "My Color" ); | ||
await sut.PressAsync( "Enter" ); | ||
await Expect( sut ).ToHaveValueAsync( "My Color" ); | ||
|
||
await dropdownMenu.WaitForAsync(); | ||
var option = ( await dropdownMenu.Locator( ".dropdown-item" ).AllAsync() ).Single(); | ||
|
||
await Expect( option ).ToHaveTextAsync( @"Add ""My Color""" ); | ||
} | ||
} | ||
|