forked from summernote/summernote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
list(head, last, tail, clusterBy, compact), range(listPara)
- Loading branch information
1 parent
908bef0
commit 9f76db4
Showing
3 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>summernote :: list.spec</title> | ||
<link rel="stylesheet" href="qunit-1.11.0.css"> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
<div id="qunit-fixture"></div> | ||
<script src="qunit-1.11.0.js"></script> | ||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | ||
<script src="../summernote.js"></script> | ||
<script src="list.spec.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* list.spec.js | ||
* (c) 2013~ Youngteac Hong | ||
* summernote may be freely distributed under the MIT license./ | ||
*/ | ||
var list = $.fn.summernoteInner().list; | ||
|
||
test('list.compact', function() { | ||
deepEqual(list.compact([0, 1, false, 2, '', 3]), [1,2,3], | ||
'falsey values of `array` removed'); | ||
}); | ||
|
||
test('list.clusterBy', function() { | ||
var aaClustered = list.clusterBy([1, 1, 2, 2, 3], function(itemA, itemB) { | ||
return itemA === itemB; | ||
}); | ||
deepEqual([[1, 1], [2, 2], [3]], aaClustered, 'clusterBy equality 1'); | ||
|
||
var aaClustered = list.clusterBy([1, 2, 2, 1, 3], function(itemA, itemB) { | ||
return itemA === itemB; | ||
}); | ||
deepEqual([[1], [2, 2], [1], [3]], aaClustered, 'clusterBy equality 2'); | ||
}); |