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
e7b5c4c1
Commit
e7b5c4c1
authored
10 years ago
by
Mark Otto
Browse files
Options
Download
Plain Diff
Merge branch 'master' of github.com:twbs/bootstrap
parents
2aedd274
b7028896
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/carousel.js
+1
-1
js/carousel.js
js/tests/unit/carousel.js
+22
-0
js/tests/unit/carousel.js
with
23 additions
and
1 deletion
+23
-1
js/carousel.js
+
1
-
1
View file @
e7b5c4c1
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
this
.
$active
=
this
.
$active
=
this
.
$items
=
null
this
.
$items
=
null
this
.
options
.
pause
==
'
hover
'
&&
this
.
$element
this
.
options
.
pause
==
'
hover
'
&&
!
(
'
ontouchstart
'
in
document
.
documentElement
)
&&
this
.
$element
.
on
(
'
mouseenter.bs.carousel
'
,
$
.
proxy
(
this
.
pause
,
this
))
.
on
(
'
mouseenter.bs.carousel
'
,
$
.
proxy
(
this
.
pause
,
this
))
.
on
(
'
mouseleave.bs.carousel
'
,
$
.
proxy
(
this
.
cycle
,
this
))
.
on
(
'
mouseleave.bs.carousel
'
,
$
.
proxy
(
this
.
cycle
,
this
))
}
}
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/carousel.js
+
22
-
0
View file @
e7b5c4c1
...
@@ -398,4 +398,26 @@ $(function () {
...
@@ -398,4 +398,26 @@ $(function () {
strictEqual
(
$template
.
find
(
'
.item
'
)[
1
],
$template
.
find
(
'
.active
'
)[
0
],
'
second item active
'
)
strictEqual
(
$template
.
find
(
'
.item
'
)[
1
],
$template
.
find
(
'
.active
'
)[
0
],
'
second item active
'
)
})
})
test
(
'
should only add mouseenter and mouseleave listeners when not on mobile
'
,
function
()
{
var
isMobile
=
'
ontouchstart
'
in
document
.
documentElement
var
templateHTML
=
'
<div id="myCarousel" class="carousel" data-interval="false" data-pause="hover">
'
+
'
<div class="carousel-inner">
'
+
'
<div id="first" class="item active">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
<div id="second" class="item">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
<div id="third" class="item">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
var
$template
=
$
(
templateHTML
).
bootstrapCarousel
()
$
.
each
([
'
mouseover
'
,
'
mouseout
'
],
function
(
i
,
type
)
{
strictEqual
(
type
in
$
.
_data
(
$template
[
0
],
'
events
'
),
!
isMobile
,
'
does
'
+
(
isMobile
?
'
not
'
:
''
)
+
'
listen for
'
+
type
+
'
events
'
)
})
})
})
})
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