-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
643 additions
and
1,740 deletions.
There are no files selected for viewing
2,108 changes: 368 additions & 1,740 deletions
2,108
examples/Demo/Shared/Microsoft.Fast.Components.FluentUI.xml
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...Badge/FluentCounterBadgeTests.FluentCounterBadge_AppearanceAttribute-Accent.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">fluent-button<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
.../FluentCounterBadgeTests.FluentCounterBadge_AppearanceAttribute-Lightweight.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">fluent-button<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--neutral-layer-1); color: var(--neutral-fill-inverse-rest); border: 1px solid var(--accent-fill-rest);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...adge/FluentCounterBadgeTests.FluentCounterBadge_AppearanceAttribute-Neutral.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">fluent-button<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--neutral-foreground-rest); color: var(--neutral-fill-rest); border: 1px solid var(--neutral-foreground-rest);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...terBadge/FluentCounterBadgeTests.FluentCounterBadge_AttributesDefaultValues.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...FluentCounterBadgeTests.FluentCounterBadge_BackgroundColorAndColorAttribute.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...luentCounterBadgeTests.FluentCounterBadge_BackgroundColorErrorLuminanceDark.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--error); color: var(--neutral-fill-rest); border: 1px solid var(--error);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...ounterBadgeTests.FluentCounterBadge_BackgroundColorLightweightLuminanceDark.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--neutral-layer-1); color: var(--neutral-fill-rest); border: 1px solid var(--neutral-layer-1);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...unterBadgeTests.FluentCounterBadge_BackgroundColorLightweightLuminanceLight.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--neutral-layer-1); color: var(--neutral-fill-rest); border: 1px solid var(--neutral-layer-1);" title="1" b-ilbjzymg2o="">1</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...unterBadge/FluentCounterBadgeTests.FluentCounterBadge_ShowOverflowAttribute.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="10" b-ilbjzymg2o="">9+</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...e/CounterBadge/FluentCounterBadgeTests.FluentCounterBadge_ShowZeroAttribute.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="10" b-ilbjzymg2o="">10</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...nterBadge/FluentCounterBadgeTests.FluentCounterBadge_WithAdditionalCssClass.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="additional_class counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest);" title="10" b-ilbjzymg2o="">10</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...CounterBadge/FluentCounterBadgeTests.FluentCounterBadge_WithAdditionalStyle.verified.html
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,3 @@ | ||
|
||
<div class="counterbadge-container" b-ilbjzymg2o="">childcontent<div class="counterbadge" style="left: 50%; bottom: 50%; background-color: var(--accent-fill-rest); color: var(--neutral-fill-rest); border: 1px solid var(--accent-fill-rest); background-color: red;" title="10" b-ilbjzymg2o="">10</div> | ||
</div> |
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,239 @@ | ||
using Bunit; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
|
||
namespace Microsoft.Fast.Components.FluentUI.Tests.CounterBadge; | ||
|
||
public class FluentCounterBadgeTests : TestBase | ||
{ | ||
[Inject] | ||
public GlobalState GlobalState { get; set; } = default!; | ||
|
||
[Fact] | ||
public void FluentCounterBadge_AttributesDefaultValues() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Theory] | ||
[InlineData(Appearance.Accent)] | ||
[InlineData(Appearance.Lightweight)] | ||
[InlineData(Appearance.Neutral)] | ||
public void FluentCounterBadge_AppearanceAttribute(Appearance appearance) | ||
{ | ||
// Arrange && | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.Appearance, appearance); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("fluent-button"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(suffix: appearance.ToString()); | ||
} | ||
|
||
|
||
[Fact] | ||
public void FluentCounterBadge_WithAdditionalCssClass() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.Class, "additional_class"); | ||
parameters.Add(p => p.Count, 10); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_WithAdditionalStyle() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.Style, "background-color: red"); | ||
parameters.Add(p => p.Count, 10); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_ShowOverflowAttribute() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
|
||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.ShowOverflow, true); | ||
parameters.Add(p => p.Max, 9); | ||
parameters.Add(p => p.Count, 10); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorAndColorAttribute() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
IRenderedComponent<FluentCounterBadge>? cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Accent); | ||
parameters.Add(p => p.Color, Color.Fill); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorNullAndColorSet() | ||
{ | ||
// Arrange, Act && Assert | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
Assert.Throws<ArgumentException>(() => TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, null); | ||
parameters.Add(p => p.Color, Color.Fill); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
})); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorSetAndColorNull() | ||
{ | ||
// Arrange, Act && Assert | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
Assert.Throws<ArgumentException>(() => TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Accent); | ||
parameters.Add(p => p.Color, null); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
})); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorCustom() | ||
{ | ||
// Arrange, Act && Assert | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
Assert.Throws<ArgumentException>(() => TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Custom); | ||
parameters.Add(p => p.Color, Color.Custom); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
})); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_AppearanceOutline() | ||
{ | ||
// Arrange, Act && Assert | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
Assert.Throws<ArgumentException>(() => TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.Appearance, Appearance.Outline); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
})); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_ShowZeroAttribute() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.ShowZero, true); | ||
parameters.Add(p => p.Count, 10); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorLightweightLuminanceDark() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
|
||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Lightweight); | ||
parameters.Add(p => p.Color, Color.Fill); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorLightweightLuminanceLight() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
|
||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Lightweight); | ||
parameters.Add(p => p.Color, Color.Fill); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentCounterBadge_BackgroundColorErrorLuminanceDark() | ||
{ | ||
// Arrange && Act | ||
TestContext.Services.AddSingleton(new GlobalState()); | ||
|
||
var cut = TestContext.RenderComponent<FluentCounterBadge>(parameters => | ||
{ | ||
parameters.Add(p => p.BackgroundColor, Color.Error); | ||
parameters.Add(p => p.Color, Color.Fill); | ||
parameters.Add(p => p.Count, 1); | ||
parameters.AddChildContent("childcontent"); | ||
}); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
} |