File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2078,6 +2078,7 @@ class TextViewTests: XCTestCase {
20782078 XCTAssertEqual ( UIPasteboard . general. html ( ) , " <p><strong>bol</strong></p> " )
20792079 }
20802080
2081+ /// Check if pasting attributed text without color, the color is set to default color
20812082 func testPasteAttributedText( ) {
20822083 let sourceAttributedText = NSAttributedString ( string: " Hello world " )
20832084 var pasteItems = [ String: Any] ( )
@@ -2095,4 +2096,14 @@ class TextViewTests: XCTestCase {
20952096 XCTAssertEqual ( textView. text, " Hello world " )
20962097 }
20972098
2099+ /// Check that deleting all text resets the typying attributes to the default attributes
2100+ func testDeleteAllTextSetTypyingAttributesToDefault( ) {
2101+ let textView = TextViewStub ( withHTML: " <p style= \" color:0xFF0000 \" >Hello world</p> " )
2102+ textView. defaultTextColor = UIColor . green
2103+ textView. selectedRange = textView. attributedText!. rangeOfEntireString
2104+ textView. deleteBackward ( )
2105+ let attributes = textView. typingAttributes
2106+ XCTAssertEqual ( attributes [ . foregroundColor] as! UIColor , UIColor . green)
2107+ }
2108+
20982109}
You can’t perform that action at this time.
0 commit comments