Skip to content

Commit

Permalink
Fix Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikBucher12 committed Jan 19, 2024
1 parent b54d0e4 commit cfcdba9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Tests/RichTextKitTests/RichTextContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ final class RichTextContextTests: XCTestCase {
let context = RichTextContext()
XCTAssertEqual(context.fontName, "")
XCTAssertEqual(context.fontSize, 16)
XCTAssertFalse(context.isBold)
XCTAssertFalse(context.isItalic)
XCTAssertFalse(context.isUnderlined)
XCTAssertFalse(context.hasStyle(.bold))
XCTAssertFalse(context.hasStyle(.italic))
XCTAssertFalse(context.hasStyle(.underlined))
XCTAssertFalse(context.hasStyle(.strikethrough))
XCTAssertFalse(context.isEditingText)
XCTAssertNil(context.highlightedRange)
XCTAssertEqual(context.selectedRange.location, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,29 @@ final class RichTextCoordinator_SubscriptionsTests: XCTestCase {

func testIsBoldUpdatesTextView() {
XCTAssertFalse(textView.richTextStyles.hasStyle(.bold))
textContext.isBold = true
textContext.userActionPublisher.send(.changeStyle(.bold, true))
XCTAssertTrue(textView.richTextStyles.hasStyle(.bold))
}


func testIsItalicUpdatesTextView() {
XCTAssertFalse(textView.richTextStyles.hasStyle(.italic))
textContext.isItalic = true
textContext.userActionPublisher.send(.changeStyle(.italic, true))
XCTAssertTrue(textView.richTextStyles.hasStyle(.italic))
}


func testIsUnderlinedUpdatesTextView() {
XCTAssertFalse(textView.richTextStyles.hasStyle(.underlined))
textContext.isUnderlined = true
textContext.userActionPublisher.send(.changeStyle(.underlined, true))
XCTAssertTrue(textView.richTextStyles.hasStyle(.underlined))
}


func testIsStrikeThroughUpdatesTextView() {
XCTAssertFalse(textView.richTextStyles.hasStyle(.strikethrough))
textContext.userActionPublisher.send(.changeStyle(.strikethrough, true))
XCTAssertTrue(textView.richTextStyles.hasStyle(.strikethrough))
}

func testSelectedRangeChangeUpdatesTextView() {
let range = NSRange(location: 4, length: 3)
Expand Down

0 comments on commit cfcdba9

Please sign in to comment.