mobius1-selectr
Advanced tools
Comparing version 2.4.8 to 2.4.9
{ | ||
"name": "mobius1-selectr", | ||
"version": "2.4.8", | ||
"version": "2.4.9", | ||
"ignore": [ | ||
@@ -5,0 +5,0 @@ ".gitattributes", |
/* | ||
Selectr 2.4.8 | ||
Selectr 2.4.9 | ||
http://mobius.ovh/docs/selectr | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "mobius1-selectr", | ||
"version": "2.4.8", | ||
"version": "2.4.9", | ||
"description": "A lightweight, dependency-free, mobile-friendly javascript select box replacement.", | ||
@@ -5,0 +5,0 @@ "main": "dist/selectr.min.js", |
@@ -16,2 +16,4 @@ # Selectr | ||
Pull requests accepted! | ||
--- | ||
@@ -79,5 +81,5 @@ | ||
<select id="mySelect"> | ||
<option vlaue="value-1">Value 1</option> | ||
<option vlaue="value-2">Value 2</option> | ||
<option vlaue="value-3">Value 3</option> | ||
<option value="value-1">Value 1</option> | ||
<option value="value-2">Value 2</option> | ||
<option value="value-3">Value 3</option> | ||
... | ||
@@ -110,2 +112,8 @@ </select> | ||
# Contributers | ||
@all-contributors | ||
--- | ||
If this project helps you then you can grab me a coffee or beer to say thanks. | ||
@@ -117,2 +125,3 @@ | ||
# License | ||
@@ -119,0 +128,0 @@ |
@@ -66,2 +66,3 @@ /** | ||
assert.equal( selectr.el, s, "instance has reference to <select> element" ); | ||
assert.equal( s.selectr, selectr, "<select> element has reference to instance" ); | ||
@@ -160,2 +161,7 @@ selectr.destroy(); | ||
); | ||
assert.deepEqual( | ||
multiSelectr.getValue( true ), | ||
{ values: [{ text: "two", value: "value-2" },{ text: "five", value: "value-5" }] }, | ||
"gets selected values in object format" | ||
); | ||
@@ -345,4 +351,65 @@ multiSelectr.__done__(); | ||
QUnit.test( "defaultSelected", function ( assert ) { | ||
// #93 defaultSelected = false did not work as expected | ||
// The selectr instance with a complete select elemnt in the dom | ||
// did also not give the same results as a selectr instance created with data to its constructor. | ||
var oneSelectr = newSelectr({defaultSelected: false}); | ||
assert.equal( | ||
oneSelectr.getValue(), | ||
null, | ||
"select-one: Default selection turned off" | ||
); | ||
oneSelectr.__done__(); | ||
var multiSelectr = newSelectr( { defaultSelected: false, multiple: true } ); | ||
assert.deepEqual( | ||
multiSelectr.getValue(), | ||
[], | ||
"select-multi: no option is selected by default" | ||
); | ||
multiSelectr.__done__(); | ||
// building a selectr instance from a existing select component should have the same results | ||
var s = document.createElement("select"); | ||
document.body.appendChild(s); | ||
var data = exampleData(); | ||
// Create and append the options | ||
for (var i = 0; i < data.length; i++) { | ||
var o = document.createElement("option"); | ||
o.value = data[i].value; | ||
o.text = data[i].text; | ||
s.appendChild(o); | ||
} | ||
var oneSelectr2 = newSelectr({defaultSelected: false}, s); | ||
assert.equal( | ||
oneSelectr2.getValue(), | ||
null, | ||
"select-one: Default selection turned off" | ||
); | ||
oneSelectr2.__done__(); | ||
var multiSelectr2 = newSelectr( { defaultSelected: false, multiple: true }, s); | ||
assert.deepEqual( | ||
multiSelectr2.getValue(), | ||
[], | ||
"select-multi: no option is selected by default" | ||
); | ||
multiSelectr2.__done__(); | ||
}); | ||
// @todo tests for other constructor options/settings: | ||
// defaultSelected | ||
// multiple | ||
@@ -349,0 +416,0 @@ // searchable |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
561700
5074
132