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
dba44c83
Commit
dba44c83
authored
Apr 20, 2016
by
David Stutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests for clickable optgroups.
parent
b02c4736
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
6 deletions
+58
-6
bootstrap-multiselect.js
tests/spec/bootstrap-multiselect.js
+58
-6
No files found.
tests/spec/bootstrap-multiselect.js
View file @
dba44c83
...
@@ -317,18 +317,21 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
...
@@ -317,18 +317,21 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
var
i
=
0
;
var
i
=
0
;
$
(
'
#multiselect-container li.multiselect-group
'
).
each
(
function
()
{
$
(
'
#multiselect-container li.multiselect-group
'
).
each
(
function
()
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
10
);
$
(
'
label
'
,
$
(
this
)).
click
();
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
10
);
$
(
'
label
'
,
$
(
this
)).
click
()
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
0
);
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
0
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
0
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
0
);
$
(
'
label
'
,
$
(
this
)).
click
()
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
10
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
10
);
}
}
else
{
else
{
$
(
'
label
'
,
$
(
this
)).
click
();
$
(
'
label
'
,
$
(
this
)).
click
();
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
10
);
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
i
]).
length
).
toBe
(
10
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
1
0
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
2
0
);
$
(
'
label
'
,
$
(
this
)).
click
();
$
(
'
label
'
,
$
(
this
)).
click
();
}
}
...
@@ -377,7 +380,7 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
...
@@ -377,7 +380,7 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
text
=
text
.
substr
(
0
,
text
.
length
-
2
);
text
=
text
.
substr
(
0
,
text
.
length
-
2
);
expect
(
$
(
'
#multiselect-container .multiselect-selected-text
'
).
text
()).
toBe
(
text
);
expect
(
$
(
'
#multiselect-container .multiselect-selected-text
'
).
text
()).
toBe
(
text
);
$
(
'
label
'
,
$
(
this
)).
click
()
$
(
'
label
'
,
$
(
this
)).
click
()
;
}
}
else
{
else
{
$
(
'
label
'
,
$
(
this
)).
click
();
$
(
'
label
'
,
$
(
this
)).
click
();
...
@@ -397,6 +400,55 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
...
@@ -397,6 +400,55 @@ describe('Bootstrap Multiselect "Clickable Optgroups"', function() {
});
});
});
});
it
(
'
Should be updated by clicking corresponding options.
'
,
function
()
{
for
(
var
i
=
1
;
i
<
10
;
i
++
)
{
expect
(
$
(
'
option:selected
'
,
$
(
'
#multiselect optgroup
'
)[
0
]).
length
).
toBe
(
10
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
10
);
var
$group
=
$
(
$
(
'
#multiselect-container li.multiselect-group
'
)[
i
]);
var
$optGroup
=
$
(
$
(
'
#multiselect optgroup
'
)[
i
]);
$group
.
nextUntil
(
'
li.multiselect-item
'
).
each
(
function
()
{
var
$input
=
$
(
'
input
'
,
this
);
$input
.
click
();
expect
(
$input
.
prop
(
'
checked
'
)).
toBe
(
true
);
});
expect
(
$
(
'
option:selected
'
,
$optGroup
).
length
).
toBe
(
10
);
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
20
);
expect
(
$
(
'
input
'
,
$group
).
prop
(
'
checked
'
)).
toBe
(
true
);
// Undo changes
$group
.
nextUntil
(
'
li.multiselect-item
'
).
each
(
function
()
{
var
$input
=
$
(
'
input
'
,
this
);
$input
.
click
();
expect
(
$input
.
prop
(
'
checked
'
)).
toBe
(
false
);
});
expect
(
$
(
'
#multiselect option:selected
'
).
length
).
toBe
(
10
);
expect
(
$
(
'
input
'
,
$group
).
prop
(
'
checked
'
)).
toBe
(
false
);
}
});
it
(
'
Should be updated through select/deselect.
'
,
function
()
{
var
values
=
[];
for
(
var
i
=
1
;
i
<
11
;
i
++
)
{
values
.
push
(
'
1-
'
+
i
)
}
var
$group
=
$
(
'
#multiselect-container li.multiselect-group
'
)[
0
];
$
(
'
#multiselect
'
).
multiselect
(
'
deselect
'
,
values
);
expect
(
$
(
'
input
'
,
$group
).
prop
(
'
checked
'
)).
toBe
(
false
);
$
(
'
#multiselect
'
).
multiselect
(
'
select
'
,
values
);
expect
(
$
(
'
input
'
,
$group
).
prop
(
'
checked
'
)).
toBe
(
true
);
});
afterEach
(
function
()
{
afterEach
(
function
()
{
$
(
'
#multiselect
'
).
multiselect
(
'
destroy
'
);
$
(
'
#multiselect
'
).
multiselect
(
'
destroy
'
);
$
(
'
#multiselect
'
).
remove
();
$
(
'
#multiselect
'
).
remove
();
...
...
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