Skip to content

Commit 5694c9b

Browse files
committed
release v1.0.0
# Conflicts: # CHANGELOG.md # src/AngleSharp.Diffing.Tests/Core/HtmlDifferenceEngineTest.cs # src/AngleSharp.Diffing/Core/AttributeComparison.cs # src/AngleSharp.Diffing/Core/AttributeComparisonSource.cs # src/AngleSharp.Diffing/Core/CompareDecision.cs # src/AngleSharp.Diffing/Core/CompareResult.cs # src/AngleSharp.Diffing/Core/Comparison.cs # src/AngleSharp.Diffing/Core/ComparisonSource.cs # src/AngleSharp.Diffing/Core/HtmlDifferenceEngine.cs # src/AngleSharp.Diffing/Strategies/AttributeStrategies/OrderingStyleAttributeComparer.cs # src/AngleSharp.Diffing/Strategies/AttributeStrategies/StyleAttributeComparer.cs # src/Directory.Build.props
2 parents 7a0c5e1 + 1118b70 commit 5694c9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+271
-169
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.0.0
2+
3+
- Enabled using `diff:ignoreAttributes` and `diff:ignoreChildren` together on the same element.
4+
- Corrected list of attributes that is considered as boolean attributes. Removed `hidden`, added `inert`, `playsinline`, `shadowrootclonable`, `shadowrootdelegatesfocus`, and `shadowrootserializable`.
5+
- Upgrade to v1.x of AngleSharp.
6+
17
# 0.18.2
28

