@@ -11,56 +11,58 @@ define(['magnifier/magnify', 'mage/gallery/gallery', 'jquery'], function (Magnif
11
11
'use strict' ;
12
12
13
13
describe ( 'magnifier/magnify' , function ( ) {
14
- var gallery , options , magnify ;
14
+ var gallery , options ;
15
15
16
16
beforeEach ( function ( ) {
17
17
options = {
18
18
options : {
19
- " nav" : " thumbs" , " loop" :true , " keyboard" :true , " arrows" :true , " allowfullscreen" :true ,
20
- " showCaption" :false , " width" :700 , " thumbwidth" :88 , " thumbheight" :110 , " height" :700 ,
21
- " transitionduration" :500 , " transition" : " slide" , " navarrows" :true , " navtype" : " slides" ,
22
- " navdir" : " horizontal" , " whiteBorders" :1
19
+ ' nav' : ' thumbs' , ' loop' :true , ' keyboard' :true , ' arrows' :true , ' allowfullscreen' :true ,
20
+ ' showCaption' :false , ' width' :700 , ' thumbwidth' :88 , ' thumbheight' :110 , ' height' :700 ,
21
+ ' transitionduration' :500 , ' transition' : ' slide' , ' navarrows' :true , ' navtype' : ' slides' ,
22
+ ' navdir' : ' horizontal' , ' whiteBorders' :1
23
23
} ,
24
24
fullscreen : {
25
- " nav" : " thumbs" , " loop" :true , " navdir" : " horizontal" , " navarrows" :false , " navtype" : " slides" ,
26
- " arrows" :true , " showCaption" :false , " transitionduration" :500 , " transition" : " slide" , " whiteBorders" :1
25
+ ' nav' : ' thumbs' , ' loop' :true , ' navdir' : ' horizontal' , ' navarrows' :false , ' navtype' : ' slides' ,
26
+ ' arrows' :true , ' showCaption' :false , ' transitionduration' :500 , ' transition' : ' slide' , ' whiteBorders' :1
27
27
} ,
28
- breakpoints : { " mobile" : { " conditions" : { " max-width" : " 767px" } , " options" : { " options" : { " nav" : " dots" } } } } ,
28
+ breakpoints : { ' mobile' : { ' conditions' : { ' max-width' : ' 767px' } , ' options' : { ' options' : { ' nav' : ' dots' } } } } ,
29
29
data : [
30
30
{
31
- " thumb" : " dev/tests/acceptance/tests/_data/adobe-base.jpg" ,
32
- " img" : " dev/tests/acceptance/tests/_data/adobe-base.jpg" ,
33
- " full" : " dev/tests/acceptance/tests/_data/adobe-base.jpg" ,
34
- " caption" : " simple1" , " position" : "0" , " isMain" :false , " type" : " image" , " videoUrl" :null
31
+ ' thumb' : ' dev/tests/acceptance/tests/_data/adobe-base.jpg' ,
32
+ ' img' : ' dev/tests/acceptance/tests/_data/adobe-base.jpg' ,
33
+ ' full' : ' dev/tests/acceptance/tests/_data/adobe-base.jpg' ,
34
+ ' caption' : ' simple1' , ' position' : '0' , ' isMain' :false , ' type' : ' image' , ' videoUrl' :null
35
35
}
36
- ] ,
36
+ ] ,
37
37
magnifierOpts : {
38
- " fullscreenzoom" : "20" ,
39
- " top" : "" ,
40
- " left" : "" ,
41
- " width" : "" ,
42
- " height" : "" ,
43
- " eventType" : " hover" ,
44
- " enabled" :false ,
45
- " mode" : " outside"
38
+ ' fullscreenzoom' : '20' ,
39
+ ' top' : '' ,
40
+ ' left' : '' ,
41
+ ' width' : '' ,
42
+ ' height' : '' ,
43
+ ' eventType' : ' hover' ,
44
+ ' enabled' :false ,
45
+ ' mode' : ' outside'
46
46
}
47
47
} ;
48
48
} ) ;
49
49
50
50
describe ( 'test magnifierFullscreen method' , function ( ) {
51
51
it ( 'Check if the current image has event handlers set for tap and double tap' , function ( ) {
52
- let pageWrapperDiv = document . createElement ( 'div' ) ;
52
+ let pageWrapperDiv , productMediaDiv , mainDiv , img , activeImage , imageEvents ;
53
+
54
+ pageWrapperDiv = document . createElement ( 'div' ) ;
53
55
pageWrapperDiv . className = 'page-wrapper' ;
54
56
55
- let productMediaDiv = document . createElement ( 'div' ) ;
57
+ productMediaDiv = document . createElement ( 'div' ) ;
56
58
productMediaDiv . className = 'product media' ;
57
59
58
- let mainDiv = document . createElement ( 'div' ) ;
60
+ mainDiv = document . createElement ( 'div' ) ;
59
61
mainDiv . id = 'gallery_placeholder' ;
60
62
mainDiv . className = 'gallery-placeholder _block-content-loading' ;
61
63
mainDiv . setAttribute ( 'data-gallery-role' , 'gallery-placeholder' ) ;
62
64
63
- let img = document . createElement ( 'img' ) ;
65
+ img = document . createElement ( 'img' ) ;
64
66
img . alt = 'main product photo' ;
65
67
img . id = 'main_product_photo' ;
66
68
img . className = 'gallery-placeholder__image' ;
@@ -71,17 +73,16 @@ define(['magnifier/magnify', 'mage/gallery/gallery', 'jquery'], function (Magnif
71
73
productMediaDiv . appendChild ( mainDiv ) ;
72
74
document . body . appendChild ( pageWrapperDiv ) ;
73
75
74
- magnify = new Magnify ( options , $ ( '#gallery_placeholder' ) ) ;
76
+ new Magnify ( options , $ ( '#gallery_placeholder' ) ) ;
75
77
gallery = new Gallery ( options , $ ( '#gallery_placeholder' ) ) ;
76
78
77
- let activeImage = document . createElement ( 'img' ) ;
79
+ activeImage = document . createElement ( 'img' ) ;
78
80
activeImage . className = 'fotorama__img--full' ;
79
81
$ ( '[data-gallery-role="stage-shaft"] [data-active="true"]' ) . append ( activeImage ) ;
80
82
81
83
gallery . openFullScreen ( ) ;
82
84
83
- let imageEvents = $ . _data ( $ ( '.fotorama__img--full' ) [ 0 ] , "events" ) ;
84
-
85
+ imageEvents = $ . _data ( $ ( '.fotorama__img--full' ) [ 0 ] , 'events' ) ;
85
86
expect ( imageEvents ) . toBeInstanceOf ( Object ) ;
86
87
expect ( imageEvents . dblclick ) . toBeDefined ( ) ;
87
88
} ) ;
0 commit comments