File tree Expand file tree Collapse file tree 3 files changed +38
-12
lines changed
Sources/StreamChatSwiftUI/ChatChannel/Composer
StreamChatSwiftUITests/Tests/ChatChannel
__Snapshots__/MessageComposerView_Tests Expand file tree Collapse file tree 3 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -147,23 +147,32 @@ struct QuotedMessageHeaderView: View {
147147
148148 @Binding var quotedMessage : ChatMessage ?
149149
150+ @State var showContent = false
151+
150152 var body : some View {
151153 ZStack {
152- Text ( L10n . Composer. Title. reply)
153- . font ( fonts. bodyBold)
154-
155- HStack {
156- Spacer ( )
157- Button ( action: {
158- withAnimation {
159- quotedMessage = nil
160- }
161- } , label: {
162- DiscardButtonView ( )
163- } )
154+ if showContent {
155+ Text ( L10n . Composer. Title. reply)
156+ . font ( fonts. bodyBold)
157+
158+ HStack {
159+ Spacer ( )
160+ Button ( action: {
161+ withAnimation {
162+ quotedMessage = nil
163+ }
164+ } , label: {
165+ DiscardButtonView ( )
166+ } )
167+ }
164168 }
165169 }
166170 . frame ( height: 32 )
171+ . onAppear ( ) {
172+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.25 ) {
173+ showContent = true
174+ }
175+ }
167176 }
168177}
169178
Original file line number Diff line number Diff line change @@ -167,4 +167,21 @@ class MessageComposerView_Tests: StreamChatTestCase {
167167 XCTAssert ( coordinator. textInput. selectedRangeLocation == 3 )
168168 XCTAssert ( coordinator. textInput. text == " New text " )
169169 }
170+
171+ func test_quotedMessageHeaderView_snapshot( ) {
172+ // Given
173+ let message = ChatMessage . mock (
174+ id: . unique,
175+ cid: . unique,
176+ text: " Quoted message " ,
177+ author: . mock( id: . unique)
178+ )
179+
180+ // When
181+ let view = QuotedMessageHeaderView ( quotedMessage: . constant( message) , showContent: true )
182+ . frame ( width: defaultScreenSize. width, height: 36 )
183+
184+ // Then
185+ assertSnapshot ( matching: view, as: . image)
186+ }
170187}
You can’t perform that action at this time.
0 commit comments