remove useless or duplicate functions from Util.js -- no more: Array prepend() append() -- use push() and unshift(). clear() and indexOf() both removed as they are duplicated in Prototype.js -- all instances replaced and tests updated.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1136 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -30,32 +30,22 @@
|
||||
}
|
||||
|
||||
function test_03_Util_Array(t) {
|
||||
t.plan( 8 );
|
||||
t.plan( 5 );
|
||||
|
||||
var array = new Array(1,2,3,4,5);
|
||||
|
||||
array.prepend(0);
|
||||
t.eq( array.toString(), "0,1,2,3,4,5", "array.prepend works");
|
||||
|
||||
array.append(6);
|
||||
t.eq( array.toString(), "0,1,2,3,4,5,6", "array.append works");
|
||||
|
||||
array.remove(3);
|
||||
t.eq( array.toString(), "0,1,2,4,5,6", "array.remove works");
|
||||
t.eq( array.toString(), "1,2,4,5", "array.remove works");
|
||||
|
||||
copy = array.clone();
|
||||
t.eq( copy.toString(), "0,1,2,4,5,6", "array.clone() works");
|
||||
array.append(7);
|
||||
t.eq( copy.toString(), "0,1,2,4,5,6", "changing a value in the copied array doesnt affect the new array");
|
||||
t.eq( copy.toString(), "1,2,4,5", "array.clone() works");
|
||||
array.push(7);
|
||||
t.eq( copy.toString(), "1,2,4,5", "changing a value in the copied array doesnt affect the new array");
|
||||
|
||||
|
||||
t.eq( copy.indexOf(5), 4, "indexOf function returns index of value in an array");
|
||||
t.eq( copy.indexOf(5), 3, "indexOf function returns index of value in an array");
|
||||
t.eq( copy.indexOf(75), -1, "indexOf function returns -1 when element not found in array");
|
||||
|
||||
array.clear();
|
||||
t.eq( array.toString(), "", "array.clear() works");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_04_Util_createDiv(t) {
|
||||
|
||||
Reference in New Issue
Block a user