mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Add _.lowerCase, _.lowerFirst, _.toLower, _.toUpper, _.upperCase, _.upperFirst tests.
This commit is contained in:
committed by
John-David Dalton
parent
f6a4ab62b8
commit
689b292c24
100
test/test.js
100
test/test.js
@@ -10560,6 +10560,34 @@
|
|||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.lowerCase');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should lowercase as space-separated words', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.lowerCase('--Foo-Bar'), 'foo bar');
|
||||||
|
assert.strictEqual(_.lowerCase('fooBar'), 'foo bar');
|
||||||
|
assert.strictEqual(_.lowerCase('__FOO_BAR__'), 'foo bar');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.lowerFirst');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should lowercase only the first character', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.lowerFirst('fred'), 'fred');
|
||||||
|
assert.strictEqual(_.lowerFirst('Fred'), 'fred');
|
||||||
|
assert.strictEqual(_.lowerFirst('FRED'), 'fRED');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.lt');
|
QUnit.module('lodash.lt');
|
||||||
@@ -18843,6 +18871,34 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.toLower');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should convert whole string to lower case', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.deepEqual(_.toLower('--Foo-Bar'), '--foo-bar');
|
||||||
|
assert.deepEqual(_.toLower('fooBar'), 'foobar');
|
||||||
|
assert.deepEqual(_.toLower('__FOO_BAR__'), '__foo_bar__');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.toUpper');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should convert whole string to upper case', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.deepEqual(_.toUpper('--Foo-Bar'), '--FOO-BAR');
|
||||||
|
assert.deepEqual(_.toUpper('fooBar'), 'FOOBAR');
|
||||||
|
assert.deepEqual(_.toUpper('__FOO_BAR__'), '__FOO_BAR__');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.slice and lodash.toArray');
|
QUnit.module('lodash.slice and lodash.toArray');
|
||||||
|
|
||||||
_.each(['slice', 'toArray'], function(methodName) {
|
_.each(['slice', 'toArray'], function(methodName) {
|
||||||
@@ -19500,6 +19556,34 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.upperCase');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should uppercase as space-separated words', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.upperCase('--foo-bar'), 'FOO BAR');
|
||||||
|
assert.strictEqual(_.upperCase('fooBar'), 'FOO BAR');
|
||||||
|
assert.strictEqual(_.upperCase('__foo_bar__'), 'FOO BAR');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.upperFirst');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should uppercase only the first character', function(assert) {
|
||||||
|
assert.expect(3);
|
||||||
|
|
||||||
|
assert.strictEqual(_.upperFirst('fred'), 'Fred');
|
||||||
|
assert.strictEqual(_.upperFirst('Fred'), 'Fred');
|
||||||
|
assert.strictEqual(_.upperFirst('FRED'), 'FRED');
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('union methods');
|
QUnit.module('union methods');
|
||||||
|
|
||||||
_.each(['union', 'unionBy'], function(methodName) {
|
_.each(['union', 'unionBy'], function(methodName) {
|
||||||
@@ -21292,19 +21376,19 @@
|
|||||||
'padRight',
|
'padRight',
|
||||||
'parseInt',
|
'parseInt',
|
||||||
'pop',
|
'pop',
|
||||||
'repeat',
|
|
||||||
'shift',
|
|
||||||
'snakeCase',
|
|
||||||
'startCase',
|
|
||||||
'sum',
|
|
||||||
'random',
|
'random',
|
||||||
'reduce',
|
'reduce',
|
||||||
'reduceRight',
|
'reduceRight',
|
||||||
|
'repeat',
|
||||||
'round',
|
'round',
|
||||||
'sample',
|
'sample',
|
||||||
|
'shift',
|
||||||
'size',
|
'size',
|
||||||
|
'snakeCase',
|
||||||
'some',
|
'some',
|
||||||
|
'startCase',
|
||||||
'startsWith',
|
'startsWith',
|
||||||
|
'sum',
|
||||||
'toInteger',
|
'toInteger',
|
||||||
'toLower',
|
'toLower',
|
||||||
'toString',
|
'toString',
|
||||||
@@ -21436,17 +21520,21 @@
|
|||||||
'escape',
|
'escape',
|
||||||
'kebabCase',
|
'kebabCase',
|
||||||
'lowerCase',
|
'lowerCase',
|
||||||
|
'lowerFirst',
|
||||||
'pad',
|
'pad',
|
||||||
'padLeft',
|
'padLeft',
|
||||||
'padRight',
|
'padRight',
|
||||||
'repeat',
|
'repeat',
|
||||||
'snakeCase',
|
'snakeCase',
|
||||||
|
'toLower',
|
||||||
|
'toUpper',
|
||||||
'trim',
|
'trim',
|
||||||
'trimLeft',
|
'trimLeft',
|
||||||
'trimRight',
|
'trimRight',
|
||||||
'trunc',
|
'trunc',
|
||||||
'unescape',
|
'unescape',
|
||||||
'upperCase'
|
'upperCase',
|
||||||
|
'upperFirst'
|
||||||
];
|
];
|
||||||
|
|
||||||
_.each(stringMethods, function(methodName) {
|
_.each(stringMethods, function(methodName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user