Making it so the Map constructor doesn't fail when the provided viewport element isn't displayed. r=ahocevar (closes #2461)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10022 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-02-04 19:49:10 +00:00
parent 929e6b323c
commit 06d2b4229d
2 changed files with 44 additions and 21 deletions

View File

@@ -1360,10 +1360,31 @@
map.updateSize();
t.eq(moveToCnt, 1, "updateSize move the map if it has a center");
}
function test_invisible_map(t) {
/**
* This test confirms that initializing a map using an element that is
* not currently displayed doesn't cause any trouble.
*/
t.plan(1);
var map, msg = "initializing a map on an undisplayed element";
try {
map = new OpenLayers.Map("invisimap");
} catch (err) {
msg += ": " + err;
}
t.ok(!!map, msg);
if (map) {
map.destroy();
}
}
</script>
</head>
<body>
<div id="map" style="width: 600px; height: 300px;"/>
<div style="display: none;"><div id="invisimap"></div></div>
</body>
</html>