mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +01:00
Allow for resetText of a button to be a falsey value; fixes #13466
This commit is contained in:
parent
cd95849794
commit
d8ee1ba9b6
@ -31,9 +31,9 @@
|
||||
|
||||
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
|
||||
setTimeout($.proxy(function () {
|
||||
|
@ -57,7 +57,27 @@ $(function () {
|
||||
start()
|
||||
}, 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 () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user