[verified] feat: add configurable results length units
Build CutList image / build-and-push (push) Successful in 31s
Build CutList image / build-and-push (push) Successful in 31s
Default cut results to total-inch mixed fractions, allow switching to feet and inches, and separate part names from lengths visually.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CutList.Core\CutList.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
using CutList.Core.Formatting;
|
||||
using Xunit;
|
||||
|
||||
namespace CutList.Core.Tests;
|
||||
|
||||
public class ResultsLengthDisplayTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(150, "150\"")]
|
||||
[InlineData(150.375, "150-3/8\"")]
|
||||
public void FormatInches_uses_total_inches_without_converting_to_feet(double inches, string expected)
|
||||
{
|
||||
Assert.Equal(expected, ArchUnits.FormatInches(inches));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Results_markup_includes_unit_toggle_and_divider_between_part_and_length()
|
||||
{
|
||||
var sourcePath = Path.GetFullPath(
|
||||
Path.Combine(AppContext.BaseDirectory, "../../../../CutList.Web/Components/Pages/Jobs/Edit.razor"));
|
||||
var markup = File.ReadAllText(sourcePath);
|
||||
|
||||
Assert.Contains("FormatResultLength", markup);
|
||||
Assert.Contains("cut-part-badge-divider", markup);
|
||||
Assert.Contains("Show feet + inches", markup);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user