add OpenLayers.Util.upperCaseObject() function and test

git-svn-id: http://svn.openlayers.org/trunk/openlayers@491 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-01 10:52:22 +00:00
parent 128825886e
commit c7aee7fd25
2 changed files with 50 additions and 1 deletions

View File

@@ -353,8 +353,40 @@
} else {
t.ok(true);
}
}
function test_10_Util_upperCaseObject(t) {
t.plan(8);
var aKey = "chicken";
var aValue = "pot pie";
var bKey = "blorg";
var bValue = "us maximus";
var obj = new Object();
obj[aKey] = aValue;
obj[bKey] = bValue;
var uObj = OpenLayers.Util.upperCaseObject(obj);
//make sure old object not modified
t.eq(obj[aKey], aValue, "old lowercase value still present in old obj");
t.eq(obj[bKey], bValue, "old lowercase value still present in old obj");
t.eq(obj[aKey.toUpperCase()], null, "new uppercase value not present in old obj");
t.eq(obj[bKey.toUpperCase()], null, "new uppercase value not present in old obj");
//make sure new object modified
t.eq(uObj[aKey], null, "old lowercase value not present");
t.eq(uObj[bKey], null, "old lowercase value not present");
t.eq(uObj[aKey.toUpperCase()], aValue, "new uppercase value present");
t.eq(uObj[bKey.toUpperCase()], bValue, "new uppercase value present");
}
// -->
</script>
</head>