-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Pull Request ## π€¨ Rationale Adds Blazor support for nimble-tooltip #309 ## π©βπ» Implementation Implemented Blazor support for tooltip states `default`, `fail`, `information`, `fail icon`, and `information icon`. Each tooltip is anchored to their own nimble-button in the example app. ## π§ͺ Testing Ran unit tests and the example app successfully. ## β Checklist - [X] I have updated the project documentation to reflect my changes or determined no changes are needed.
- Loading branch information
Showing
7 changed files
with
64 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
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-blazor-11eb6102-5ca6-444a-ab23-30353c9b14bb.json
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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Nimble Tooltip Blazor Integration (#309)", | ||
"packageName": "@ni/nimble-blazor", | ||
"email": "103057880+aidendk@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
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
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
2 changes: 2 additions & 0 deletions
2
packages/nimble-blazor/NimbleBlazor/Components/NimbleTooltip.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,2 @@ | ||
@namespace NimbleBlazor | ||
<nimble-tooltip anchor="@Anchor" delay="@Delay" @attributes="AdditionalAttributes">@ChildContent</nimble-tooltip> |
18 changes: 18 additions & 0 deletions
18
packages/nimble-blazor/NimbleBlazor/Components/NimbleTooltip.razor.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,18 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace NimbleBlazor; | ||
|
||
public partial class NimbleTooltip : ComponentBase | ||
{ | ||
[Parameter] | ||
public string? Anchor { get; set; } | ||
|
||
[Parameter] | ||
public int? Delay { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment? ChildContent { get; set; } | ||
|
||
[Parameter(CaptureUnmatchedValues = true)] | ||
public IDictionary<string, object>? AdditionalAttributes { get; set; } | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/nimble-blazor/Tests/NimbleBlazor.Tests/Unit/Components/NimbleTooltipTests.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,22 @@ | ||
using Bunit; | ||
using Xunit; | ||
|
||
namespace NimbleBlazor.Tests.Unit.Components; | ||
|
||
/// <summary> | ||
/// Tests for <see cref="NimbleTooltip"/>. | ||
/// </summary> | ||
public class NimbleTooltipTests | ||
{ | ||
[Fact] | ||
public void NimbleTooltip_Render_HasTooltipMarkup() | ||
{ | ||
var context = new TestContext(); | ||
context.JSInterop.Mode = JSRuntimeMode.Loose; | ||
var expectedMarkup = "nimble-tooltip"; | ||
|
||
var tooltip = context.RenderComponent<NimbleTooltip>(); | ||
|
||
Assert.Contains(expectedMarkup, tooltip.Markup); | ||
} | ||
} |