Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35fea30

Browse files
committed
Cleanup string tests and add string test to_.toArray.
Former-commit-id: 3565f7233f1f7662604e3b8e1f07eead62349454
1 parent24b672b commit35fea30

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

‎test/test.js‎

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@
272272
QUnit.module('lodash.contains');
273273

274274
(function(){
275-
_.each([
276-
{'kind':'literal','value':'abc'},
277-
{'kind':'object','value':Object('abc')}
278-
],
279-
function(data){
280-
test('should work with a string '+data.kind+' for `collection`',function(){
281-
equal(_.contains(data.value,'bc'),true);
282-
equal(_.contains(data.value,'d'),false);
275+
_.each({
276+
'literal':'abc',
277+
'object':Object('abc')
278+
},
279+
function(collection,key){
280+
test('should work with a string '+key+' for `collection`',function(){
281+
equal(_.contains(collection,'bc'),true);
282+
equal(_.contains(collection,'d'),false);
283283
});
284284
});
285285
}());
@@ -508,14 +508,13 @@
508508
deepEqual(keys,['length']);
509509
});
510510

511-
_.each([
512-
{'kind':'literal','value':'abc'},
513-
{'kind':'object','value':Object('abc')}
514-
],
515-
function(data){
516-
test('should work with a string '+data.kind+' for `collection` (test in IE < 9)',function(){
511+
_.each({
512+
'literal':'abc',
513+
'object':Object('abc')
514+
},
515+
function(collection,key){
516+
test('should work with a string '+key+' for `collection` (test in IE < 9)',function(){
517517
varargs,
518-
collection=data.value,
519518
values=[];
520519

521520
_.forEach(collection,function(value){
@@ -1151,14 +1150,13 @@
11511150
deepEqual(args,expected);
11521151
});
11531152

1154-
_.each([
1155-
{'kind':'literal','value':'abc'},
1156-
{'kind':'object','value':Object('abc')}
1157-
],
1158-
function(data){
1159-
test('should work with a string '+data.kind+' for `collection` (test in IE < 9)',function(){
1160-
varargs,
1161-
collection=data.value;
1153+
_.each({
1154+
'literal':'abc',
1155+
'object':Object('abc')
1156+
},
1157+
function(collection,key){
1158+
test('should work with a string '+key+' for `collection` (test in IE < 9)',function(){
1159+
varargs;
11621160

11631161
varactual=_.reduceRight(collection,function(accumulator,value){
11641162
args||(args=slice.call(arguments));
@@ -1425,10 +1423,14 @@
14251423
(function(){
14261424
varargs=arguments;
14271425

1428-
test('should call custom `toArray` method of an array',function(){
1429-
vararray=[1,2,3];
1430-
array.toArray=function(){return[3,2,1];};
1431-
deepEqual(_.toArray(array),[3,2,1]);
1426+
_.each({
1427+
'an array':['a','b','c'],
1428+
'a string':Object('abc')
1429+
},function(collection,key){
1430+
test('should call custom `toArray` method of '+key,function(){
1431+
collection.toArray=function(){return[3,2,1];};
1432+
deepEqual(_.toArray(collection),[3,2,1]);
1433+
});
14321434
});
14331435

14341436
test('should treat array-like objects like arrays',function(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp