mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Show a blank topic as removed. (#3706)
This commit is contained in:
@@ -80,4 +80,26 @@ class RoomStateEventStringBuilderTests: XCTestCase {
|
||||
memberIsYou: sender.id == userID)
|
||||
XCTAssertEqual(string, expectedString)
|
||||
}
|
||||
|
||||
func testTopicChanges() {
|
||||
let you = TimelineItemSender(id: userID, displayName: "Alice")
|
||||
let other = TimelineItemSender(id: "@bob:matrix.org", displayName: "Bob")
|
||||
|
||||
let newTopic = "New topic"
|
||||
var string = stringBuilder.buildString(for: .roomTopic(topic: newTopic), sender: you, isOutgoing: true)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicChangedByYou(newTopic))
|
||||
string = stringBuilder.buildString(for: .roomTopic(topic: newTopic), sender: other, isOutgoing: false)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicChanged(other.displayName ?? "", newTopic))
|
||||
|
||||
let emptyTopic = ""
|
||||
string = stringBuilder.buildString(for: .roomTopic(topic: emptyTopic), sender: you, isOutgoing: true)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicRemovedByYou)
|
||||
string = stringBuilder.buildString(for: .roomTopic(topic: emptyTopic), sender: other, isOutgoing: false)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicRemoved(other.displayName ?? ""))
|
||||
|
||||
string = stringBuilder.buildString(for: .roomTopic(topic: nil), sender: you, isOutgoing: true)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicRemovedByYou)
|
||||
string = stringBuilder.buildString(for: .roomTopic(topic: nil), sender: other, isOutgoing: false)
|
||||
XCTAssertEqual(string, L10n.stateEventRoomTopicRemoved(other.displayName ?? ""))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user