Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap-multiselect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap-multiselect
Commits
e7c8abfe
Commit
e7c8abfe
authored
Apr 17, 2016
by
David Stutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for #709.
parent
9ec68114
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
25 deletions
+34
-25
index.html
index.html
+14
-15
bootstrap-multiselect.js
tests/spec/bootstrap-multiselect.js
+20
-10
No files found.
index.html
View file @
e7c8abfe
...
...
@@ -2990,7 +2990,7 @@
<table
class=
"table layout-fixed"
>
<tbody>
<tr>
<td>
<td
width=
"30%"
>
<code>
.multiselect('destroy')
</code>
</td>
<td>
...
...
@@ -3998,20 +3998,12 @@
<
select id=
"
example-dataprovider-optgroups
"
multiple=
"
multiple
"><
/select
>
</pre>
</div>
</td>
</tr>
<tr>
<td>
</td>
<td>
<p>
<p>
You can add custom data attributes on option group children and non-grouped options:
</p>
<p>
Renders as:
<pre
class=
"prettyprint"
>
<
option value=
"
1
"
label=
"
Option 1
"
selected=
"
selected
"
data-some-attribute=
"
1
"
data-another-attribute=
"
false
"><
/option
>
<
option value=
"
2
"
label=
"
Option 2
"
data-some-attribute=
"
2
"><
/option
>
</pre>
</p>
<div
class=
"example"
>
<div
class=
"example"
>
<div
class=
"btn-group"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
...
...
@@ -4042,7 +4034,7 @@
</div>
<div
class=
"highlight"
>
<div
class=
"highlight"
>
<pre
class=
"prettyprint linenums"
>
$(
'
#example-dataprovider-data-attributes
'
).multiselect();
...
...
@@ -4070,8 +4062,15 @@
<
/script
>
<
select id=
"
example-dataprovider-data-attributes
"
multiple=
"
multiple
"><
/select
>
</pre>
</div>
</div>
</div>
<p>
Renders as:
</p>
<pre
class=
"prettyprint"
>
<
option value=
"
1
"
label=
"
Option 1
"
selected=
"
selected
"
data-some-attribute=
"
1
"
data-another-attribute=
"
false
"><
/option
>
<
option value=
"
2
"
label=
"
Option 2
"
data-some-attribute=
"
2
"><
/option
>
</pre>
</td>
</tr>
<tr>
...
...
tests/spec/bootstrap-multiselect.js
View file @
e7c8abfe
...
...
@@ -360,13 +360,17 @@ describe('Bootstrap Multiselect "Dataprovider"', function() {
});
var
options
=
[
{
label
:
'
Option 1
'
,
value
:
'
1
'
,
selected
:
true
,
title
:
'
Option 1 Title
'
},
{
label
:
'
Option 2
'
,
value
:
'
2
'
,
title
:
'
Option 2 Title
'
},
{
label
:
'
Option 3
'
,
value
:
'
3
'
,
selected
:
true
,
title
:
'
Option 3 Title
'
},
{
label
:
'
Option 4
'
,
value
:
'
4
'
,
title
:
'
Option 4 Title
'
},
{
label
:
'
Option 5
'
,
value
:
'
5
'
,
title
:
'
Option 5 Title
'
},
{
label
:
'
Option 6
'
,
value
:
'
6
'
,
title
:
'
Option 6 Title
'
}
];
{
label
:
'
Option 1
'
,
value
:
'
1
'
,
selected
:
true
,
title
:
'
Option 1 Title
'
},
{
label
:
'
Option 2
'
,
value
:
'
2
'
,
title
:
'
Option 2 Title
'
},
{
label
:
'
Option 3
'
,
value
:
'
3
'
,
selected
:
true
,
title
:
'
Option 3 Title
'
},
{
label
:
'
Option 4
'
,
value
:
'
4
'
,
title
:
'
Option 4 Title
'
},
{
label
:
'
Option 5
'
,
value
:
'
5
'
,
title
:
'
Option 5 Title
'
},
{
label
:
'
Option 6
'
,
value
:
'
6
'
,
title
:
'
Option 6 Title
'
}
];
var
options_attributes
=
[
{
label
:
'
Option 1
'
,
value
:
'
1
'
,
attributes
:
{
'
some-attribute
'
:
'
test
'
}}
];
it
(
"
Should be able to add options.
"
,
function
()
{
$
(
'
#multiselect
'
).
multiselect
(
'
dataprovider
'
,
options
);
...
...
@@ -416,6 +420,12 @@ describe('Bootstrap Multiselect "Dataprovider"', function() {
expect
(
$
(
'
#multiselect-container input[value="6"]
'
).
closest
(
'
label
'
).
attr
(
'
title
'
)).
toBe
(
'
Option 6 Title
'
);
});
it
(
"
Should be able to define data attributes.
"
,
function
()
{
$
(
'
#multiselect
'
).
multiselect
(
'
dataprovider
'
,
options_attributes
)
expect
(
$
(
'
#multiselect option[value="1"]
'
).
attr
(
'
value
'
)).
toBe
(
'
1
'
);
expect
(
$
(
'
#multiselect option[value="1"]
'
).
attr
(
'
data-some-attribute
'
)).
toBe
(
'
test
'
);
});
var
optgroups
=
[
{
label
:
'
Group 1
'
,
children
:
[
...
...
@@ -630,7 +640,7 @@ describe('Bootstrap Multiselect "Select All".', function() {
});
});
describe
(
'
Bootstrap Multiselect Specific Issues
'
,
function
()
{
describe
(
'
Bootstrap Multiselect Specific Issues
.
'
,
function
()
{
it
(
'
#393
'
,
function
()
{
var
$select
=
$
(
'
<select id="multiselect" multiple="multiple"></select>
'
);
...
...
@@ -706,7 +716,7 @@ describe('Bootstrap Multiselect Specific Issues', function() {
});
});
describe
(
'
Knockout Binding
'
,
function
()
{
describe
(
'
Knockout Binding
.
'
,
function
()
{
var
$testArea
;
afterEach
(
function
()
{
if
(
$testArea
)
{
...
...
@@ -714,7 +724,7 @@ describe('Knockout Binding', function() {
}
});
it
(
'
Should update values and options with an observable array
'
,
function
()
{
it
(
'
Should update values and options with an observable array
.
'
,
function
()
{
jasmine
.
clock
().
install
();
$testArea
=
$
(
'
<select multiple="multiple" data-bind="selectedOptions: myValues, options: myOptions, multiselect: {numberDisplayed: 1}"></select>
'
).
appendTo
(
document
.
body
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment