Skip to content

Commit 4214ec2

Browse files
authored
update packages (#57)
1 parent f80f082 commit 4214ec2

8 files changed

Lines changed: 47 additions & 44 deletions

File tree

src/MudBlazor.StaticInput.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
24+
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.9" />
2525
<PackageReference Include="MudBlazor" Version="8.*" />
2626
</ItemGroup>
2727

tests/StaticInput.UnitTests/Components/BaseComponentTest.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace StaticInput.UnitTests.Components
99
public abstract class BaseComponentTest : IClassFixture<ContextFixture>, IAsyncLifetime
1010
{
1111
public IPage Page { get; private set; } = null!;
12-
protected TestContext Context { get; private set; }
12+
protected BunitContext Context { get; private set; }
1313
private ContextFixture ContextFixture { get; set; }
1414

1515
protected BaseComponentTest(ContextFixture contextFixture)
@@ -26,11 +26,17 @@ public async Task InitializeAsync()
2626
Page = await ContextFixture.NewPageAsync().ConfigureAwait(false);
2727
}
2828

29-
public Task DisposeAsync()
29+
public async Task DisposeAsync()
3030
{
31-
Context.Dispose();
32-
33-
return Task.CompletedTask;
31+
try
32+
{
33+
if (Page != null)
34+
await Page.CloseAsync().ConfigureAwait(false);
35+
}
36+
finally
37+
{
38+
await Context.DisposeAsync();
39+
}
3440
}
3541
}
3642
}

