Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
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
Commits
3d58b462
Commit
3d58b462
authored
Feb 18, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bootstrap-button toggle regression + tests
parent
7ec09d0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
docs/assets/bootstrap.zip
docs/assets/bootstrap.zip
+0
-0
docs/assets/js/bootstrap-button.js
docs/assets/js/bootstrap-button.js
+3
-1
js/bootstrap-button.js
js/bootstrap-button.js
+3
-1
js/tests/unit/bootstrap-button.js
js/tests/unit/bootstrap-button.js
+24
-1
No files found.
docs/assets/bootstrap.zip
View file @
3d58b462
No preview for this file type
docs/assets/js/bootstrap-button.js
View file @
3d58b462
...
...
@@ -91,7 +91,9 @@
$
(
function
()
{
$
(
'
body
'
).
on
(
'
click.button.data-api
'
,
'
[data-toggle^=button]
'
,
function
(
e
)
{
$
(
e
.
currentTarget
).
button
(
'
toggle
'
)
var
$btn
=
$
(
e
.
target
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
$btn
.
button
(
'
toggle
'
)
})
})
...
...
js/bootstrap-button.js
View file @
3d58b462
...
...
@@ -91,7 +91,9 @@
$
(
function
()
{
$
(
'
body
'
).
on
(
'
click.button.data-api
'
,
'
[data-toggle^=button]
'
,
function
(
e
)
{
$
(
e
.
currentTarget
).
button
(
'
toggle
'
)
var
$btn
=
$
(
e
.
target
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
$btn
.
button
(
'
toggle
'
)
})
})
...
...
js/tests/unit/bootstrap-button.js
View file @
3d58b462
...
...
@@ -45,10 +45,33 @@ $(function () {
})
test
(
"
should toggle active
"
,
function
()
{
var
btn
=
$
(
'
<button class="btn"
data-loading-text="fat"
>mdo</button>
'
)
var
btn
=
$
(
'
<button class="btn">mdo</button>
'
)
ok
(
!
btn
.
hasClass
(
'
active
'
),
'
btn does not have active class
'
)
btn
.
button
(
'
toggle
'
)
ok
(
btn
.
hasClass
(
'
active
'
),
'
btn has class active
'
)
})
test
(
"
should toggle active when btn children are clicked
"
,
function
()
{
var
btn
=
$
(
'
<button class="btn" data-toggle="button">mdo</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
btn
.
append
(
inner
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
ok
(
!
btn
.
hasClass
(
'
active
'
),
'
btn does not have active class
'
)
inner
.
click
()
ok
(
btn
.
hasClass
(
'
active
'
),
'
btn has class active
'
)
})
test
(
"
should toggle active when btn children are clicked within btn-group
"
,
function
()
{
var
btngroup
=
$
(
'
<div class="btn-group" data-toggle="buttons-checkbox"></div>
'
)
,
btn
=
$
(
'
<button class="btn">fat</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
btngroup
.
append
(
btn
.
append
(
inner
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
ok
(
!
btn
.
hasClass
(
'
active
'
),
'
btn does not have active class
'
)
inner
.
click
()
ok
(
btn
.
hasClass
(
'
active
'
),
'
btn has class active
'
)
})
})
\ No newline at end of file
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