File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
dev/tests/js/jasmine/tests/lib/mage/gallery Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ define([
11
11
12
12
var gallery ,
13
13
options ,
14
- element ;
14
+ element ,
15
+ jqueryDataMock ,
16
+ originSpy ;
15
17
16
18
beforeEach ( function ( ) {
17
19
options = {
@@ -76,25 +78,25 @@ define([
76
78
' _block-content-loading" data-gallery-role="gallery-placeholder">' +
77
79
'<img alt="main product photo" class="gallery-placeholder__image" src="">' +
78
80
'</div>' ) ;
79
-
80
- spyOn ( $ . fn , 'data' ) . and . callFake ( function ( ) {
81
- return {
82
- setOptions : jasmine . createSpy ( ) . and . returnValue ( true ) ,
83
- updateOptions : jasmine . createSpy ( ) . and . returnValue ( true )
84
- } ;
85
- } ) ;
86
- expect ( ) ;
87
- gallery = new Gallery ( options , element ) ;
88
-
89
81
} ) ;
90
82
91
83
describe ( '"initGallery" method' , function ( ) {
92
84
it ( 'Verify gallery initialization' , function ( ) {
85
+ originSpy = $ . fn . data ;
86
+ jqueryDataMock = {
87
+ setOptions : jasmine . createSpy ( ) . and . returnValue ( true ) ,
88
+ updateOptions : jasmine . createSpy ( ) . and . returnValue ( true )
89
+ }
90
+ spyOn ( $ . fn , 'data' ) . and . callFake ( function ( ) { return jqueryDataMock } ) ;
91
+
92
+ gallery = new Gallery ( options , element ) ;
93
93
expect ( gallery . settings . $elementF . class ) . toBe ( element [ 1 ] ) ;
94
94
expect ( gallery . settings . fullscreenConfig ) . toBeDefined ( ) ;
95
95
expect ( gallery . settings . fotoramaApi ) . toBeDefined ( ) ;
96
96
expect ( gallery . settings . data ) . toBeDefined ( ) ;
97
97
expect ( gallery . settings . api ) . toBeDefined ( ) ;
98
+
99
+ $ . fn . data = originSpy ;
98
100
} ) ;
99
101
} ) ;
100
102
} ) ;
You can’t perform that action at this time.
0 commit comments