Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
80d4a51e
Commit
80d4a51e
authored
7 years ago
by
Alessandro Chitolina
Committed by
Johann-S
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
tab.js: do not remove fade class if there's no initial active pane
parent
544b3ee9
6 merge requests
!28721
Hot test
,
!27561
Adds font-weight-medium to font weight classes
,
!25494
web pack
,
!25326
Adjust examples
,
!23207
#22402 : modal: new autofocus & keyboardBtnNav options
,
!17021
v4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/src/tab.js
+4
-14
js/src/tab.js
js/tests/unit/tab.js
+33
-0
js/tests/unit/tab.js
with
37 additions
and
14 deletions
+37
-14
js/src/tab.js
+
4
-
14
View file @
80d4a51e
...
...
@@ -166,7 +166,6 @@ const Tab = (($) => {
const
complete
=
()
=>
this
.
_transitionComplete
(
element
,
active
,
isTransitioning
,
callback
)
...
...
@@ -174,19 +173,14 @@ const Tab = (($) => {
$
(
active
)
.
one
(
Util
.
TRANSITION_END
,
complete
)
.
emulateTransitionEnd
(
TRANSITION_DURATION
)
}
else
{
complete
()
}
if
(
active
)
{
$
(
active
).
removeClass
(
ClassName
.
SHOW
)
}
}
_transitionComplete
(
element
,
active
,
isTransitioning
,
callback
)
{
_transitionComplete
(
element
,
active
,
callback
)
{
if
(
active
)
{
$
(
active
).
removeClass
(
ClassName
.
ACTIVE
)
$
(
active
).
removeClass
(
`
${
ClassName
.
SHOW
}
${
ClassName
.
ACTIVE
}
`
)
const
dropdownChild
=
$
(
active
.
parentNode
).
find
(
Selector
.
DROPDOWN_ACTIVE_CHILD
...
...
@@ -206,12 +200,8 @@ const Tab = (($) => {
element
.
setAttribute
(
'
aria-selected
'
,
true
)
}
if
(
isTransitioning
)
{
Util
.
reflow
(
element
)
$
(
element
).
addClass
(
ClassName
.
SHOW
)
}
else
{
$
(
element
).
removeClass
(
ClassName
.
FADE
)
}
Util
.
reflow
(
element
)
$
(
element
).
addClass
(
ClassName
.
SHOW
)
if
(
element
.
parentNode
&&
$
(
element
.
parentNode
).
hasClass
(
ClassName
.
DROPDOWN_MENU
))
{
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/tab.js
+
33
-
0
View file @
80d4a51e
...
...
@@ -382,4 +382,37 @@ $(function () {
})
.
trigger
(
$
.
Event
(
'
click
'
))
})
QUnit
.
test
(
'
should not remove fade class if no active pane is present
'
,
function
(
assert
)
{
assert
.
expect
(
6
)
var
done
=
assert
.
async
()
var
tabsHTML
=
'
<ul class="nav nav-tabs" role="tablist">
'
+
'
<li class="nav-item"><a id="tab-home" href="#home" class="nav-link" data-toggle="tab" role="tab">Home</a></li>
'
+
'
<li class="nav-item"><a id="tab-profile" href="#profile" class="nav-link" data-toggle="tab" role="tab">Profile</a></li>
'
+
'
</ul>
'
+
'
<div class="tab-content">
'
+
'
<div class="tab-pane fade" id="home" role="tabpanel"></div>
'
+
'
<div class="tab-pane fade" id="profile" role="tabpanel"></div>
'
+
'
</div>
'
$
(
tabsHTML
).
appendTo
(
'
#qunit-fixture
'
)
$
(
'
#tab-profile
'
)
.
on
(
'
shown.bs.tab
'
,
function
()
{
assert
.
ok
(
$
(
'
#profile
'
).
hasClass
(
'
fade
'
))
assert
.
ok
(
$
(
'
#profile
'
).
hasClass
(
'
show
'
))
$
(
'
#tab-home
'
)
.
on
(
'
shown.bs.tab
'
,
function
()
{
assert
.
ok
(
$
(
'
#profile
'
).
hasClass
(
'
fade
'
))
assert
.
notOk
(
$
(
'
#profile
'
).
hasClass
(
'
show
'
))
assert
.
ok
(
$
(
'
#home
'
).
hasClass
(
'
fade
'
))
assert
.
ok
(
$
(
'
#home
'
).
hasClass
(
'
show
'
))
done
()
})
.
trigger
(
$
.
Event
(
'
click
'
))
})
.
trigger
(
$
.
Event
(
'
click
'
))
})
})
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
Menu
Explore
Projects
Groups
Snippets