From d6de04cdddebd69623fe00a52fac7c961083aeb5 Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 31 Aug 2007 15:15:07 +0000 Subject: [PATCH] rollback added semicolons from r4151. no ; after a regular function declaration. also some small coding standards whitespace. git-svn-id: http://svn.openlayers.org/trunk/openlayers@4157 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/test_Map.html | 40 ++++++++++++------------- tests/test_Marker.html | 8 ++--- tests/test_Popup.html | 6 ++-- tests/test_Renderer.html | 4 +-- tests/test_Util.html | 65 +++++++++++++++++++++------------------- 5 files changed, 63 insertions(+), 60 deletions(-) diff --git a/tests/test_Map.html b/tests/test_Map.html index a97d04a0e6..9e1d6c05c6 100644 --- a/tests/test_Map.html +++ b/tests/test_Map.html @@ -30,7 +30,7 @@ t.ok( map.events instanceof OpenLayers.Events, "map.events is an OpenLayers.Events" ); t.ok( map.getMaxExtent() instanceof OpenLayers.Bounds, "map.maxExtent is an OpenLayers.Bounds" ); t.ok( map.getNumZoomLevels() > 0, "map has a default numZoomLevels" ); - }; + } function test_02_Map_center(t) { t.plan(3); @@ -44,7 +44,7 @@ t.ok( map.getCenter() instanceof OpenLayers.LonLat, "map.getCenter returns a LonLat"); t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter"); t.ok( map.getCenter().equals(ll), "map center is correct after calling setCenter"); - }; + } function test_03_Map_add_layers(t) { t.plan(6); @@ -64,7 +64,7 @@ "layer1 zIndex is set" ); t.eq( parseInt(layer2.div.style.zIndex), map.Z_INDEX_BASE['BaseLayer'] + 5, "layer2 zIndex is set" ); - }; + } function test_04_Map_options(t) { t.plan(3); @@ -72,7 +72,7 @@ t.eq( map.numZoomLevels, 6, "map.numZoomLevels set correctly via options hashtable" ); t.eq( map.maxResolution, 3.14159, "map.maxResolution set correctly via options hashtable" ); t.eq( map.theme, 'foo', "map theme set correctly." ); - }; + } function test_05_Map_center(t) { t.plan(4); @@ -100,7 +100,7 @@ t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" ); */ - }; + } function test_06_Map_zoomend_event (t) { t.plan(2); @@ -117,7 +117,7 @@ map.setCenter(new OpenLayers.LonLat(2, 1), 0); map.zoomIn(); map.zoomOut(); - }; + } function test_07_Map_add_remove_popup (t) { t.plan(4); @@ -195,7 +195,7 @@ t.ok( newPixel instanceof OpenLayers.Pixel, "getPixelFromLonLat returns valid OpenLayers.Pixel" ); t.ok( newPixel.equals(pixel), "2nd translation to pixel and back to lonlat is consistent"); - }; + } */ function test_09_Map_isValidLonLat(t) { @@ -211,7 +211,7 @@ t.ok( !map.isValidLonLat(null), "null lonlat is not valid" ); t.ok( map.isValidLonLat(new OpenLayers.LonLat(33862, 717606)), "lonlat outside max extent is valid" ); t.ok( !map.isValidLonLat(new OpenLayers.LonLat(10, 10)), "lonlat outside max extent is not valid" ); - }; + } function test_10_Map_getLayer(t) { t.plan( 2 ); @@ -230,7 +230,7 @@ gotLayer = map.getLayer("chicken"); t.ok( gotLayer == null, "getLayer correctly returns null when layer not found"); - }; + } function test_11_Map_double_addLayer(t) { t.plan( 1 ); @@ -245,7 +245,7 @@ t.eq( map.layers.length, 1, "Map does not allow double adding of layers." ); - }; + } function test_12_Map_setBaseLayer(t) { t.plan( 4 ); @@ -274,7 +274,7 @@ map.setBaseLayer(wmslayer2); t.ok(map.baseLayer == wmslayer2, "setbaselayer correctly sets 'baseLayer' property"); - }; + } function test_13_Map_setBaseLayer_after_pan (t) { t.plan(1); @@ -293,7 +293,7 @@ map.pan(0, -200); map.setBaseLayer(wmsLayer); t.eq(map.layerContainerDiv.style.top, "0px", "layerContainer is recentered after setBaseLayer"); - }; + } function test_14_Map_moveLayer (t) { t.plan(10); @@ -333,7 +333,7 @@ "layer div has the right zIndex after moving up" ); t.eq( map.getLayerIndex(wmslayer3), 0, "top layer is now on the bottom" ); t.eq( ct, 3, "raiseLayer triggered changelayer the right # of times" ); - }; + } function test_15_Map_setCenter(t) { t.plan(1); @@ -347,7 +347,7 @@ var ll = new OpenLayers.LonLat(-100,-150); map.setCenter(ll, 0); t.ok(map.getCenter().equals(new OpenLayers.LonLat(0,0)), "safely sets out-of-bounds lonlat"); - }; + } function test_16_Map_defaultTheme(t) { t.plan(5); @@ -371,7 +371,7 @@ map = new OpenLayers.Map('map'); t.eq(links.length, document.getElementsByTagName('link').length, "calling the map constructor twice with the same theme doesn't add duplicate link nodes"); - }; + } function test_17_Map_customTheme(t) { t.plan(5); @@ -395,7 +395,7 @@ t.ok(themeNode != null, "a link node with the theme href was added"); t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet"); t.eq(themeNode.type, "text/css", "node added has type set to text/css"); - }; + } function test_18_Map_noTheme(t) { t.plan(1); @@ -407,7 +407,7 @@ map = new OpenLayers.Map('map', options); t.eq(nodeCount, head.childNodes.length, "with no theme, a node is not added to document head" ); - }; + } function test_19_Map_getControl(t) { t.plan(2); @@ -422,7 +422,7 @@ gotControl = map1.getControl("bogus id"); t.ok(gotControl == null, "getControl() for bad id returns null"); - }; + } function test_19_Map_removeControl(t) { t.plan(6); @@ -470,7 +470,7 @@ map1.removeControl(control); newNumControls = map1.controls.length; t.ok( newNumControls == oldNumControls, "removing bad controlid doesnt crash or decrease control count") - }; + } function test_99_Map_destroy (t) { t.plan( 3 ); @@ -479,7 +479,7 @@ t.eq( map.layers, null, "map.layers is null after destroy" ); t.eq( map.controls, null, "map.controls is null after destroy" ); t.eq( map.viewPortDiv, null, "map's viewportDiv nullified"); - }; + } diff --git a/tests/test_Marker.html b/tests/test_Marker.html index e4b2406aad..e6356be142 100644 --- a/tests/test_Marker.html +++ b/tests/test_Marker.html @@ -13,7 +13,7 @@ t.ok( marker.icon instanceof OpenLayers.Icon, "new marker.Icon returns Icon object" ); t.ok( marker.lonlat instanceof OpenLayers.LonLat, "new marker.lonlat returns LonLat object" ); t.ok( marker.lonlat.equals(ll), "marker.lonlat returns correct" ); - }; + } function test_02_Marker_onScreen(t) { t.plan( 2 ); @@ -44,7 +44,7 @@ t.ok( !marker2.onScreen(), "marker knows it's offscreen" ); map.destroy(); - }; + } function test_03_Marker_setOpacity(t) { t.plan( 2 ); @@ -72,7 +72,7 @@ t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works"); map.destroy(); - }; + } function test_04_Marker_moveTo(t) { t.plan( 6 ); @@ -105,7 +105,7 @@ t.eq(marker.lonlat.lon, map.getExtent().left, "on left edge of map"); t.eq(marker.lonlat.lat, map.getExtent().top, "on top edge of map"); map.destroy(); - }; + } diff --git a/tests/test_Popup.html b/tests/test_Popup.html index ae8aeef49a..d16249bafa 100644 --- a/tests/test_Popup.html +++ b/tests/test_Popup.html @@ -25,7 +25,7 @@ popup = new OpenLayers.Popup(); var newID = popup.id; t.ok(newID != firstID, "default id generator creating unique ids"); - }; + } function test_02_Popup_constructor (t) { t.plan( 5 ); @@ -49,7 +49,7 @@ t.ok(popup.lonlat.equals(ll), "popup.lonlat set correctly"); t.ok(popup.size.equals(sz), "popup.size set correctly"); t.eq(popup.contentHTML, content, "contentHTML porpoerty of set correctly"); - }; + } function test_03_Popup_draw(t) { t.plan( 17 ); @@ -104,7 +104,7 @@ popup.moveTo(new OpenLayers.Pixel(x, y)); t.eq(popup.div.style.left, x + "px", "moveTo updates left position of popup.div correctly"); t.eq(popup.div.style.top, y + "px", "moveTo updates top position of popup.div correctly"); - }; + } diff --git a/tests/test_Renderer.html b/tests/test_Renderer.html index 647cac8460..ff4bad6e97 100644 --- a/tests/test_Renderer.html +++ b/tests/test_Renderer.html @@ -9,7 +9,7 @@ t.plan(1); var r = new OpenLayers.Renderer(); t.ok( r instanceof OpenLayers.Renderer, "new OpenLayers.Renderer returns REnderer object" ); - }; + } /* function test_01_Renderer_drawGeometry(t) { @@ -155,7 +155,7 @@ function test_01_Renderer_drawGeometry(t) { r.drawGeometry(geometry, style); t.ok(properDraw, "drawGeometry called drawPolygon when passed a multi-polygon"); - }; + } */ diff --git a/tests/test_Util.html b/tests/test_Util.html index 01747de407..faf06d9a09 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -9,7 +9,7 @@ t.plan( 1 ); t.ok( OpenLayers.Util.getImagesLocation(), "../img/", "getImagesLocation()" ); - }; + } function test_02_Util_Strings(t) { t.plan(5); @@ -28,7 +28,7 @@ t.eq(trimmedStr.startsWith("dolphin"), false, "String.startsWith correctly does not find turkey"); - }; + } function test_03_Util_Array(t) { t.plan( 1 ); @@ -37,7 +37,7 @@ OpenLayers.Util.removeItem(array, 3); t.eq( array.toString(), "1,2,4,5", "Util.removeItem works"); - }; + } function test_04_Util_createDiv(t) { t.plan( 24 ); @@ -98,7 +98,7 @@ t.ok( !div.style.opacity, "element.style.opacity set correctly"); t.ok( !div.style.filter, "element.style.filter set correctly"); - }; + } function test_05_Util_createImage(t) { t.plan( 22 ); @@ -151,7 +151,7 @@ t.ok( !image.style.opacity, "element.style.opacity default unset"); t.ok( !image.style.filter, "element.style.filter default unset"); - }; + } function test_06_Util_applyDefaults(t) { @@ -173,14 +173,15 @@ t.eq( to["a"], "abra", "key present in to but not from maintained"); t.eq( to["b"], "blorg", "key present in to and from, maintained in to"); t.eq( to["c"], "press", "key present in from and not to successfully copied to to"); - }; + } function test_07_Util_getParameterString(t) { t.plan( 4 ); - var params = { foo: "bar", - chicken: 1.5 - }; + var params = { + 'foo': "bar", + 'chicken': 1.5 + }; t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly"); t.eq( OpenLayers.Util.getParameterString({'a:':'b='}), "a%3A=b%3D", "getParameterString returns correctly with non-ascii keys/values"); @@ -193,7 +194,7 @@ var params = { foo: ["bar","baz,"] }; t.eq( OpenLayers.Util.getParameterString(params), "foo=bar,baz%2C", "getParameterString returns with list of CSVs when given a list. "); - }; + } function test_08_Util_createAlphaImageDiv(t) { t.plan( 19 ); @@ -274,10 +275,9 @@ t.ok(true); } - }; + } function test_09_Util_modifyDOMElement(t) { - t.plan( 10 ); var id = "boo"; @@ -306,7 +306,7 @@ t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly"); var filterString = 'alpha(opacity=' + (opacity * 100) + ')'; t.eq( element.style.filter, filterString, "element.style.filter set correctly"); - }; + } function test_09_Util_modifyAlphaImageDiv(t) { t.plan( 19 ); @@ -387,10 +387,9 @@ t.ok(true); } - }; + } function test_10_Util_upperCaseObject(t) { - t.plan(8); var aKey = "chicken"; @@ -418,7 +417,7 @@ t.eq(uObj[aKey.toUpperCase()], aValue, "new uppercase value present"); t.eq(uObj[bKey.toUpperCase()], bValue, "new uppercase value present"); - }; + } function test_11_Util_createUniqueID(t) { t.plan(2); @@ -428,7 +427,7 @@ var id = OpenLayers.Util.createUniqueID("chicken"); t.ok( id.startsWith("chicken"), "OpenLayers.Util.createUniqueID starts id correctly"); - }; + } function test_12_Util_limitSigDigs(t) { t.plan(7); @@ -450,7 +449,7 @@ x = 0; t.eq(x.limitSigDigs(2), 0, "correctly handles 0 number"); - }; + } function test_13_Util_normalizeScale(t) { t.plan(2); @@ -462,7 +461,7 @@ //funky scale var scale = 5; t.eq( OpenLayers.Util.normalizeScale(scale), 1/5, "normalizing a wrong scale works!"); - }; + } function test_13_Util_getScaleResolutionTranslation(t) { t.plan(4); @@ -482,10 +481,11 @@ scale = 150000000; resolution = OpenLayers.Util.getResolutionFromScale(scale); t.eq(OpenLayers.Util.getScaleFromResolution(resolution), scale, "scale->resolution->scale works"); - }; + } function test_14_Util_getImgLocation(t) { t.plan(3); + OpenLayers.ImgPath = "foo/"; t.eq(OpenLayers.Util.getImagesLocation(), "foo/", "ImgPath works as expected."); OpenLayers.ImgPath = null; @@ -493,7 +493,7 @@ OpenLayers.ImgPath = ''; t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when set to ''."); - }; + } function test_15_Util_isEquivalentUrl(t) { t.plan(8); @@ -554,18 +554,20 @@ url2 = "../tests/../tests/foo.html?bar=now#go"; t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works"); - }; + } function test_Util_createUniqueIDSeq(t) { t.plan(1); + OpenLayers.Util.lastSeqID = 0; OpenLayers.Util.createDiv(); OpenLayers.Util.createDiv(); t.eq(OpenLayers.Util.createDiv().id, "OpenLayersDiv3", "Div created is sequential, starting at lastSeqID in Util."); - }; + } function test_Util_getParameters(t) { t.plan(6); + t.eq(OpenLayers.Util.getParameters('http://www.example.com'), {}, "getParameters works when args = ''"); t.eq(OpenLayers.Util.getParameters('http://www.example.com?'), {}, @@ -582,7 +584,7 @@ t.eq(OpenLayers.Util.getParameters('http://www.example.com?foo=bar,pub,disco'), {'foo': ['bar', 'pub', 'disco']}, "getParameters works with a comma-separated value (parses into array)"); - }; + } function test_Util_getArgs(t) { //DEPRECATED -- to be removed in 3.0 @@ -607,10 +609,11 @@ OpenLayers.Console.warn = temp; OpenLayers.Util.getParameters = temp2; - }; + } function tests_Util_extend(t) { t.plan(5); + var source = { num: Math.random(), obj: { @@ -633,7 +636,7 @@ t.eq(destination.toString(), "source", "extend properly sets custom toString method"); t.eq(window.property, undefined, "Property variable not clobbered."); - }; + } function test_XX_Util_Try(t) { t.plan(7); @@ -641,24 +644,24 @@ var func1 = function() { t.ok(true, "func1 executed"); throw "error"; - } + }; var func2 = function() { t.ok(true, "func2 executed"); throw "error"; - } + }; g_TestVal3 = {}; var func3 = function() { t.ok(true, "func3 executed"); return g_TestVal3; - } + }; g_TestVal4 = {}; var func4 = function() { t.fail("func4 should *not* be executed"); return g_TestVal4; - } + }; var ret = OpenLayers.Util.Try(func1, func2); t.ok(ret == null, "if all functions throw exceptions, null returned"); @@ -666,7 +669,7 @@ var ret = OpenLayers.Util.Try(func1, func2, func3, func4); t.ok(ret == g_TestVal3, "try returns first sucessfully executed function's return"); - }; + }