Skip to content

Commit

Permalink
Merge pull request openlayers#370 from pagameba/overviewmap
Browse files Browse the repository at this point in the history
OverviewMap custom div bug.
  • Loading branch information
pagameba committed Mar 30, 2012
2 parents e35dfe1 + 30af95d commit 943efd6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/OpenLayers/Control/OverviewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* minimize - {Boolean}
*/
showToggle: function(minimize) {
this.maximizeDiv.style.display = minimize ? '' : 'none';
this.minimizeDiv.style.display = minimize ? 'none' : '';
if (this.maximizeDiv) {
this.maximizeDiv.style.display = minimize ? '' : 'none';
}
if (this.minimizeDiv) {
this.minimizeDiv.style.display = minimize ? 'none' : '';
}
},

/**
Expand Down
31 changes: 31 additions & 0 deletions tests/Control/OverviewMap.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,37 @@

map.destroy();
}

function test_custom_div(t) {
t.plan(3);
var div = document.createElement('div');

control = new OpenLayers.Control.OverviewMap({
div: div
});

map = new OpenLayers.Map('map', {
layers : [new OpenLayers.Layer("layer", {isBaseLayer: true})],
controls: [control]
});

t.eq(control.maximizeDiv, null,
"OverviewMap does not create maximize div");
t.eq(control.minimizeDiv, null,
"OverviewMap does not create minimize div");

var exc;
try {
control.maximizeControl();
control.minimizeControl();
} catch(e) {
exc = e;
}

t.eq(exc, undefined, 'maximize and minimize do not trigger an exception');

map.destroy();
}

</script>
</head>
Expand Down

0 comments on commit 943efd6

Please sign in to comment.