tests/StaticInput.UnitTests/Components/ButtonTests.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ButtonTests(ContextFixture contextFixture) : BaseComponentTest(cont
1515
[Fact]
1616
public void MudStaticButton_Should_Render_Submit_Button()
1717
{
18-
var comp = Context.RenderComponent<MudStaticButton>();
18+
var comp = Context.Render<MudStaticButton>();
1919

2020
comp.Instance.HtmlTag.Should().Be("button");
2121

@@ -28,8 +28,7 @@ public void MudStaticButton_Should_Render_Submit_Button()
2828
[Fact]
2929
public void FormAction_Submit_Should_Render_Submit_Button()
3030
{
31-
var param = ComponentParameter.CreateParameter(nameof(MudStaticButton.FormAction), FormAction.Submit);
32-
var comp = Context.RenderComponent<MudStaticButton>(param);
31+
var comp = Context.Render<MudStaticButton>(parameters => parameters.Add(x => x.FormAction, FormAction.Submit));
3332

3433
comp.Instance.HtmlTag.Should().Be("button");
3534

@@ -42,8 +41,7 @@ public void FormAction_Submit_Should_Render_Submit_Button()
4241
[Fact]
4342
public void FormAction_Reset_Should_Render_Reset_Button()
4443
{
45-
var param = ComponentParameter.CreateParameter(nameof(MudStaticButton.FormAction), FormAction.Reset);
46-
var comp = Context.RenderComponent<MudStaticButton>(param);
44+
var comp = Context.Render<MudStaticButton>(parameters => parameters.Add(x => x.FormAction, FormAction.Reset));
4745

4846
comp.Instance.HtmlTag.Should().Be("button");
4947

@@ -56,8 +54,7 @@ public void FormAction_Reset_Should_Render_Reset_Button()
5654
[Fact]
5755
public void FormAction_Post_Should_Render_Submit_Button_Within_Form()
5856
{
59-
var param = ComponentParameter.CreateParameter(nameof(MudStaticButton.FormAction), FormAction.Post);
60-
var comp = Context.RenderComponent<MudStaticButton>(param);
57+
var comp = Context.Render<MudStaticButton>(parameters => parameters.Add(x => x.FormAction, FormAction.Post));
6158

6259
comp.Instance.HtmlTag.Should().Be("button");
6360

@@ -72,27 +69,27 @@ public void FormAction_Post_Should_Render_Submit_Button_Within_Form()
7269
[Fact]
7370
public void SubmitButton_Should_Not_Submit_Invalid_Form()
7471
{
75-
var comp = Context.RenderComponent<ButtonSubmitTest>();
72+
var comp = Context.Render<ButtonSubmitTest>();
7673

7774
comp.Find("button").Click();
7875

7976
comp.Markup.Should().Contain("mud-input-error")
8077
.And.Contain("The Email field is required.");
8178

82-
var navigation = Context.Services.GetRequiredService<FakeNavigationManager>();
79+
var navigation = Context.Services.GetRequiredService<BunitNavigationManager>();
8380

8481
navigation.History.Should().HaveCount(0);
8582
}
8683

8784
[Fact]
8885
public void SubmitButton_Should_Submit_Valid_Form()
8986
{
90-
var comp = Context.RenderComponent<ButtonSubmitTest>();
87+
var comp = Context.Render<ButtonSubmitTest>();
9188

9289
comp.Find("input").Change("[email protected]");
9390
comp.Find("button").Click();
9491

95-
var navigation = Context.Services.GetRequiredService<FakeNavigationManager>();
92+
var navigation = Context.Services.GetRequiredService<BunitNavigationManager>();
9693

9794
navigation.History.Should().HaveCount(1);
9895
navigation.Uri.Should().Be("http://localhost/");

tests/StaticInput.UnitTests/Components/CheckBoxTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public partial class CheckBoxTests(ContextFixture contextFixture) : BaseComponen
1515
[Fact]
1616
public void MudStaticCheckBox_Should_Render_CheckBox()
1717
{
18-
var comp = Context.RenderComponent<MudStaticCheckBox>();
18+
var comp = Context.Render<MudStaticCheckBox>();
1919

2020
comp.Markup.Replace(" ", string.Empty).Should()
2121
.Contain("mud-checkbox")
@@ -26,7 +26,7 @@ public void MudStaticCheckBox_Should_Render_CheckBox()
2626
[Fact]
2727
public void CheckBox_Checked_Unchecked_Colors_Should_Differ()
2828
{
29-
var comp = Context.RenderComponent<CheckBoxColorsTest>();
29+
var comp = Context.Render<CheckBoxColorsTest>();
3030

3131
var boxes = comp.FindAll("svg");
3232
var selected = boxes.First(x => x.Id!.Contains("check-icon-"));

tests/StaticInput.UnitTests/Components/RadioTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class RadioTests(ContextFixture contextFixture) : BaseComponentTe
1414
[Fact]
1515
public void MudStaticRadioGroup_Should_Render_RadioGroup()
1616
{
17-
IRenderedComponent<MudStaticRadioGroup<string>> comp = Context.RenderComponent<MudStaticRadioGroup<string>>();
17+
var comp = Context.Render<MudStaticRadioGroup<string>>();
1818

1919
comp.Markup.Replace(" ", string.Empty).Should()
2020
.Contain("mud-radio-group")
@@ -24,7 +24,7 @@ public void MudStaticRadioGroup_Should_Render_RadioGroup()
2424
[Fact]
2525
public void MudStaticRadio_Should_Render_Radio()
2626
{
27-
IRenderedComponent<RadioSingleTest> comp = Context.RenderComponent<RadioSingleTest>();
27+
var comp = Context.Render<RadioSingleTest>();
2828

2929
comp.Markup.Replace(" ", string.Empty).Should()
3030
.Contain("mud-radio")
@@ -36,9 +36,9 @@ public void MudStaticRadio_Should_Render_Radio()
3636
[Fact]
3737
public void MudStaticRadio_Should_Have_Correct_Checked_State()
3838
{
39-
IRenderedComponent<RadioGroupTest> comp = Context.RenderComponent<RadioGroupTest>();
39+
var comp = Context.Render<RadioGroupTest>();
4040

41-
IRefreshableElementCollection<IElement> radios = comp.FindAll("input[type='radio']");
41+
var radios = comp.FindAll("input[type='radio']");
4242
IElement? radioA = radios.FirstOrDefault(r => r.GetAttribute("value") == "A");
4343
IElement? radioB = radios.FirstOrDefault(r => r.GetAttribute("value") == "B");
4444

@@ -52,9 +52,9 @@ public void MudStaticRadio_Should_Have_Correct_Checked_State()
5252
[Fact]
5353
public void MudStaticRadio_Icon_Should_Reflect_Checked_State()
5454
{
55-
IRenderedComponent<RadioGroupTest> comp = Context.RenderComponent<RadioGroupTest>();
55+
var comp = Context.Render<RadioGroupTest>();
5656

57-
IRefreshableElementCollection<IElement> radioInputs = comp.FindAll("input[type='radio']");
57+
var radioInputs = comp.FindAll("input[type='radio']");
5858
IElement radioA = radioInputs.First(r => r.GetAttribute("value") == "A");
5959
IElement radioB = radioInputs.First(r => r.GetAttribute("value") == "B");
6060

@@ -74,9 +74,9 @@ public void MudStaticRadio_Icon_Should_Reflect_Checked_State()
7474
[Fact]
7575
public void MudStaticRadio_Checked_Unchecked_Colors_Should_Differ()
7676
{
77-
var comp = Context.RenderComponent<RadioColorsTest>();
77+
var comp = Context.Render<RadioColorsTest>();
7878

79-
IRefreshableElementCollection<IElement> radioInputs = comp.FindAll("input[type='radio']");
79+
var radioInputs = comp.FindAll("input[type='radio']");
8080
IElement radioA = radioInputs.First(r => r.GetAttribute("value") == "A");
8181
IElement radioB = radioInputs.First(r => r.GetAttribute("value") == "B");
8282

tests/StaticInput.UnitTests/Components/SwitchTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public partial class SwitchTests(ContextFixture contextFixture) : BaseComponentT
1313
[Fact]
1414
public void MudStaticSwitch_Should_Render_Switch()
1515
{
16-
var comp = Context.RenderComponent<MudStaticSwitch>();
16+
var comp = Context.Render<MudStaticSwitch>();
1717

1818
comp.Markup.Replace(" ", string.Empty).Should()
1919
.Contain("mud-switch")
@@ -61,7 +61,7 @@ public async Task Switch_State_Changes_When_Clicked()
6161
[Fact]
6262
public void Switch_Should_Render_ThumbIcon()
6363
{
64-
var comp = Context.RenderComponent<SwitchToggleIconTest>();
64+
var comp = Context.Render<SwitchToggleIconTest>();
6565

6666
comp.Markup.Replace(" ", string.Empty).Should()
6767
.Contain("mud-switch")

tests/StaticInput.UnitTests/Components/TextFieldTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class TextFieldTests(ContextFixture contextFixture) : BaseComponentTest(c
1313
[Fact]
1414
public void MudStaticTextField_Should_Render_TextField()
1515
{
16-
var comp = Context.RenderComponent<MudStaticTextField<string>>();
16+
var comp = Context.Render<MudStaticTextField<string>>();
1717

1818
comp.Markup.Replace(" ", string.Empty).Should().Contain("mud-input-control")
1919
.And.Contain("mud-input-root");
@@ -22,7 +22,7 @@ public void MudStaticTextField_Should_Render_TextField()
2222
[Fact]
2323
public void TextField_Input_Should_Shink_Label()
2424
{
25-
var comp = Context.RenderComponent<TextFieldLabelTest>();
25+
var comp = Context.Render<TextFieldLabelTest>();
2626

2727
var field = comp.FindComponents<MudStaticTextField<string>>()
2828
.First(x => x.Instance.Label!.Equals("Basic Label", StringComparison.OrdinalIgnoreCase));
@@ -39,7 +39,7 @@ public void TextField_Input_Should_Shink_Label()
3939
[Fact]
4040
public void TextField_AdonrmentStart_Should_Shink_Label()
4141
{
42-
var comp = Context.RenderComponent<TextFieldLabelTest>();
42+
var comp = Context.Render<TextFieldLabelTest>();
4343

4444
var field = comp.FindComponents<MudStaticTextField<string>>()
4545
.First(x => x.Instance.Label!.Equals("Adornment Start", StringComparison.OrdinalIgnoreCase));
@@ -56,7 +56,7 @@ public void TextField_AdonrmentStart_Should_Shink_Label()
5656
[Fact]
5757
public void TextField_AdornmentEnd_Should_Not_Shink_Label()
5858
{
59-
var comp = Context.RenderComponent<TextFieldLabelTest>();
59+
var comp = Context.Render<TextFieldLabelTest>();
6060

6161
var field = comp.FindComponents<MudStaticTextField<string>>()
6262
.First(x => x.Instance.Label!.Equals("Adornment End", StringComparison.OrdinalIgnoreCase));
@@ -73,7 +73,7 @@ public void TextField_AdornmentEnd_Should_Not_Shink_Label()
7373
[Fact]
7474
public void TextField_Shrink_Label_Should_Shink_Label()
7575
{
76-
var comp = Context.RenderComponent<TextFieldLabelTest>();
76+
var comp = Context.Render<TextFieldLabelTest>();
7777

7878
var field = comp.FindComponents<MudStaticTextField<string>>()
7979
.First(x => x.Instance.Label!.Equals("Shrink Label", StringComparison.OrdinalIgnoreCase));
@@ -90,7 +90,7 @@ public void TextField_Shrink_Label_Should_Shink_Label()
9090
[Fact]
9191
public void TextField_Placeholder_Should_Shink_Label()
9292
{
93-
var comp = Context.RenderComponent<TextFieldLabelTest>();
93+
var comp = Context.Render<TextFieldLabelTest>();
9494

9595
var field = comp.FindComponents<MudStaticTextField<string>>()
9696
.First(x => x.Instance.Label!.Equals("Placeholder", StringComparison.OrdinalIgnoreCase));
@@ -187,7 +187,7 @@ public async Task TextField_DataAnnotations_Are_Functional()
187187
[Fact]
188188
public void TextField_Adornment_Should_Render_Without_Button()
189189
{
190-
var comp = Context.RenderComponent<TextFieldAdornmentTest>();
190+
var comp = Context.Render<TextFieldAdornmentTest>();
191191

192192
var field = comp.FindComponents<MudStaticTextField<string>>()
193193
.First(x => x.Instance.Label!.Equals("Email", StringComparison.OrdinalIgnoreCase));
@@ -198,7 +198,7 @@ public void TextField_Adornment_Should_Render_Without_Button()
198198
[Fact]
199199
public void TextField_With_AdornmentClickFunction_Should_Render_AdornmentButton()
200200
{
201-
var comp = Context.RenderComponent<TextFieldAdornmentTest>();
201+
var comp = Context.Render<TextFieldAdornmentTest>();
202202

203203
var field = comp.FindComponents<MudStaticTextField<string>>()
204204
.First(x => x.Instance.Label!.Equals("Password", StringComparison.OrdinalIgnoreCase));

tests/StaticInput.UnitTests/StaticInput.UnitTests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="bunit" Version="1.38.5" />
14-
<PackageReference Include="coverlet.collector" Version="6.0.3">
13+
<PackageReference Include="bunit" Version="2.5.3" />
14+
<PackageReference Include="coverlet.collector" Version="6.0.4">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="FluentAssertions" Version="7.1.0" />
19-
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
18+
<PackageReference Include="FluentAssertions" Version="8.8.0" />
19+
<PackageReference Include="GitHubActionsTestLogger" Version="3.0.1">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>
23-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
24-
<PackageReference Include="Microsoft.Playwright" Version="1.49.0" />
23+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
24+
<PackageReference Include="Microsoft.Playwright" Version="1.57.0" />
2525
<PackageReference Include="MudBlazor" Version="8.*" />
2626
<PackageReference Include="xunit" Version="2.9.3" />
27-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
27+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
2828
<PrivateAssets>all</PrivateAssets>
2929
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3030
</PackageReference>

0 commit comments

Comments
 (0)