diff --git a/Tests/SwiftSoupTests/AttributeTest.swift b/Tests/SwiftSoupTests/AttributeTest.swift
index 591f53f..e6cf565 100644
--- a/Tests/SwiftSoupTests/AttributeTest.swift
+++ b/Tests/SwiftSoupTests/AttributeTest.swift
@@ -22,11 +22,29 @@ class AttributeTest: XCTestCase {
XCTAssertEqual(s + "=\"A" + s + "B\"", attr.html())
XCTAssertEqual(attr.html(), attr.toString())
}
+
+ func testRemoveCaseSensitive()throws {
+ let a: Attributes = Attributes()
+ try a.put("Tot", "a&p")
+ try a.put("tot", "one")
+ try a.put("Hello", "There")
+ try a.put("hello", "There")
+ try a.put("data-name", "Jsoup")
+
+ XCTAssertEqual(5, a.size());
+ try a.remove(key: "Tot");
+ try a.remove(key: "Hello");
+ XCTAssertEqual(3, a.size());
+ XCTAssertTrue(a.hasKey(key: "tot"));
+ XCTAssertFalse(a.hasKey(key: "Tot"));
+ }
+
static var allTests = {
return [
("testHtml", testHtml),
- ("testWithSupplementaryCharacterInAttributeKeyAndValue", testWithSupplementaryCharacterInAttributeKeyAndValue)
+ ("testWithSupplementaryCharacterInAttributeKeyAndValue", testWithSupplementaryCharacterInAttributeKeyAndValue),
+ ("testRemoveCaseSensitive",testRemoveCaseSensitive)
]
}()
diff --git a/Tests/SwiftSoupTests/ElementTest.swift b/Tests/SwiftSoupTests/ElementTest.swift
index db104cb..8660917 100644
--- a/Tests/SwiftSoupTests/ElementTest.swift
+++ b/Tests/SwiftSoupTests/ElementTest.swift
@@ -927,6 +927,20 @@ class ElementTest: XCTestCase {
XCTAssertEqual(1, els.size())
XCTAssertEqual("html > body > fb|comments", try els.get(0).cssSelector())
}
+
+ func testChainedRemoveAttributes()throws {
+ let html = "Text"
+ let doc = try SwiftSoup.parse(html)
+ let a: Element = try doc.select("a").first()!
+ try a.removeAttr("zero")
+ .removeAttr("one")
+ .removeAttr("two")
+ .removeAttr("three")
+ .removeAttr("four")
+ .removeAttr("five");
+ XCTAssertEqual("Text", try a.outerHtml());
+ }
+
static var allTests = {
return [
@@ -998,7 +1012,8 @@ class ElementTest: XCTestCase {
("testRelativeUrls", testRelativeUrls),
("testAppendMustCorrectlyMoveChildrenInsideOneParentElement", testAppendMustCorrectlyMoveChildrenInsideOneParentElement),
("testHashcodeIsStableWithContentChanges", testHashcodeIsStableWithContentChanges),
- ("testNamespacedElements", testNamespacedElements)
+ ("testNamespacedElements", testNamespacedElements),
+ ("testChainedRemoveAttributes",testChainedRemoveAttributes)
]
}()
}