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
73154d03
Commit
73154d03
authored
8 years ago
by
Mark Otto
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #20467 from maxbeatty/v4-dev-17754
add support for ol in tab plugin
parents
60e51bc9
dc1b4e78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/src/tab.js
+5
-5
js/src/tab.js
js/tests/unit/tab.js
+16
-0
js/tests/unit/tab.js
with
21 additions
and
5 deletions
+21
-5
js/src/tab.js
+
5
-
5
View file @
73154d03
...
...
@@ -44,7 +44,7 @@ const Tab = (($) => {
A
:
'
a
'
,
LI
:
'
li
'
,
DROPDOWN
:
'
.dropdown
'
,
UL
:
'
ul:not(.dropdown-menu)
'
,
LIST
:
'
ul:not(.dropdown-menu)
, ol:not(.dropdown-menu)
'
,
FADE_CHILD
:
'
> .nav-item .fade, > .fade
'
,
ACTIVE
:
'
.active
'
,
ACTIVE_CHILD
:
'
> .nav-item > .active, > .active
'
,
...
...
@@ -85,11 +85,11 @@ const Tab = (($) => {
let
target
let
previous
let
u
lElement
=
$
(
this
.
_element
).
closest
(
Selector
.
U
L
)[
0
]
let
l
ist
Element
=
$
(
this
.
_element
).
closest
(
Selector
.
L
IST
)[
0
]
let
selector
=
Util
.
getSelectorFromElement
(
this
.
_element
)
if
(
u
lElement
)
{
previous
=
$
.
makeArray
(
$
(
u
lElement
).
find
(
Selector
.
ACTIVE
))
if
(
l
ist
Element
)
{
previous
=
$
.
makeArray
(
$
(
l
ist
Element
).
find
(
Selector
.
ACTIVE
))
previous
=
previous
[
previous
.
length
-
1
]
}
...
...
@@ -118,7 +118,7 @@ const Tab = (($) => {
this
.
_activate
(
this
.
_element
,
u
lElement
l
ist
Element
)
let
complete
=
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/tab.js
+
16
-
0
View file @
73154d03
...
...
@@ -76,6 +76,22 @@ $(function () {
assert
.
strictEqual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
QUnit
.
test
(
'
should activate element by tab id in ordered list
'
,
function
(
assert
)
{
assert
.
expect
(
2
)
var
pillsHTML
=
'
<ol class="pills">
'
+
'
<li><a href="#home">Home</a></li>
'
+
'
<li><a href="#profile">Profile</a></li>
'
+
'
</ol>
'
$
(
'
<ol><li id="home"/><li id="profile"/></ol>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
pillsHTML
).
find
(
'
li:last a
'
).
bootstrapTab
(
'
show
'
)
assert
.
strictEqual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
$
(
pillsHTML
).
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
assert
.
strictEqual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
QUnit
.
test
(
'
should not fire shown when show is prevented
'
,
function
(
assert
)
{
assert
.
expect
(
1
)
var
done
=
assert
.
async
()
...
...
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