Add support for the <strike> tag in the attributed string builder

This commit is contained in:
Stefan Ceriu
2026-08-21 15:02:16 +03:00
parent 70714dd7f7
commit c65147678a
2 changed files with 12 additions and 1 deletions
@@ -673,6 +673,17 @@ struct AttributedStringBuilderTests {
#expect(String(attributedString.characters) == "one two")
}
@Test
func strikethroughTags() throws {
var strikethrough = AttributedString("one")
strikethrough[AttributeScopes.UIKitAttributes.StrikethroughStyleAttribute.self] = .single
for tag in ["s", "del", "strike"] {
let attributedString = try #require(attributedStringBuilder.fromHTML("<\(tag)>one</\(tag)>"), "Could not build the attributed string")
#expect(attributedString == strikethrough, "<\(tag)> should render as a strikethrough")
}
}
@Test
func unorderedList() throws {
let htmlString = "<ul><li>1</li><li>2</li><li>3</li></ul>"