39
- Changed `CompareStrategy` such that it now can control the `IDiff` type that should be returned in case a difference is found in a comparison. This allows a comparer to embed additional context in the `IDiff` object. By [@SebastianStehle](https://github.com/SebastianStehle).

src/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,6 @@ dotnet_naming_style.fields_begin_with__.required_prefix = _
225225
dotnet_naming_style.fields_begin_with__.required_suffix =
226226
dotnet_naming_style.fields_begin_with__.word_separator =
227227
dotnet_naming_style.fields_begin_with__.capitalization = camel_case
228+
229+
# MA0012: Do not raise reserved exception type
230+
dotnet_diagnostic.MA0012.severity = none

src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<AssemblyName>AngleSharp.Diffing.Tests</AssemblyName>
77
<RootNamespace>AngleSharp.Diffing</RootNamespace>
@@ -10,18 +10,18 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
14-
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
14+
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="Shouldly" Version="4.1.0" />
19-
<PackageReference Include="xunit" Version="2.4.2" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
18+
<PackageReference Include="Shouldly" Version="4.2.1" />
19+
<PackageReference Include="xunit" Version="2.9.2" />
20+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="coverlet.collector" Version="3.2.0">
24+
<PackageReference Include="coverlet.collector" Version="6.0.2">
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2727
</PackageReference>

src/AngleSharp.Diffing.Tests/Core/AttributeComparisonTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void Test005()
6565
var test = ToAttributeComparisonSource(@"<br foo=""bar"">", "foo");
6666
var comparison = new AttributeComparison(control, test);
6767

68-
var (actualCtrlElm, actualTestElm) = comparison.GetAttributeElements();
68+
var (actualCtrlElm, actualTestElm) = comparison.AttributeElements;
6969

7070
actualCtrlElm.ShouldBe(control.ElementSource.Node);
7171
actualTestElm.ShouldBe(test.ElementSource.Node);
@@ -135,7 +135,7 @@ public void Test005()
135135
var test = ToAttributeComparisonSource(@"<br foo=""bar"">", "foo");
136136
var comparison = new AttributeComparison(control, test);
137137

138-
var (actualCtrlElm, actualTestElm) = comparison.GetAttributeElements();
138+
var (actualCtrlElm, actualTestElm) = comparison.AttributeElements;
139139

140140
actualCtrlElm.ShouldBe(control.ElementSource.Node);
141141
actualTestElm.ShouldBe(test.ElementSource.Node);

src/AngleSharp.Diffing.Tests/Core/DiffingEngineTestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace AngleSharp.Diffing.Core;
22

33
public abstract class DiffingEngineTestBase : DiffingTestBase
44
{
5-
public DiffingEngineTestBase(DiffingTestFixture fixture) : base(fixture)
5+
protected DiffingEngineTestBase(DiffingTestFixture fixture) : base(fixture)
66
{
77
}
88

@@ -24,7 +24,7 @@ protected static HtmlDiffer CreateHtmlDiffer(
2424
);
2525
}
2626

27-
private class MockDiffingStrategy : IDiffingStrategy
27+
private sealed class MockDiffingStrategy : IDiffingStrategy
2828
{
2929
private readonly Func<ComparisonSource, FilterDecision>? _nodeFilter;
3030
private readonly Func<AttributeComparisonSource, FilterDecision>? _attrFilter;

src/AngleSharp.Diffing.Tests/Core/HtmlDifferenceEngineTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private static IEnumerable<Comparison> NoneNodeMatcher(IDiffContext ctx, SourceC
451451
private static Func<IDiffContext, SourceCollection, SourceCollection, IEnumerable<Comparison>> SpecificIndexNodeMatcher(int index)
452452
=> (ctx, controlNodes, testNodes) =>
453453
{
454-
return new List<Comparison> { new Comparison(controlNodes[index], testNodes[index]) };
454+
return new List<Comparison> { new(controlNodes[index], testNodes[index]) };
455455
};
456456

457457
private static IEnumerable<Comparison> OneToOneNodeListMatcher(
@@ -477,7 +477,7 @@ private static Func<IDiffContext, SourceMap, SourceMap, IEnumerable<AttributeCom
477477
{
478478
return (ctx, ctrlAttrs, testAttrs) => new List<AttributeComparison>
479479
{
480-
new AttributeComparison(ctrlAttrs[matchAttrName], testAttrs[matchAttrName] )
480+
new(ctrlAttrs[matchAttrName], testAttrs[matchAttrName] )
481481
};
482482
}
483483

@@ -510,14 +510,14 @@ private static Func<AttributeComparisonSource, FilterDecision> SpecificAttrFilte
510510
#endregion
511511

512512
#region CustomDiff
513-
public record CustomNodeDiff : NodeDiff
513+
public sealed record CustomNodeDiff : NodeDiff
514514
{
515515
public CustomNodeDiff(in Comparison comparison) : base(comparison)
516516
{
517517
}
518518
}
519519

520-
public record CustomAttrDiff : AttrDiff
520+
public sealed record CustomAttrDiff : AttrDiff
521521
{
522522
public CustomAttrDiff(in AttributeComparison comparison) : base(comparison, AttrDiffKind.Unspecified)
523523
{

src/AngleSharp.Diffing.Tests/DiffBuilderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public void Test001()
2020
[Fact(DisplayName = "Builder throws if null is passed to control and test")]
2121
public void Test002()
2222
{
23-
Should.Throw<ArgumentNullException>(() => DiffBuilder.Compare(null!)).ParamName.ShouldBe(nameof(DiffBuilder.Control));
24-
Should.Throw<ArgumentNullException>(() => DiffBuilder.Compare("").WithTest(null!)).ParamName.ShouldBe(nameof(DiffBuilder.Test));
23+
Should.Throw<ArgumentNullException>(() => DiffBuilder.Compare(null!)).ParamName.ShouldBe("value");
24+
Should.Throw<ArgumentNullException>(() => DiffBuilder.Compare("").WithTest(null!)).ParamName.ShouldBe("value");
2525
}
2626

2727
[Fact(DisplayName = "Calling Build() with DefaultOptions() returns expected diffs")]

src/AngleSharp.Diffing.Tests/DiffingTestBase.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ public abstract class DiffingTestBase : IClassFixture<DiffingTestFixture>
44
{
55
private readonly DiffingTestFixture _testFixture;
66

7+
8+
public static readonly TheoryData<CompareResult> SameAndSkipCompareResult = new()
9+
{
10+
CompareResult.Same,
11+
CompareResult.Skip,
12+
};
13+
714
protected IDiffContext DummyContext { get; } = new DiffContext(default(IElement), default(IElement));
815

916
protected INodeList EmptyNodeList => ToNodeList("");
1017

11-
public DiffingTestBase(DiffingTestFixture fixture)
18+
protected DiffingTestBase(DiffingTestFixture fixture)
1219
{
1320
_testFixture = fixture;
1421
}
@@ -68,10 +75,4 @@ protected SourceMap ToSourceMap(string html, ComparisonSourceType sourceType = C
6875
var source = ToComparisonSource(html, sourceType);
6976
return new SourceMap(source);
7077
}
71-
72-
public static TheoryData<CompareResult> SameAndSkipCompareResult = new TheoryData<CompareResult>
73-
{
74-
CompareResult.Same,
75-
CompareResult.Skip,
76-
};
7778
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "Not relevant in tests.")]
9+
[assembly: SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "Not relevant in tests")]

src/AngleSharp.Diffing.Tests/Strategies/DiffingStrategyPipelineTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public DiffingStrategyPipelineTest(DiffingTestFixture fixture) : base(fixture)
66
{
77
}
88

9-
private FilterDecision NegateDecision(FilterDecision decision) => decision switch
9+
private static FilterDecision NegateDecision(FilterDecision decision) => decision switch
1010
{
1111
FilterDecision.Keep => FilterDecision.Exclude,
1212
FilterDecision.Exclude => FilterDecision.Keep,

0 commit comments

Comments
 (0)