@@ -127,6 +127,10 @@ class AnimatedImageTests: XCTestCase {
127
127
func testAnimatedImageModifier( ) throws {
128
128
let expectation = self . expectation ( description: " WebImage modifier " )
129
129
let imageUrl = URL ( string: " https://assets.sbnation.com/assets/2512203/dogflops.gif " )
130
+ AnimatedImage . onViewDestroy { view, coordinator in
131
+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
132
+ XCTAssertEqual ( coordinator. userInfo ? [ " foo " ] as? String , " bar " )
133
+ }
130
134
let imageView = AnimatedImage ( url: imageUrl, options: [ . progressiveLoad] , context: [ . imageScaleFactor: 1 ] )
131
135
let introspectView = imageView
132
136
. onSuccess { _, _ in
@@ -137,6 +141,14 @@ class AnimatedImageTests: XCTestCase {
137
141
}
138
142
. onProgress { _, _ in
139
143
144
+ }
145
+ . onViewCreate { view, context in
146
+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
147
+ context. coordinator. userInfo = [ " foo " : " bar " ]
148
+ }
149
+ . onViewUpdate { view, context in
150
+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
151
+ XCTAssertEqual ( context. coordinator. userInfo ? [ " foo " ] as? String , " bar " )
140
152
}
141
153
. placeholder ( WebImage . emptyImage)
142
154
. indicator ( SDWebImageActivityIndicator . medium)
@@ -157,6 +169,7 @@ class AnimatedImageTests: XCTestCase {
157
169
_ = try introspectView. inspect ( AnimatedImage . self)
158
170
ViewHosting . host ( view: introspectView)
159
171
self . waitForExpectations ( timeout: 5 , handler: nil )
172
+ AnimatedImage . onViewDestroy ( )
160
173
}
161
174
162
175
// MARK: Helper
0 commit comments