3
<script src="../lib/OpenLayers.js"></script>
4
<script type="text/javascript">
6
function test_StyleMap_constructor(t) {
9
var options = {'foo': 'bar'};
10
var styleMap = new OpenLayers.StyleMap(null, options);
11
t.ok(styleMap instanceof OpenLayers.StyleMap,
12
"new OpenLayers.StyleMap returns object" );
13
t.eq(styleMap.foo, "bar", "constructor sets options correctly");
15
var style = new OpenLayers.Style();
16
var styleMap = new OpenLayers.StyleMap(style);
17
t.eq(styleMap.styles["default"].defaultStyle.strokeColor, style.defaultStyle.strokeColor, "default style set correctly from style object");
19
var style = {strokeColor: "blue"};
20
var styleMap = new OpenLayers.StyleMap(style);
21
t.eq(styleMap.styles["default"].defaultStyle.strokeColor, "blue", "default style set correctly from style hash");
24
"default": new OpenLayers.Style({strokeColor: "yellow"}),
25
"select": {strokeColor: "blue"}};
26
var styleMap = new OpenLayers.StyleMap(style);
27
t.eq(styleMap.styles["default"].defaultStyle.strokeColor, "yellow", "default style set correctly from a mixed hash of renderIntents");
28
t.eq(styleMap.styles["select"].defaultStyle.strokeColor, "blue", "select style set correctly from a mixed hash of renderIntents");
31
function test_StyleMap_destroy(t) {
33
var styleMap = new OpenLayers.StyleMap();
34
t.ok(styleMap.styles["default"], "Got a default style after initialisation");
36
t.ok(!styleMap.styles, "StyleMap styles successfully destroyed");
42
<div id="map" style="width:500px;height:500px"></div>