Fill out more of Icon and Marker classes. In the XP world, supposedly we test first -- and I actually did in this case. Kind of a nifty trick: you work out what the function is supposed to do solely from the tests you want to write, and then you go and actually write the code that does it.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@87 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var marker;
|
||||
|
||||
function test_01_Marker_constructor (t) {
|
||||
t.plan( 5 );
|
||||
marker = new OpenLayers.Marker(new OpenLayers.Icon(),new OpenLayers.LatLon(1,2));
|
||||
t.ok( marker instanceof OpenLayers.Marker, "new OpenLayers.Marker returns Marker object" );
|
||||
t.ok( marker.icon instanceof OpenLayers.Icon, "new marker.Icon returns Icon object" );
|
||||
t.ok( marker.latlon instanceof OpenLayers.LatLon, "new marker.latlon returns LatLon object" );
|
||||
t.eq( marker.latlon.lat, 1, "marker.latlon.lat returns correct lat" );
|
||||
t.eq( marker.latlon.lon, 2, "marker.latlon.lon returns correct lon" );
|
||||
}
|
||||
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user