add contains() function to string library. added tests too.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@859 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-03 19:54:00 +00:00
parent 74b3e153f8
commit 65ae34d4e7
2 changed files with 17 additions and 1 deletions

View File

@@ -11,16 +11,22 @@
}
function test_02_Util_Strings(t) {
t.plan(3);
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) {