Skip to content

Commit 5f963fd

Browse files
Added tests for the composer input
1 parent da03b32 commit 5f963fd

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import SnapshotTesting
88
import XCTest
99

1010
class MessageComposerView_Tests: StreamChatTestCase {
11+
12+
override func setUp() {
13+
super.setUp()
14+
let utils = Utils(
15+
messageListConfig: MessageListConfig(becomesFirstResponderOnOpen: true)
16+
)
17+
streamChat = StreamChat(chatClient: chatClient, utils: utils)
18+
}
1119

1220
func test_messageComposerView_snapshot() {
1321
// Given
@@ -84,4 +92,33 @@ class MessageComposerView_Tests: StreamChatTestCase {
8492
// Then
8593
assertSnapshot(matching: view, as: .image)
8694
}
95+
96+
func test_composerInputView_inputTextView() {
97+
// Given
98+
let view = InputTextView(
99+
frame: .init(x: 16, y: 16, width: defaultScreenSize.width - 32, height: 50)
100+
)
101+
102+
// When
103+
view.text = "This is a sample text"
104+
view.selectedRange.location = 3
105+
106+
// Then
107+
assertSnapshot(matching: view, as: .image)
108+
}
109+
110+
func test_composerInputView_composerInputTextView() {
111+
// Given
112+
let view = ComposerTextInputView(
113+
text: .constant("This is a sample text"),
114+
height: .constant(38),
115+
selectedRangeLocation: .constant(3),
116+
placeholder: "Send a message",
117+
editable: true
118+
)
119+
.frame(width: defaultScreenSize.width, height: 50)
120+
121+
// Then
122+
assertSnapshot(matching: view, as: .image)
123+
}
87124
}
Loading
Loading

0 commit comments

Comments
 (0)