File tree 1 file changed +19
-2
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Wishlist/view/frontend/web/js
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 6
6
define ( [
7
7
'jquery' ,
8
8
'Magento_Wishlist/js/add-to-wishlist'
9
- ] , function ( $ ) {
9
+ ] , function ( $ , Widget ) {
10
10
'use strict' ;
11
11
12
12
describe ( 'Testing addToWishlist widget' , function ( ) {
13
- var wdContainer ;
13
+ var wdContainer ,
14
+ wishlistWidget ,
15
+ eventMock = {
16
+ preventDefault : jasmine . createSpy ( ) ,
17
+ stopPropagation : jasmine . createSpy ( )
18
+ } ;
14
19
15
20
beforeEach ( function ( ) {
16
21
wdContainer = $ ( '<input type="hidden" class="bundle-option-11 product bundle option" \n' +
17
22
'name="bundle_option[11]" value="15" aria-required="true"/>' ) ;
23
+ wishlistWidget = new Widget ( ) ;
24
+ $ . fn . validation = { } ;
18
25
} ) ;
19
26
20
27
afterEach ( function ( ) {
@@ -31,5 +38,15 @@ define([
31
38
} ) ;
32
39
expect ( wdContainer . addToWishlist ( 'option' , 'bundleInfo' ) ) . toBe ( 'test' ) ;
33
40
} ) ;
41
+
42
+ it ( 'verify update wichlist with validate product qty, valid qty' , function ( ) {
43
+ var validation = spyOn ( $ . fn , 'validation' ) . and . returnValue ( false ) ;
44
+
45
+ wishlistWidget . _validateWishlistQty ( eventMock ) ;
46
+ expect ( validation ) . toHaveBeenCalled ( ) ;
47
+ expect ( eventMock . preventDefault ) . toHaveBeenCalled ( ) ;
48
+ expect ( eventMock . stopPropagation ) . toHaveBeenCalled ( ) ;
49
+ } ) ;
50
+
34
51
} ) ;
35
52
} ) ;
You can’t perform that action at this time.
0 commit comments