Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
60e51bc9
Commit
60e51bc9
authored
8 years ago
by
Mark Otto
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #18847 from Johann-S/fix18824
Fix bug multiple accordions collapse
parents
b0d61474
9bc7de93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/src/collapse.js
+1
-1
js/src/collapse.js
js/tests/unit/collapse.js
+23
-0
js/tests/unit/collapse.js
with
24 additions
and
1 deletion
+24
-1
js/src/collapse.js
+
1
-
1
View file @
60e51bc9
...
@@ -121,7 +121,7 @@ const Collapse = (($) => {
...
@@ -121,7 +121,7 @@ const Collapse = (($) => {
let
activesData
let
activesData
if
(
this
.
_parent
)
{
if
(
this
.
_parent
)
{
actives
=
$
.
makeArray
(
$
(
Selector
.
ACTIVES
))
actives
=
$
.
makeArray
(
$
(
this
.
_parent
).
find
(
Selector
.
ACTIVES
))
if
(
!
actives
.
length
)
{
if
(
!
actives
.
length
)
{
actives
=
null
actives
=
null
}
}
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/collapse.js
+
23
-
0
View file @
60e51bc9
...
@@ -52,6 +52,29 @@ $(function () {
...
@@ -52,6 +52,29 @@ $(function () {
assert
.
ok
(
!
/height/i
.
test
(
$el
.
attr
(
'
style
'
)),
'
has height reset
'
)
assert
.
ok
(
!
/height/i
.
test
(
$el
.
attr
(
'
style
'
)),
'
has height reset
'
)
})
})
QUnit
.
test
(
'
should collapse only the first collapse
'
,
function
(
assert
)
{
assert
.
expect
(
2
)
var
html
=
[
'
<div class="panel-group" id="accordion1">
'
,
'
<div class="panel">
'
,
'
<div id="collapse1" class="collapse"/>
'
,
'
</div>
'
,
'
</div>
'
,
'
<div class="panel-group" id="accordion2">
'
,
'
<div class="panel">
'
,
'
<div id="collapse2" class="collapse in"/>
'
,
'
</div>
'
,
'
</div>
'
].
join
(
''
)
$
(
html
).
appendTo
(
'
#qunit-fixture
'
)
var
$el1
=
$
(
'
#collapse1
'
)
var
$el2
=
$
(
'
#collapse2
'
)
$el1
.
bootstrapCollapse
(
'
show
'
)
assert
.
ok
(
$el1
.
hasClass
(
'
in
'
))
assert
.
ok
(
$el2
.
hasClass
(
'
in
'
))
})
QUnit
.
test
(
'
should hide a collapsed element
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should hide a collapsed element
'
,
function
(
assert
)
{
assert
.
expect
(
1
)
assert
.
expect
(
1
)
var
$el
=
$
(
'
<div class="collapse"/>
'
).
bootstrapCollapse
(
'
hide
'
)
var
$el
=
$
(
'
<div class="collapse"/>
'
).
bootstrapCollapse
(
'
hide
'
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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