adding some more tests

This commit is contained in:
Mike Adair
2012-06-22 13:05:18 -04:00
parent 5dc156995a
commit e7240062b3
2 changed files with 91 additions and 37 deletions

View File

@@ -155,12 +155,14 @@ ol.Popup.prototype.generateContent_ = function() {
return this.content_;
} else {
if ( goog.isDefAndNotNull(this.template_) &&
goog.isDefAndNotNull(this.anchor_) &&
(this.anchor_ instanceof ol.Feature)) {
//set content from feature attributes on the template
//TODO: this.setContent(template.apply(this.anchor.getAttributes()));
//TODO: this.setContent(template.apply(this.anchor_.getAttributes()));
return this.template_; //stub to return something
} else {
return '<br>';
ol.error('ol.Popup unabale to generate any content');
return '<p>no content</p>'
}
}
};
@@ -229,6 +231,12 @@ ol.Popup.prototype.setAnchorOffset_ = function() {
return;
}
if (!goog.isDefAndNotNull(this.anchor_)) {
//must have an anchor when trying to set the position
ol.error("ol.Popup must have an anchor to set the position");
return;
}
//position the element
if (this.anchor_ instanceof ol.Feature) {
this.pos_ = this.anchor_.getGeometry().getCentroid();