File tree Expand file tree Collapse file tree 3 files changed +11
-22
lines changed
app/code/Magento/PageBuilder/view/frontend
web/js/content-type/map/appearance/default
dev/tests/js/jasmine/tests/app/code/Magento/PageBuilder/view/frontend/web/js/content-type/map/appearance/default Expand file tree Collapse file tree 3 files changed +11
-22
lines changed Original file line number Diff line number Diff line change 50
50
<item name =" component" xsi : type =" string" >Magento_PageBuilder/js/widget/show-on-hover</item >
51
51
<item name =" config" xsi : type =" array" >
52
52
<item name =" buttonSelector" xsi : type =" string" >.pagebuilder-banner-button</item >
53
- <item name =" showOverlay" xsi : type =" string" >on_hover </item >
53
+ <item name =" showOverlay" xsi : type =" string" >hover </item >
54
54
<item name =" dataRole" xsi : type =" string" >banner</item >
55
55
</item >
56
56
</item >
Original file line number Diff line number Diff line change @@ -11,24 +11,24 @@ define([
11
11
return function ( config , element ) {
12
12
var locations ,
13
13
controls ,
14
- mapOptions = { } ,
15
- $element = $ ( element ) ;
14
+ mapOptions = { } ;
16
15
17
- /**
18
- * Sets height to 300px as default if no height input. But will not be saved to database
19
- */
20
- if ( $element . context . style . height === '' ) {
21
- $element . height ( '300px' ) ;
22
- }
16
+ if ( element . hasAttribute ( 'data-locations' ) ) {
17
+
18
+ /**
19
+ * Set map display to none if no locations
20
+ */
21
+ if ( element . getAttribute ( 'data-locations' ) === '[]' ) {
22
+ $ ( element ) . hide ( ) ;
23
23
24
- if ( element . hasAttribute ( 'data-locations' ) && element . getAttribute ( 'data-locations' ) !== '[]' ) {
24
+ return ;
25
+ }
25
26
locations = JSON . parse ( element . getAttribute ( 'data-locations' ) ) ;
26
27
locations . forEach ( function ( location ) {
27
28
location . position . latitude = parseFloat ( location . position . latitude ) ;
28
29
location . position . longitude = parseFloat ( location . position . longitude ) ;
29
30
} ) ;
30
31
controls = element . getAttribute ( 'data-show-controls' ) ;
31
- mapOptions . center = locations [ 0 ] . position ;
32
32
mapOptions . disableDefaultUI = controls !== 'true' ;
33
33
mapOptions . mapTypeControl = controls === 'true' ;
34
34
new GoogleMap ( element , locations , mapOptions ) ;
Original file line number Diff line number Diff line change @@ -23,13 +23,6 @@ define([
23
23
} ) ;
24
24
25
25
describe ( 'Magento_PageBuilder/js/content-type/map/appearance/default/widget' , function ( ) {
26
- it ( 'Sets element height to 300px if no height is set' , function ( ) {
27
- var el = document . createElement ( 'div' ) ;
28
-
29
- mapWidgetInitializer ( undefined , el ) ;
30
-
31
- expect ( el . style . height ) . toBe ( '300px' ) ;
32
- } ) ;
33
26
34
27
it ( 'Does not call googleMap constructor if element is missing data-locations' , function ( ) {
35
28
var el = document . createElement ( 'div' ) ;
@@ -52,10 +45,6 @@ define([
52
45
el ,
53
46
JSON . parse ( locationsJSON ) ,
54
47
{
55
- center : {
56
- latitude : 0 ,
57
- longitude : 0
58
- } ,
59
48
disableDefaultUI : false ,
60
49
mapTypeControl : true
61
50
}
You can’t perform that action at this time.
0 commit comments