of data up to our last backup. In the previous subversion repository, this was r1694->r1777. I'm sorry to all those of you who might have checked out that code, as this will surely cause problems for you. We're currently working to figure out what went wrong, and how to prevent it in the future. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1695 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
106 lines
4.0 KiB
HTML
106 lines
4.0 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript"><!--
|
|
var popup;
|
|
|
|
function test_01_Popup_default_constructor(t) {
|
|
t.plan( 8 );
|
|
|
|
var size = new OpenLayers.Size(OpenLayers.Popup.WIDTH,
|
|
OpenLayers.Popup.HEIGHT);
|
|
popup = new OpenLayers.Popup();
|
|
|
|
t.ok( popup instanceof OpenLayers.Popup, "new OpenLayers.Popup returns Popup object" );
|
|
t.ok(popup.id.startsWith("OpenLayers.Popup"), "valid default popupid");
|
|
var firstID = popup.id;
|
|
t.ok(popup.size.equals(size), "good default popup.size");
|
|
t.eq(popup.contentHTML, "", "good default popup.contentHTML");
|
|
t.eq(popup.backgroundColor, OpenLayers.Popup.COLOR, "good default popup.backgroundColor");
|
|
t.eq(popup.opacity, OpenLayers.Popup.OPACITY, "good default popup.opacity");
|
|
t.eq(popup.border, OpenLayers.Popup.BORDER, "good default popup.border");
|
|
|
|
|
|
popup = new OpenLayers.Popup();
|
|
var newID = popup.id;
|
|
t.ok(newID != firstID, "default id generator creating unique ids");
|
|
}
|
|
|
|
function test_02_Popup_constructor (t) {
|
|
t.plan( 5 );
|
|
|
|
var id = "chicken";
|
|
var w = 500;
|
|
var h = 400;
|
|
var sz = new OpenLayers.Size(w,h);
|
|
var lon = 5;
|
|
var lat = 40;
|
|
var ll = new OpenLayers.LonLat(lon, lat);
|
|
var content = "foo";
|
|
|
|
popup = new OpenLayers.Popup(id,
|
|
ll,
|
|
sz,
|
|
content);
|
|
|
|
t.ok( popup instanceof OpenLayers.Popup, "new OpenLayers.Popup returns Popup object" );
|
|
t.eq(popup.id, id, "popup.id set correctly");
|
|
t.ok(popup.lonlat.equals(ll), "popup.lonlat set correctly");
|
|
t.ok(popup.size.equals(sz), "popup.size set correctly");
|
|
t.eq(popup.contentHTML, content, "contentHTML porpoerty of set correctly");
|
|
}
|
|
|
|
function test_03_Popup_draw(t) {
|
|
|
|
t.plan( 11 );
|
|
|
|
var id = "chicken";
|
|
var x = 50;
|
|
var y = 100;
|
|
var w = 500;
|
|
var h = 400;
|
|
var content = "charlie";
|
|
var color = "red";
|
|
var opacity = 0.5;
|
|
var border = "1px solid";
|
|
|
|
|
|
popup = new OpenLayers.Popup(id);
|
|
popup.setSize(new OpenLayers.Size(w, h));
|
|
popup.setContentHTML(content);
|
|
popup.setBackgroundColor(color);
|
|
popup.setOpacity(opacity);
|
|
popup.setBorder(border);
|
|
popup.draw(new OpenLayers.Pixel(x, y));
|
|
|
|
t.eq(popup.div.id, id, "popup.div.id set correctly");
|
|
t.eq(popup.div.style.left, x + "px", "left position of popup.div set correctly");
|
|
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
|
|
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
|
|
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
|
|
t.eq(popup.div.innerHTML, '<div class="olPopupContent" style="overflow: hidden; width: 200px; height: 200px; position: relative;" id="chicken_contentDiv">charlie</div>', "good default popup.contentHTML");
|
|
t.eq(popup.div.style.backgroundColor, color, "good default popup.backgroundColor");
|
|
|
|
if (navigator.appName.indexOf("Microsoft") == -1) {
|
|
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
|
|
} else {
|
|
t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity");
|
|
}
|
|
t.ok(popup.div.style.border.indexOf(border) != -1, "good default popup.border");
|
|
|
|
x += 50;
|
|
popup.moveTo(new OpenLayers.Pixel(x, y));
|
|
t.eq(popup.div.style.left, x + "px", "moveTo updates left position of popup.div correctly");
|
|
t.eq(popup.div.style.top, y + "px", "moveTo updates top position of popup.div correctly");
|
|
|
|
|
|
}
|
|
|
|
|
|
// -->
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|