Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions src/Code311.Tabler.Components/Data/DataComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Code311.Tabler.Components.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Code311.Ui.Core.Loading;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Code311.Tabler.Components.Feedback;
Expand Down
2 changes: 1 addition & 1 deletion src/Code311.Tabler.Components/Forms/FormTagHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
}

[HtmlTargetElement("cd311-select")]
public sealed class Cd311SelectTagHelper(ITablerSemanticClassMapper mapper) : TagHelper
public sealed class Cd311SelectTagHelper : TagHelper
{
public string? Field { get; set; }
public IReadOnlyCollection<Cd311OptionItem>? Options { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Code311.Tabler.Components/Forms/FormViewComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;

namespace Code311.Tabler.Components.Forms;

Expand Down
1 change: 1 addition & 0 deletions src/Code311.Tabler.Components/Layout/LayoutComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Code311.Tabler.Components.Layout;
Expand Down
1 change: 1 addition & 0 deletions src/Code311.Tabler.Components/Media/MediaComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Code311.Tabler.Components.Media;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Code311.Tabler.Components.Navigation;
Expand Down
1 change: 1 addition & 0 deletions src/Code311.Tabler.Dashboard/Kpi/KpiViewComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Code311.Tabler.Dashboard.Models;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;

namespace Code311.Tabler.Dashboard.Kpi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Code311.Ui.Abstractions.Semantics;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;

namespace Code311.Tabler.Dashboard.Layout;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Code311.Tabler.Dashboard.Models;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;

namespace Code311.Tabler.Dashboard.Panels;

Expand Down
3 changes: 3 additions & 0 deletions src/Code311.Tabler.Dashboard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Code311.Tests.Tabler.Dashboard")]
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public static IServiceCollection AddCode311TablerMvc(this IServiceCollection ser
}
}

internal sealed class ConfigureCode311MvcOptions(
IServiceProvider serviceProvider) : IConfigureOptions<MvcOptions>
internal sealed class ConfigureCode311MvcOptions : IConfigureOptions<MvcOptions>
{
public void Configure(MvcOptions options)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Code311.Tabler.Mvc/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Code311.Tests.Integration.Mvc")]
3 changes: 3 additions & 0 deletions src/Code311.Tabler.Razor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Code311.Tests.Integration.Razor")]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Code311.Ui.Core.Theming;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
Expand Down
4 changes: 2 additions & 2 deletions tests/Code311.Tests.Licensing/LicensingServicesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task FeatureGate_ShouldDeny_WhenFeatureMissing()
{
var services = new ServiceCollection()
.AddCode311Licensing(options => options.RequireValidLicenseAtStartup = false)
.AddCode311InMemoryLicenseSource(BuildLicense(features: ["dashboard.basic"]))
.AddCode311InMemoryLicenseSource(BuildLicense(features: new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "dashboard.basic" }))
.BuildServiceProvider();

var gate = services.GetRequiredService<ILicenseFeatureGate>();
Expand All @@ -85,7 +85,7 @@ public async Task FeatureGate_ShouldAllow_WhenFeaturePresent()
{
var services = new ServiceCollection()
.AddCode311Licensing(options => options.RequireValidLicenseAtStartup = false)
.AddCode311InMemoryLicenseSource(BuildLicense(features: ["dashboard.advanced"]))
.AddCode311InMemoryLicenseSource(BuildLicense(features: new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "dashboard.advanced" }))
.BuildServiceProvider();

var gate = services.GetRequiredService<ILicenseFeatureGate>();
Expand Down
14 changes: 7 additions & 7 deletions tests/Code311.Tests.Tabler.Components/ComponentRenderingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[Fact]
public void Cd311Input_ShouldRenderSemanticClasses()
{
var helper = new Cd311InputTagHelper(new TablerSemanticClassMapper)
var helper = new Cd311InputTagHelper(new TablerSemanticClassMapper())
{
Field = "Email",
Label = "Email",
Expand All @@ -46,7 +46,7 @@
[Fact]
public void Cd311Tabs_ShouldRenderItems()
{
var helper = new Cd311TabsTagHelper(new TablerSemanticClassMapper)
var helper = new Cd311TabsTagHelper(new TablerSemanticClassMapper())
{
Items =
[
Expand All @@ -66,7 +66,7 @@
[Fact]
public void Cd311Card_ShouldSetToneClass()
{
var helper = new Cd311CardTagHelper(new TablerSemanticClassMapper) { Tone = UiTone.Warning, Title = "Card" };
var helper = new Cd311CardTagHelper(new TablerSemanticClassMapper()) { Tone = UiTone.Warning, Title = "Card" };
var output = CreateOutput();

helper.Process(CreateContext(), output);
Expand All @@ -77,7 +77,7 @@
[Fact]
public void Cd311Progress_ShouldClampAndRenderBar()
{
var helper = new Cd311ProgressTagHelper(new TablerSemanticClassMapper) { Value = 150, Tone = UiTone.Success };
var helper = new Cd311ProgressTagHelper(new TablerSemanticClassMapper()) { Value = 150, Tone = UiTone.Success };
var output = CreateOutput();

helper.Process(CreateContext(), output);
Expand All @@ -90,7 +90,7 @@
[Fact]
public void Cd311Badge_ShouldRenderTone()
{
var helper = new Cd311BadgeTagHelper(new TablerSemanticClassMapper) { Tone = UiTone.Danger, Text = "Blocked" };
var helper = new Cd311BadgeTagHelper(new TablerSemanticClassMapper()) { Tone = UiTone.Danger, Text = "Blocked" };
var output = CreateOutput();

helper.Process(CreateContext(), output);
Expand All @@ -102,7 +102,7 @@
[Fact]
public void Cd311Avatar_ShouldFallbackToInitials()
{
var helper = new Cd311AvatarTagHelper(new TablerSemanticClassMapper) { Name = "Code Three" };
var helper = new Cd311AvatarTagHelper(new TablerSemanticClassMapper()) { Name = "Code Three" };
var output = CreateOutput();

helper.Process(CreateContext(), output);
Expand All @@ -128,7 +128,7 @@
Assert.Contains("active", overlayOutput.Attributes["class"].Value?.ToString());
var result = Assert.IsType<Microsoft.AspNetCore.Mvc.ViewComponents.HtmlContentViewComponentResult>(host.Invoke());
using var writer = new StringWriter();
result.Content.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);
result.HtmlContent.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);

Check failure on line 131 in tests/Code311.Tests.Tabler.Components/ComponentRenderingTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 131 in tests/Code311.Tests.Tabler.Components/ComponentRenderingTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)
Assert.Contains("Saved", writer.ToString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
var result = Assert.IsType<HtmlContentViewComponentResult>(component.Invoke(new DashboardPageModel("Sales", []), UiLayout.Grid));

using var writer = new StringWriter();
result.Content.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);
result.HtmlContent.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);

Check failure on line 47 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 47 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)
var html = writer.ToString();

Assert.Contains("cd311-dashboard-shell", html);
Expand All @@ -58,7 +58,7 @@
var result = Assert.IsType<HtmlContentViewComponentResult>(component.Invoke("KPIs", [new DashboardKpiItem("Users", "100", UiTone.Info, "+5%") ]));

using var writer = new StringWriter();
result.Content.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);
result.HtmlContent.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);

Check failure on line 61 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 61 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)
var html = writer.ToString();

Assert.Contains("text-info", html);
Expand All @@ -72,7 +72,7 @@
var result = Assert.IsType<HtmlContentViewComponentResult>(component.Invoke("Actions", [new DashboardQuickAction(new("Create"), UiTone.Accent)]));

using var writer = new StringWriter();
result.Content.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);
result.HtmlContent.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);

Check failure on line 75 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 75 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)
var html = writer.ToString();

Assert.Contains("btn-primary", html);
Expand All @@ -86,7 +86,7 @@
var result = Assert.IsType<HtmlContentViewComponentResult>(component.Invoke("Activity", [new DashboardActivityItem("Imported orders", DateTimeOffset.UtcNow, UiTone.Warning)]));

using var writer = new StringWriter();
result.Content.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);
result.HtmlContent.WriteTo(writer, System.Text.Encodings.Web.HtmlEncoder.Default);

Check failure on line 89 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 89 in tests/Code311.Tests.Tabler.Dashboard/DashboardCompositionTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test

'HtmlContentViewComponentResult' does not contain a definition for 'HtmlContent' and no accessible extension method 'HtmlContent' accepting a first argument of type 'HtmlContentViewComponentResult' could be found (are you missing a using directive or an assembly reference?)
var html = writer.ToString();

Assert.Contains("Imported orders", html);
Expand Down