-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some minor changes and test additions
- Loading branch information
Patrick Tsai
committed
Aug 23, 2015
1 parent
283cfce
commit 6bf64f8
Showing
8 changed files
with
47 additions
and
9 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* jQuery Tree Multiselect | ||
* v1.12.2 | ||
* v1.12.3 | ||
* | ||
* (c) Patrick Tsai | ||
* MIT Licensed | ||
|
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,38 @@ | ||
QUnit.module("Adding and Removing", { | ||
beforeEach: function(assert) { | ||
var select = document.createElement("select"); | ||
select.setAttribute("multiple", "multiple"); | ||
$("div#qunit-fixture").append(select); | ||
assert.equal($("select").length, 1); | ||
} | ||
}); | ||
|
||
QUnit.test("can add an item", function(assert) { | ||
$("select").append("<option value='one' data-section='section'>One</option>"); | ||
$("select").treeMultiselect(); | ||
|
||
assert.equal($("div.selections div.item").length, 1, "there should be one item for selection"); | ||
assert.equal($("div.selected div.item").length, 0, "no items should be selected"); | ||
|
||
$("div.selections div.item > input[type=checkbox]").prop('checked', true).trigger('change'); | ||
|
||
assert.equal($("div.selections div.item > input[type=checkbox]:checked").length, 1, "the one item should be checked"); | ||
var selectedItem = $("div.selected div.item"); | ||
assert.equal($("div.selected div.item").length, 1, "there should be one item in the selected div"); | ||
|
||
assert.equal(textOf(selectedItem), 'One', "selected item text should be 'one'"); | ||
assert.equal(textOf(selectedItem.find("> span.selectedSectionName")), 'section', "selected item section label should be 'section'"); | ||
}); | ||
|
||
QUnit.test("can remove an item", function(assert) { | ||
$("select").append("<option value='one' data-section='section' selected='selected'>One</option>"); | ||
$("select").treeMultiselect(); | ||
|
||
var selectedItem = $("div.selected div.item"); | ||
assert.equal(selectedItem.length, 1, "there should be one selected item"); | ||
|
||
var removeSpan = selectedItem.find("> span.remove-selected"); | ||
removeSpan.trigger('click'); | ||
|
||
assert.equal($("div.selected div.item").length, 0, "there should now be no selected items"); | ||
}); |
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