Deprecating all prototype extensions. This puts all OpenLayers functionality in the OpenLayers namespace. If you are using any of the Function, String, or Number prototype extensions, start using the functional equivalents in the OpenLayers namespace - the prototype extensions will be gone in 3.0 (closes #712).

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4302 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-09-14 20:08:47 +00:00
parent af72722ded
commit 2478677985
26 changed files with 341 additions and 217 deletions
+5 -44
View File
@@ -11,25 +11,6 @@
"getImagesLocation()" );
}
function test_02_Util_Strings(t) {
t.plan(5);
var str = " chicken pox ";
t.ok(str.contains("chicken"), "contains() function correctly finds an embedded string");
t.ok(!str.contains("marsupial"), "contains() function correctly does not finds an random string");
var trimmedStr = str.trim();
t.eq(trimmedStr, "chicken pox", "String.trim works correctly");
t.eq(trimmedStr.startsWith("chicken"), true, "String.startsWith correctly finds chicken");
t.eq(trimmedStr.startsWith("dolphin"), false, "String.startsWith correctly does not find turkey");
}
function test_03_Util_Array(t) {
t.plan( 1 );
@@ -423,34 +404,14 @@
t.plan(2);
var id = OpenLayers.Util.createUniqueID();
t.ok( id.startsWith("id_"), "default OpenLayers.Util.createUniqueID starts id correctly");
t.ok(OpenLayers.String.startsWith(id, "id_"),
"default OpenLayers.Util.createUniqueID starts id correctly");
var id = OpenLayers.Util.createUniqueID("chicken");
t.ok( id.startsWith("chicken"), "OpenLayers.Util.createUniqueID starts id correctly");
t.ok(OpenLayers.String.startsWith(id, "chicken"),
"OpenLayers.Util.createUniqueID starts id correctly");
}
function test_12_Util_limitSigDigs(t) {
t.plan(7);
var x;
x = 123456;
t.eq(x.limitSigDigs(3), 123000, "correctly rounds down");
x = 555555;
t.eq(x.limitSigDigs(3), 556000, "correctly rounds up");
x = 66;
t.eq(x.limitSigDigs(3), 66, "correctly handles number smaller than sigdig");
t.eq(x.limitSigDigs(null), 0, "correctly handles null sigdig");
t.eq(x.limitSigDigs(0), 0, "correctly handles 0 sigdig");
t.eq(x.limitSigDigs(-1), 0, "correctly handles negative sigdig");
x = 0;
t.eq(x.limitSigDigs(2), 0, "correctly handles 0 number");
}
function test_13_Util_normalizeScale(t) {
t.plan(2);