Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
563b293
commit 86da694
Showing
3 changed files
with
91 additions
and
1,755 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,111 +1,114 @@ | |||
<!doctype html> | <!doctype html> | ||
<head> | <head> | ||
<script src="http://code.jquery.com/jquery-latest.js"></script> | <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen"> | ||
<script src="../jquery.listIt.js"></script> | <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script> | ||
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen"> |
|
||
<script type="text/javascript" src="qunit.js"></script> |
|
||
|
|
||
<script> | <script src="http://code.jquery.com/jquery-latest.js"></script> | ||
$(document).ready(function(){ | <script src="../jquery.listIt.js"></script> | ||
// SETUP ////////////////////////////////////////////////////// |
|
||
var cfg = { | <script> | ||
items: false, //["you@me.com", "why@because.com"], | $(document).ready(function(){ | ||
itemTmpl: "", | // SETUP ////////////////////////////////////////////////////// | ||
containerClass: "editList", | var cfg = { | ||
delBtnClass: "btn small", | items: false, //["you@me.com", "why@because.com"], | ||
showDelBtn: true, | itemTmpl: "", | ||
fadeTime: 250, | containerClass: "editList", | ||
addBtnId: "", | delBtnClass: "btn small", | ||
addBtnClass: "btn small", | showDelBtn: true, | ||
addBtnText: "Add", | fadeTime: 250, | ||
showAddBtn: true, | addBtnId: "", | ||
inputId: "", | addBtnClass: "btn small", | ||
inputClass: "editList", | addBtnText: "Add", | ||
inputName: "", | showAddBtn: true, | ||
showInput: true, | inputId: "", | ||
onBeforeAdd: function (value) { }, | inputClass: "editList", | ||
onAdd: function (value) { }, | inputName: "", | ||
onBeforeDel: function (value) { }, | showInput: true, | ||
onDel: function (value) { }, | onBeforeAdd: function (value) { }, | ||
tmpl: "" | onAdd: function (value) { }, | ||
}, | onBeforeDel: function (value) { }, | ||
$test_custTmpl = $(".test_custTmpl"), | onDel: function (value) { }, | ||
$test_itemsViaHTML = $(".test_itemsViaHTML"), | tmpl: "" | ||
$test_itemsViaJS = $(".test_itemsViaJS"); | }, | ||
|
$test_custTmpl = $(".test_custTmpl"), | ||
|
$test_itemsViaHTML = $(".test_itemsViaHTML"), | ||
$test_custTmpl.listIt({ | $test_itemsViaJS = $(".test_itemsViaJS"); | ||
addBtnId: "js-KitBoxesAdd", |
|
||
showInput: false, |
|
||
itemTmpl: '<input type="text" value="" autocomplete="off"> <input type="text" value="" autocomplete="off"> <input type="checkbox"></span>' | $test_custTmpl.listIt({ | ||
}).addClass("heyKid"); | addBtnId: "js-KitBoxesAdd", | ||
|
showInput: false, | ||
$test_itemsViaHTML.listIt().addClass("supHomie"); | itemTmpl: '<input type="text" value="" autocomplete="off"> <input type="text" value="" autocomplete="off"> <input type="checkbox"></span>' | ||
|
}).addClass("heyKid"); | ||
$test_itemsViaJS.listIt({ |
|
||
items: ["you@me.com", "why@because.com", "uh@wuuuuut.com"], | $test_itemsViaHTML.listIt().addClass("supHomie"); | ||
showAddBtn: false, |
|
||
showInput: true, | $test_itemsViaJS.listIt({ | ||
showDelBtn: false | items: ["you@me.com", "why@because.com", "uh@wuuuuut.com"], | ||
}).addClass("cheeeeseIt"); | showAddBtn: false, | ||
|
showInput: true, | ||
// TESTS ////////////////////////////////////////////////////// | showDelBtn: false | ||
module("List 01: Custom item template", { | }).addClass("cheeeeseIt"); | ||
setup: function(){}, |
|
||
teardown: function(){} | // TESTS ////////////////////////////////////////////////////// | ||
}); | module("List 01: Custom item template", { | ||
test("Initalize and wrap raw list items", function(){ | setup: function(){}, | ||
var $target = $("#js-KitBoxes li span"), | teardown: function(){} | ||
}); | |||
test("Initalize and wrap raw list items", function(){ | |||
var $target = $("#js-KitBoxes li span"), | |||
hasAddBtn = $("#js-KitBoxesAdd").length > 0 ? true : false, | hasAddBtn = $("#js-KitBoxesAdd").length > 0 ? true : false, | ||
isSet = $test_custTmpl.is(".heyKid"); | isSet = $test_custTmpl.is(".heyKid"); | ||
|
|
||
$("#js-KitBoxesAdd").trigger("click"); | $("#js-KitBoxesAdd").trigger("click"); | ||
|
|
||
equal($target.length, "6", "Wrapped list items"); | equal($target.length, "6", "Wrapped list items"); | ||
ok(hasAddBtn, "Add button has been appended to the list"); | ok(hasAddBtn, "Add button has been appended to the list"); | ||
ok(isSet, "Chain-ability intact!"); | ok(isSet, "Chain-ability intact!"); | ||
}); | }); | ||
|
|
||
}); | }); | ||
</script> | </script> | ||
<style> | <style> | ||
|
|||
</style> | </style> | ||
</head> | </head> | ||
<body> | <body> | ||
<h1 id="qunit-header">jQuery listIt Plugin: Test Suite</h1> | <h1 id="qunit-header">jQuery listIt Plugin: Test Suite</h1> | ||
<h2 id="qunit-banner"></h2> | <h2 id="qunit-banner"></h2> | ||
<div id="qunit-testrunner-toolbar"></div> | <div id="qunit-testrunner-toolbar"></div> | ||
<h2 id="qunit-userAgent"></h2> | <h2 id="qunit-userAgent"></h2> | ||
<ol id="qunit-tests"></ol> | <ol id="qunit-tests"></ol> | ||
<div id="qunit-fixture"> | <div id="qunit-fixture"> | ||
|
|
||
<ul id="js-KitBoxes" class="test_custTmpl"> | <ul id="js-KitBoxes" class="test_custTmpl"> | ||
<li class=""><input type="text" value="from 01" autocomplete="off"> <input type="text" value="contents 01" autocomplete="off"> <input type="checkbox"></li> | <li class=""><input type="text" value="from 01" autocomplete="off"> <input type="text" value="contents 01" autocomplete="off"> <input type="checkbox"></li> | ||
<li class=""><input type="text" value="from 02" autocomplete="off"> <input type="text" value="contents 02" autocomplete="off"> <input type="checkbox"></li> | <li class=""><input type="text" value="from 02" autocomplete="off"> <input type="text" value="contents 02" autocomplete="off"> <input type="checkbox"></li> | ||
<li class=""><input type="text" value="from 03" autocomplete="off"> <input type="text" value="contents 03" autocomplete="off"> <input type="checkbox"></li> | <li class=""><input type="text" value="from 03" autocomplete="off"> <input type="text" value="contents 03" autocomplete="off"> <input type="checkbox"></li> | ||
</ul> | </ul> | ||
|
|
||
|
|
||
<ul id="js-Stuff2" class="test_itemsViaHTML"> | <ul id="js-Stuff2" class="test_itemsViaHTML"> | ||
<li class="">mmirande@screamingcircuits.com</li> | <li class="">mmirande@screamingcircuits.com</li> | ||
<li class="">mattmirande@gmail.com</li> | <li class="">mattmirande@gmail.com</li> | ||
<li class="">meatlightning@gmail.com</li> | <li class="">meatlightning@gmail.com</li> | ||
<li class="">itsbusticated@gmail.com</li> | <li class="">itsbusticated@gmail.com</li> | ||
</ul> | </ul> | ||
<span>spoiler!!</span> | <span>spoiler!!</span> | ||
|
|
||
|
|
||
<ol id="js-Stuff3" class="test_itemsViaHTML"> | <ol id="js-Stuff3" class="test_itemsViaHTML"> | ||
<li class="">Item 1</li> | <li class="">Item 1</li> | ||
<li class="">Item 2</li> | <li class="">Item 2</li> | ||
<li class="">Item 3</li> | <li class="">Item 3</li> | ||
<li class="">Item 4</li> | <li class="">Item 4</li> | ||
</ol> | </ol> | ||
|
|
||
|
|
||
<ul id="js-Stuff" class="test_itemsViaJS"><ul> | <ul id="js-Stuff" class="test_itemsViaJS"><ul> | ||
|
|
||
</div> | </div> | ||
</body> | </body> | ||
</html> | </html> |
Oops, something went wrong.