-
Notifications
You must be signed in to change notification settings - Fork 368
Expand file tree
/
Copy pathstring_test.js
More file actions
46 lines (27 loc) · 971 Bytes
/
string_test.js
File metadata and controls
46 lines (27 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
steal('funcunit/qunit','./string').then(function(){
module("jquery/lang/string")
test("$.String.sub", function(){
equals($.String.sub("a{b}",{b: "c"}),"ac")
var foo = {b: "c"};
equals($.String.sub("a{b}",foo,true),"ac");
ok(!foo.b, "removed this b");
});
test("$.String.sub double", function(){
equals($.String.sub("{b} {d}",[{b: "c", d: "e"}]),"c e");
})
test("String.underscore", function(){
equals($.String.underscore("Foo.Bar.ZarDar"),"foo.bar.zar_dar")
})
test("$.String.getObject", function(){
var obj = $.String.getObject("foo", [{a: 1}, {foo: 'bar'}]);
equals(obj,'bar', 'got bar')
// test null data
var obj = $.String.getObject("foo", [{a: 1}, {foo: 0}]);
equals(obj,0, 'got 0 (falsey stuff)')
});
test("$.String.niceName", function(){
var str = "some_underscored_string";
var niceStr = $.String.niceName(str);
equals(niceStr, 'Some Underscored String', 'got correct niceName');
})
}).then('./deparam/deparam_test');