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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user