Ticket #107: 107.2.patch
| File 107.2.patch, 3.3 kB (added by tschaub, 1 year ago) |
|---|
-
tests/lib/GeoExt/widgets/Popup.html
old new 11 11 12 12 function setupContext() { 13 13 14 var map = new OpenLayers.Map( );14 var map = new OpenLayers.Map({panMethod: null}); // avoid tween panning for tests 15 15 var layer = new OpenLayers.Layer("test", {isBaseLayer: true}); 16 16 map.addLayer(layer); 17 17 … … 70 70 pop.show(); 71 71 72 72 t.ok(Ext.getBody().child("div." + pop.popupCls),"viewport contains popup"); 73 73 74 74 tearDown(context); 75 75 } 76 76 77 77 function test_anchorPopup(t) { 78 t.plan( 4);78 t.plan(5); 79 79 80 80 var context = setupContext(); 81 81 82 82 var pop = popup(context.feature); 83 83 84 // show the popup and move the map to ensure popup is actually visible 84 85 pop.show(); 85 86 context.map.setCenter(new OpenLayers.LonLat(5, 45)); 87 88 var moves = 0; 86 89 pop.on({ 87 'move' : function(c,x,y){88 t.ok(true,"Move event fired on " + action); //should happen twice, on call to position()90 move: function() { 91 ++moves; 89 92 }, 90 93 scope : this 91 94 }); 92 95 93 96 t.ok(pop.getAnchorElement(), "Popup has anchor element"); 94 97 95 var action = "map move"; 96 context.map.events.triggerEvent("move"); 97 98 action = "popup collapse"; 98 // move the map and confirm that popup moves 99 context.map.setCenter(new OpenLayers.LonLat(6, 45)); 100 t.eq(moves, 1, "anchored popup moves once on map.setCenter"); 101 moves = 0; 102 103 // anchored popup needs to reposition on collapse, resize and 104 // expand to keep the anchor point on the feature 105 106 // collapse popup and and confirm that it moves 99 107 pop.collapse(); 108 t.eq(moves, 1, "anchored popup moves once on collapse"); 109 moves = 0; 100 110 101 action = "popup expand"111 // expand popup and confirm that it moves 102 112 pop.expand(); 113 t.eq(moves, 1, "anchored popup moves once on expand"); 114 moves = 0; 103 115 116 // resize popup and confirm that it moves 117 pop.setSize(100, 100); 118 t.eq(moves, 1, "anchored popup moves once on resize"); 119 moves = 0; 120 104 121 tearDown(context); 105 122 } 106 123 … … 113 130 var pop = popup(context.feature, context.mapPanel); 114 131 115 132 pop.show(); 116 133 117 134 pop.collapse(); 118 135 119 136 var origPos = pop.getPosition(); -
lib/GeoExt/widgets/Popup.js
old new 170 170 GeoExt.Popup.superclass.show.apply(this, arguments); 171 171 if(this.anchored) { 172 172 this.position(); 173 if(this.panIn && !this._map move) {173 if(this.panIn && !this._mapMove) { 174 174 this.panIntoView(); 175 175 } 176 176 }