2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

v4 improve coverage (#25945)

* Improve code coverage for our Button plugin

* improve coverage for our Alert plugin

* test tooltip update method

* test update and dispose for dropdown

* increase code coverage requirements
This commit is contained in:
Johann-S
2018-04-10 09:28:29 +02:00
committed by GitHub
parent 875ed0b975
commit 0871d69ec9
7 changed files with 214 additions and 7 deletions
+39
View File
@@ -80,4 +80,43 @@ $(function () {
})
.bootstrapAlert('close')
})
QUnit.test('close should use internal _element if no element provided', function (assert) {
assert.expect(1)
var done = assert.async()
var $el = $('<div/>')
var $alert = $el.bootstrapAlert()
var alertInstance = $alert.data('bs.alert')
$alert.one('closed.bs.alert', function () {
assert.ok('alert closed')
done()
})
alertInstance.close()
})
QUnit.test('dispose should remove data and the element', function (assert) {
assert.expect(2)
var $el = $('<div/>')
var $alert = $el.bootstrapAlert()
assert.ok(typeof $alert.data('bs.alert') !== 'undefined')
$alert.data('bs.alert').dispose()
assert.ok(typeof $alert.data('bs.button') === 'undefined')
})
QUnit.test('should return alert version', function (assert) {
assert.expect(1)
if (typeof Alert !== 'undefined') {
assert.ok(typeof Alert.VERSION === 'string')
} else {
assert.notOk()
}
})
})