@@ -182,7 +182,17 @@ test('#adapter.addClass adds a class to the root element', () => {
182
182
. hasClass ( 'test-class' ) ) ;
183
183
} ) ;
184
184
185
- test ( '#adapter.removeClass adds a class to the root element' , ( ) => {
185
+ test ( '#adapter.addClass does not add class if isMounted is false' , ( ) => {
186
+ const wrapper = mount ( < DivRipple /> ) ;
187
+ wrapper . instance ( ) . isMounted_ = false ;
188
+ wrapper . instance ( ) . foundation_ . adapter_ . addClass ( 'test-class' ) ;
189
+ assert . isFalse (
190
+ wrapper . update ( )
191
+ . find ( '.ripple-test-component' )
192
+ . hasClass ( 'test-class' ) ) ;
193
+ } ) ;
194
+
195
+ test ( '#adapter.removeClass removes a class to the root element' , ( ) => {
186
196
const wrapper = mount ( < DivRipple /> ) ;
187
197
wrapper . instance ( ) . foundation_ . adapter_ . addClass ( 'test-class' ) ;
188
198
@@ -195,12 +205,33 @@ test('#adapter.removeClass adds a class to the root element', () => {
195
205
. hasClass ( 'test-class' ) ) ;
196
206
} ) ;
197
207
208
+ test ( '#adapter.removeClass removes a class to the root element' , ( ) => {
209
+ const wrapper = mount ( < DivRipple /> ) ;
210
+ wrapper . instance ( ) . foundation_ . adapter_ . addClass ( 'test-class' ) ;
211
+
212
+ wrapper . instance ( ) . isMounted_ = false ;
213
+ wrapper . update ( ) ;
214
+ wrapper . instance ( ) . foundation_ . adapter_ . removeClass ( 'test-class' ) ;
215
+
216
+ assert . isTrue (
217
+ wrapper . update ( )
218
+ . find ( '.ripple-test-component' )
219
+ . hasClass ( 'test-class' ) ) ;
220
+ } ) ;
221
+
198
222
test ( '#adapter.updateCssVariable updates style' , ( ) => {
199
223
const wrapper = mount ( < DivRipple /> ) ;
200
224
wrapper . instance ( ) . foundation_ . adapter_ . updateCssVariable ( 'color' , 'blue' ) ;
201
225
assert . equal ( wrapper . state ( ) . style . color , 'blue' ) ;
202
226
} ) ;
203
227
228
+ test ( '#adapter.updateCssVariable does not update style if isMounted_ is false' , ( ) => {
229
+ const wrapper = mount ( < DivRipple /> ) ;
230
+ wrapper . instance ( ) . isMounted_ = false ;
231
+ wrapper . instance ( ) . foundation_ . adapter_ . updateCssVariable ( 'color' , 'blue' ) ;
232
+ assert . notEqual ( wrapper . state ( ) . style . color , 'blue' ) ;
233
+ } ) ;
234
+
204
235
test ( '#adapter.registerDocumentInteractionHandler triggers handler on document scroll' , ( ) => {
205
236
const wrapper = mount ( < DivRipple /> ) ;
206
237
const testHandler = td . func ( ) ;
0 commit comments