Skip to content

Commit

Permalink
Fix failing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Apr 2, 2023
1 parent 6c80002 commit 7c19bac
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Tests/RichTextKitTests/RichTextViewRepresentableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class RichTextViewComponentTests: XCTestCase {
}


func testSettingUpWithAttributedTextWorks() {
let string = NSAttributedString(string: "foo bar baz")
func testSettingUpWithEmptyTextWorks() {
let string = NSAttributedString(string: "")
view.setup(with: string, format: .rtf)
XCTAssertEqual(view.richText.string, "foo bar baz")
XCTAssertEqual(view.richText.string, "")
#if os(iOS) || os(tvOS)
XCTAssertFalse(view.allowsEditingTextAttributes)
XCTAssertEqual(view.autocapitalizationType, .sentences)
Expand All @@ -55,5 +55,23 @@ class RichTextViewComponentTests: XCTestCase {
XCTAssertEqual(view.textColor, .textColor)
#endif
}

func testSettingUpWithNonEmptyTextWorks() {
let string = NSAttributedString(string: "foo bar baz")
view.setup(with: string, format: .rtf)
XCTAssertEqual(view.richText.string, "foo bar baz")
#if os(iOS) || os(tvOS)
XCTAssertFalse(view.allowsEditingTextAttributes)
XCTAssertEqual(view.autocapitalizationType, .sentences)
#endif
XCTAssertEqual(view.backgroundColor, .clear)
XCTAssertEqual(view.contentCompressionResistancePriority(for: .horizontal), .defaultLow)
#if os(iOS) || os(tvOS)
XCTAssertEqual(view.spellCheckingType, .no)
XCTAssertEqual(view.textColor, nil)
#elseif os(macOS)
XCTAssertEqual(view.textColor, nil)
#endif
}
}
#endif

0 comments on commit 7c19bac

Please sign in to comment.