summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Control/NavToolbar.html
blob: 9b3bbec144372b6f8390876e5010697c54978dc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
  <script src="../OLLoader.js"></script>
  <script type="text/javascript">
    var map; 
    function test_Control_NavToolbar_constructor (t) {
        t.plan( 4 );
        control = new OpenLayers.Control.NavToolbar();
        t.ok( control instanceof OpenLayers.Control.NavToolbar, "new OpenLayers.Control.NavToolbar returns object" );
        t.eq( control.displayClass,  "olControlNavToolbar", "displayClass is correct" );
        t.ok( control.controls[0] instanceof OpenLayers.Control.Navigation, "NavToolbar contains Control.Navigation object" );
        t.ok( control.controls[1] instanceof OpenLayers.Control.ZoomBox, "NavToolbar contains Control.ZoomBox object" );
    }
    function test_Control_NavToolbar_addControl (t) {
        t.plan( 6 );
        map = new OpenLayers.Map('map');
        control = new OpenLayers.Control.NavToolbar();
        t.ok( control instanceof OpenLayers.Control.NavToolbar, "new OpenLayers.Control.NavToolbar returns object" );
        t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
        map.addControl(control);
        t.ok( control.map === map, "Control.map is set to the map object" );
        t.ok( map.controls[4] === control, "map.controls contains control" );
        t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 7, "Control div zIndexed properly" );
        t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 7, "Viewport div contains control div" );
        // t.eq( control.div.style.top, "6px", "Control div top located correctly by default");

    }
    
    function test_Control_NavToolbar_defaultControl (t) {
        t.plan( 1 );
        var map = new OpenLayers.Map('map');

        var nav = new OpenLayers.Control.NavToolbar();
        map.addControl(nav);
        
        t.eq(nav.controls[0].active, true, "First control is active" );
        
        map.destroy();
    }
  </script>
</head>
<body>
    <div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>