update
This commit is contained in:
parent
962caebbb7
commit
87bf53d076
1825 changed files with 94929 additions and 0 deletions
|
@ -0,0 +1,10 @@
|
|||
function camelize(str) {
|
||||
var arr = str.split('-');
|
||||
|
||||
for(var i=1; i<arr.length; i++) {
|
||||
// преобразовать: первый символ с большой буквы
|
||||
arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);
|
||||
}
|
||||
|
||||
return arr.join('');
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
describe("camelize", function() {
|
||||
|
||||
it("оставляет пустую строку \"как есть\"", function() {
|
||||
assert.equal( camelize(""), "");
|
||||
});
|
||||
|
||||
describe("делает заглавным первый символ после дефиса", function() {
|
||||
|
||||
it("превращает background-color в backgroundColor", function() {
|
||||
assert.equal( camelize("background-color"), "backgroundColor");
|
||||
});
|
||||
|
||||
it("превращает list-style-image в listStyleImage", function() {
|
||||
assert.equal( camelize("list-style-image"), "listStyleImage");
|
||||
});
|
||||
|
||||
it("превращает -webkit-transition в WebkitTransition", function() {
|
||||
assert.equal( camelize("-webkit-transition"), "WebkitTransition");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue