aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/alert.js
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-04-10 09:28:29 +0200
committerGitHub <[email protected]>2018-04-10 09:28:29 +0200
commit0871d69ec975b51472a451ed63ffa2af874606d2 (patch)
tree977e0bcbcde804c5a90da0fc28db41a6748b8b82 /js/tests/unit/alert.js
parent875ed0b975a587fffcc1b0c632e1cc8f612ebc5a (diff)
downloadbootstrap-0871d69ec975b51472a451ed63ffa2af874606d2.tar.xz
bootstrap-0871d69ec975b51472a451ed63ffa2af874606d2.zip
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
Diffstat (limited to 'js/tests/unit/alert.js')
-rw-r--r--js/tests/unit/alert.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js
index 165c91f1e..fc7727fb1 100644
--- a/js/tests/unit/alert.js
+++ b/js/tests/unit/alert.js
@@ -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()
+ }
+ })
})