forked from sindresorhus/camelcase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
49 lines (48 loc) · 1.49 KB
/
test.js
File metadata and controls
49 lines (48 loc) · 1.49 KB
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
47
48
49
import test from 'ava';
import m from './';
test('camelCase', t => {
t.is(m('foo'), 'foo');
t.is(m('foo-bar'), 'fooBar');
t.is(m('foo-bar-baz'), 'fooBarBaz');
t.is(m('foo--bar'), 'fooBar');
t.is(m('--foo-bar'), 'fooBar');
t.is(m('--foo--bar'), 'fooBar');
t.is(m('FOO-BAR'), 'fooBar');
t.is(m('FOÈ-BAR'), 'foèBar');
t.is(m('-foo-bar-'), 'fooBar');
t.is(m('--foo--bar--'), 'fooBar');
t.is(m('foo.bar'), 'fooBar');
t.is(m('foo..bar'), 'fooBar');
t.is(m('..foo..bar..'), 'fooBar');
t.is(m('foo_bar'), 'fooBar');
t.is(m('__foo__bar__'), 'fooBar');
t.is(m('__foo__bar__'), 'fooBar');
t.is(m('foo bar'), 'fooBar');
t.is(m(' foo bar '), 'fooBar');
t.is(m('-'), '-');
t.is(m(' - '), '-');
t.is(m('fooBar'), 'fooBar');
t.is(m('fooBar-baz'), 'fooBarBaz');
t.is(m('foìBar-baz'), 'foìBarBaz');
t.is(m('fooBarBaz-bazzy'), 'fooBarBazBazzy');
t.is(m('FBBazzy'), 'fbBazzy');
t.is(m('F'), 'f');
t.is(m('FooBar'), 'fooBar');
t.is(m('Foo'), 'foo');
t.is(m('FOO'), 'foo');
t.is(m('foo', 'bar'), 'fooBar');
t.is(m('foo', '-bar'), 'fooBar');
t.is(m('foo', '-bar', 'baz'), 'fooBarBaz');
t.is(m('', ''), '');
t.is(m('--'), '');
t.is(m(''), '');
t.is(m('--__--_--_'), '');
t.is(m('---_', '--', '', '-_- '), '');
t.is(m('foo bar?'), 'fooBar?');
t.is(m('foo bar!'), 'fooBar!');
t.is(m('foo bar$'), 'fooBar$');
t.is(m('foo-bar#'), 'fooBar#');
t.is(m('XMLHttpRequest'), 'xmlHttpRequest');
t.is(m('AjaxXMLHttpRequest'), 'ajaxXmlHttpRequest');
t.is(m('Ajax-XMLHttpRequest'), 'ajaxXmlHttpRequest');
});