Ticket #107: 107.patch

File 107.patch, 2.3 kB (added by tschaub, 1 year ago)

don't tween during tests without a timeout

  • tests/lib/GeoExt/widgets/Popup.html

    old new  
    1111 
    1212        function setupContext() {         
    1313 
    14             var map = new OpenLayers.Map(); 
     14            var map = new OpenLayers.Map({panMethod: null}); // avoid tween panning for tests 
    1515            var layer = new OpenLayers.Layer("test", {isBaseLayer: true}); 
    1616            map.addLayer(layer); 
    1717 
     
    7070            pop.show(); 
    7171 
    7272            t.ok(Ext.getBody().child("div." + pop.popupCls),"viewport contains popup"); 
    73              
     73 
    7474            tearDown(context); 
    7575        } 
    7676 
    7777        function test_anchorPopup(t) { 
    78             t.plan(4); 
     78             
     79            // TODO: was t.plan(4), it looks to me like this was due to tweening 
     80            // if there really should only be one move, remove this comment 
     81            t.plan(2); 
    7982 
    8083            var context = setupContext(); 
    8184 
    8285            var pop = popup(context.feature); 
    8386 
    8487            pop.show(); 
     88             
     89            var moves = 0; 
    8590 
    8691            pop.on({ 
    8792                'move' : function(c,x,y){ 
    88                     t.ok(true,"Move event fired on " + action); //should happen twice, on call to position() 
     93                    ++moves; 
    8994                }, 
    9095                scope : this 
    9196            }); 
     
    9398            t.ok(pop.getAnchorElement(), "Popup has anchor element"); 
    9499 
    95100            var action = "map move"; 
    96             context.map.events.triggerEvent("move"); 
     101            context.map.setCenter(new OpenLayers.LonLat(6, 45)); 
     102            t.eq(moves, 1, "Move event fired on " + action); 
    97103             
     104             
     105            // TODO: do we really expect any move events here? 
     106            // if not, these lines are irrelevant  
    98107            action = "popup collapse"; 
    99108            pop.collapse(); 
    100109 
     110            // TODO: do we really expect any move events here? 
     111            // if not, these lines are irrelevant  
    101112            action = "popup expand" 
    102113            pop.expand(); 
    103114             
     
    113124            var pop = popup(context.feature, context.mapPanel); 
    114125 
    115126            pop.show(); 
    116          
     127 
    117128            pop.collapse(); 
    118129 
    119130            var origPos = pop.getPosition();