~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/tests/StyleMap.html

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html> 
 
2
<head> 
 
3
    <script src="../lib/OpenLayers.js"></script> 
 
4
    <script type="text/javascript">
 
5
 
 
6
    function test_StyleMap_constructor(t) { 
 
7
        t.plan(6);
 
8
         
 
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"); 
 
14
 
 
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");
 
18
 
 
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");
 
22
        
 
23
        var style = {
 
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");
 
29
    }
 
30
    
 
31
    function test_StyleMap_destroy(t) {
 
32
        t.plan(2);
 
33
        var styleMap = new OpenLayers.StyleMap();
 
34
        t.ok(styleMap.styles["default"], "Got a default style after initialisation");
 
35
        styleMap.destroy();
 
36
        t.ok(!styleMap.styles, "StyleMap styles successfully destroyed");
 
37
    }
 
38
    
 
39
    </script> 
 
40
</head> 
 
41
<body> 
 
42
  <div id="map" style="width:500px;height:500px"></div>
 
43
</body> 
 
44
</html>