Skip to content

Commit 726cded

Browse files
committed
Add Unit Test test for editor view too
1 parent f79be05 commit 726cded

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

AztecTests/EditorView/EditorViewTests.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,24 @@ class EditorViewTests: XCTestCase {
8080
XCTAssertEqual(editorView.editingMode, .richText)
8181
XCTAssertEqual(editorView.activeView, editorView.richTextView)
8282
}
83+
84+
func testHTMLStorageTextColor() {
85+
let font = UIFont.systemFont(ofSize: 14)
86+
let editorView = Aztec.EditorView(
87+
defaultFont: font,
88+
defaultHTMLFont: font,
89+
defaultParagraphStyle: ParagraphStyle(),
90+
defaultMissingImage: UIImage())
91+
92+
XCTAssertEqual(editorView.htmlStorage.textColor, HTMLStorage.Styles.defaultTextColor)
93+
94+
editorView.htmlStorage.textColor = .red
95+
editorView.richTextView.text = "Hello World"
96+
editorView.toggleEditingMode()
97+
98+
let textColor = editorView.htmlStorage.attribute(.foregroundColor, at: 3, effectiveRange: nil) as! UIColor
99+
100+
XCTAssertEqual(editorView.htmlStorage.textColor, UIColor.red)
101+
XCTAssertEqual(textColor, UIColor.red)
102+
}
83103
}

0 commit comments

Comments
 (0)