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
d8ee1ba9
Commit
d8ee1ba9
authored
May 05, 2014
by
Heinrich Fenkart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow for resetText of a button to be a falsey value; fixes #13466
parent
cd958497
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
js/button.js
js/button.js
+2
-2
js/tests/unit/button.js
js/tests/unit/button.js
+20
-0
No files found.
js/button.js
View file @
d8ee1ba9
...
@@ -31,9 +31,9 @@
...
@@ -31,9 +31,9 @@
state
=
state
+
'
Text
'
state
=
state
+
'
Text
'
if
(
!
data
.
resetText
)
$el
.
data
(
'
resetText
'
,
$el
[
val
]())
if
(
data
.
resetText
==
null
)
$el
.
data
(
'
resetText
'
,
$el
[
val
]())
$el
[
val
](
data
[
state
]
||
this
.
options
[
state
])
$el
[
val
](
data
[
state
]
==
null
?
this
.
options
[
state
]
:
data
[
state
])
// push to event loop to allow forms to submit
// push to event loop to allow forms to submit
setTimeout
(
$
.
proxy
(
function
()
{
setTimeout
(
$
.
proxy
(
function
()
{
...
...
js/tests/unit/button.js
View file @
d8ee1ba9
...
@@ -57,7 +57,27 @@ $(function () {
...
@@ -57,7 +57,27 @@ $(function () {
start
()
start
()
},
0
)
},
0
)
},
0
)
},
0
)
})
test
(
'
should work with an empty string as reset state
'
,
function
()
{
var
btn
=
$
(
'
<button class="btn" data-loading-text="fat"></button>
'
)
equal
(
btn
.
html
(),
''
,
'
btn text equals ""
'
)
btn
.
bootstrapButton
(
'
loading
'
)
equal
(
btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
stop
()
setTimeout
(
function
()
{
ok
(
btn
.
attr
(
'
disabled
'
),
'
btn is disabled
'
)
ok
(
btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
start
()
stop
()
btn
.
bootstrapButton
(
'
reset
'
)
equal
(
btn
.
html
(),
''
,
'
btn text equals ""
'
)
setTimeout
(
function
()
{
ok
(
!
btn
.
attr
(
'
disabled
'
),
'
btn is not disabled
'
)
ok
(
!
btn
.
hasClass
(
'
disabled
'
),
'
btn does not have disabled class
'
)
start
()
},
0
)
},
0
)
})
})
test
(
'
should toggle active
'
,
function
()
{
test
(
'
should toggle active
'
,
function
()
{
...
...
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