OpenLayers OpenLayers

Changeset 2855

Show
Ignore:
Timestamp:
03/22/07 14:50:35 (2 years ago)
Author:
tschaub
Message:

eleven new tests for default, custom, and no map theme

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/tests/test_Map.html

    r2836 r2855  
    318318 
    319319     
     320    function test_01_Map_defaultTheme(t) { 
     321        t.plan(5); 
     322         
     323        var head = document.getElementsByTagName('head')[0]; 
     324        var nodeCount = head.childNodes.length; 
     325         
     326        map = new OpenLayers.Map('map'); 
     327        var lastNode = head.childNodes[head.childNodes.length - 1]; 
     328 
     329        t.eq(nodeCount + 1, head.childNodes.length, "by default, a node is added to document head" ); 
     330        t.eq(lastNode.tagName, "LINK", "node added is a link element"); 
     331        t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); 
     332        t.eq(lastNode.type, "text/css", "node added has type set to text/css"); 
     333        t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); 
     334    } 
     335    function test_01_Map_customTheme(t) { 
     336        t.plan(5); 
     337         
     338        var head = document.getElementsByTagName('head')[0]; 
     339        var nodeCount = head.childNodes.length; 
     340         
     341        var options = {theme: 'foo'}; 
     342        map = new OpenLayers.Map('map', options); 
     343 
     344        var lastNode = head.childNodes[head.childNodes.length - 1]; 
     345 
     346        t.eq(nodeCount + 1, head.childNodes.length, "with custom theme, a node is added to document head" ); 
     347        t.eq(lastNode.tagName, "LINK", "node added is a link element"); 
     348        t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); 
     349        t.eq(lastNode.type, "text/css", "node added has type set to text/css"); 
     350        t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); 
     351    } 
     352    function test_01_Map_noTheme(t) { 
     353        t.plan(1); 
     354         
     355        var head = document.getElementsByTagName('head')[0]; 
     356        var nodeCount = head.childNodes.length; 
     357         
     358        var options = {theme: null}; 
     359        map = new OpenLayers.Map('map', options); 
     360 
     361        t.eq(nodeCount, head.childNodes.length, "with no theme, a node is not added to document head" ); 
     362    } 
     363 
    320364    function test_99_Map_destroy (t) { 
    321365        t.plan( 3 );