File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Sources/StreamChatSwiftUI/ChatChannel/Composer/Suggestions
StreamChatSwiftUITests/Tests/ChatChannel/Suggestions Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -115,14 +115,9 @@ public struct TypingSuggester {
115
115
return nil
116
116
}
117
117
118
- // Fetch the suggestion text. The suggestions can't have spaces.
119
- // valid example: "@luke_skywa..."
120
- // invalid example: "@luke skywa..."
118
+ // Fetch the suggestion text.
121
119
let suggestionLocation = NSRange ( location: suggestionStart, length: suggestionEnd - suggestionStart)
122
120
let suggestionText = textString. substring ( with: suggestionLocation)
123
- guard !suggestionText. contains ( " " ) else {
124
- return nil
125
- }
126
121
127
122
// A minimum number of characters can be provided to only show
128
123
// suggestions after the customer has input enough characters.
Original file line number Diff line number Diff line change @@ -62,12 +62,12 @@ class TypingSuggester_Tests: XCTestCase {
62
62
XCTAssert ( suggestion? . locationRange == NSRange ( location: 1 , length: 2 ) )
63
63
}
64
64
65
- func test_typingSuggester_notFoundEmptySpace ( ) {
65
+ func test_typingSuggester_emptySpaceAllowed ( ) {
66
66
// Given
67
67
let options = TypingSuggestionOptions ( symbol: " @ " )
68
68
let typingSuggester = TypingSuggester ( options: options)
69
- let string = " @M art "
70
- let caretLocation = 3
69
+ let string = " @Han Solo "
70
+ let caretLocation = 6
71
71
72
72
// When
73
73
let suggestion = typingSuggester. typingSuggestion (
@@ -76,7 +76,8 @@ class TypingSuggester_Tests: XCTestCase {
76
76
)
77
77
78
78
// Then
79
- XCTAssert ( suggestion == nil )
79
+ XCTAssertEqual ( " Han S " , suggestion? . text)
80
+ XCTAssertEqual ( NSRange ( location: 1 , length: 5 ) , suggestion? . locationRange)
80
81
}
81
82
82
83
func test_typingSuggester_notFoundNotOnStart( ) {
You can’t perform that action at this time.
0 commit comments