Skip to content

diff:ignoreChildren does not Ignore Children of a Button #43

@japhelps

Description

@japhelps

Bug Report

Prerequisites

  • [ X] Can you reproduce the problem in a MWE?
  • [ X] Are you running the latest version of AngleSharp? (0.18.2)
  • [ X] Did you check the FAQs to see if that helps you?
  • [ X] Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
  • [ X] Did you perform a search in the issues?

Description

Using diff:ignoreChildren does not ignore child elements or text of a button

Steps to Reproduce

The following test does not pass, but from what I understand of the documentation it should pass.

public class AngleSharpTests
{
    private readonly ITestOutputHelper output;

    public AngleSharpTests(ITestOutputHelper output)
    {
        this.output = output;
    }

    [Theory]
    [InlineData(@"<button id=""buttonid"" class=""somecss"">Not Ignored</button>")]
    [InlineData(@"<button id=""buttonid"" class=""somecss""><span>Not Ignored</span></button>")]
    public void GivenButton_MarkupMatches(string actual)
    {
        var control = @"<button diff:ignoreAttributes diff:ignoreChildren></button>";

        var diffs = DiffBuilder.Compare(control)
            .WithTest(actual)
            .Build();

        foreach (var diff in diffs)
            output.WriteLine(diff.ToString());

        Assert.False(diffs.Any());
    }
}

Expected behavior: The test should pass

Actual behavior: The test fails

Environment details: Windows 11, .NET 8

Possible Solution

The only way I have found to get the test to succeed is to change the button expected HTML to the following
<button diff:ignoreAttributes><span diff:ignoreChildren></span></button>

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions