Ticket #1544: patch-1544-r7162-A0.diff
| File patch-1544-r7162-A0.diff, 3.5 kB (added by elemoine, 6 months ago) |
|---|
-
tests/Control/MousePosition.html
old new 3 3 <script src="../../lib/OpenLayers.js"></script> 4 4 <script type="text/javascript"> 5 5 var map, control; 6 function test_ Control_MousePosition_constructor(t) {6 function test_initialize (t) { 7 7 t.plan( 2 ); 8 8 9 9 control = new OpenLayers.Control.MousePosition(); 10 10 t.ok( control instanceof OpenLayers.Control.MousePosition, "new OpenLayers.Control returns object" ); 11 11 t.eq( control.displayClass, "olControlMousePosition", "displayClass is correct" ); 12 12 } 13 function test_ Control_MousePosition_redraw_noLayer_displayProjection(t) {13 function test_redraw_noLayer_displayProjection(t) { 14 14 t.plan(2); 15 15 control = new OpenLayers.Control.MousePosition({'displayProjection': new OpenLayers.Projection("WGS84")}); 16 16 map = new OpenLayers.Map('map'); … … 25 25 control.redraw({'xy': new OpenLayers.Pixel(12,12)}); 26 26 t.eq(control.div.innerHTML, "-175.78125, 85.78125", "innerHTML set correctly when triggered."); 27 27 } 28 function test_ MousePosition_destroy(t) {28 function test_destroy(t) { 29 29 t.plan(1); 30 30 31 31 var map = new OpenLayers.Map('map'); … … 38 38 t.eq(map.events.listeners.mousemove.length, listeners - 1, "mousemove event is unregistered"); 39 39 map.destroy(); 40 40 } 41 42 function test_MousePosition_addControl(t) { 41 function test_addControl(t) { 43 42 t.plan(4); 44 43 45 44 var map = new OpenLayers.Map('map'); … … 52 51 t.eq(parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Viewport div contains control div"); 53 52 map.destroy(); 54 53 } 55 56 function test_Control_MousePosition_redraw_noLayer_displayProjection(t) { 54 function test_redraw_noLayer_displayProjection(t) { 57 55 t.plan(3); 58 56 var control = new OpenLayers.Control.MousePosition(); 59 57 var map = new OpenLayers.Map('map'); … … 70 68 t.eq(control.div.innerHTML, "-175.78125, 85.78125", "innerHTML set correctly when triggered."); 71 69 map.destroy(); 72 70 } 71 function test_formatOutput(t) { 72 t.plan(1); 73 var control = new OpenLayers.Control.MousePosition({ 74 prefix: 'prefix', 75 suffix: 'suffix', 76 separator: 'separator', 77 numDigits: 3 78 }); 79 var lonlat = new OpenLayers.LonLat(0.75699, 0.37365); 80 var val = control.formatOutput(lonlat); 81 t.eq(val, 'prefix0.757separator0.374suffix', 'formatOutput correctly formats the mouse position output'); 82 } 73 83 </script> 74 84 </head> 75 85 <body> -
lib/OpenLayers/Control/MousePosition.js
old new 40 40 * APIProperty: numDigits 41 41 * {Integer} 42 42 */ 43 num digits: 5,43 numDigits: 5, 44 44 45 45 /** 46 46 * APIProperty: granularity … … 144 144 * lonLat - {<OpenLayers.LonLat>} Location to display 145 145 */ 146 146 formatOutput: function(lonLat) { 147 var digits = parseInt(this.num digits);147 var digits = parseInt(this.numDigits); 148 148 var newHtml = 149 149 this.prefix + 150 150 lonLat.lon.toFixed(digits) +
