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

[Fixes #15953] Implement assert.expect in each unit test

[Fixes #15953] Implement `assert.expect` in each unit test
This commit is contained in:
Kevin Kirsche
2015-03-01 09:33:48 -05:00
parent 4311e09b04
commit 4febcb4b49
12 changed files with 198 additions and 4 deletions
+6
View File
@@ -4,6 +4,7 @@ $(function () {
QUnit.module('alert plugin')
QUnit.test('should be defined on jquery object', function (assert) {
assert.expect(1)
assert.ok($(document.body).alert, 'alert method is defined')
})
@@ -19,10 +20,12 @@ $(function () {
})
QUnit.test('should provide no conflict', function (assert) {
assert.expect(1)
assert.strictEqual($.fn.alert, undefined, 'alert was set back to undefined (org value)')
})
QUnit.test('should return jquery collection containing the element', function (assert) {
assert.expect(2)
var $el = $('<div/>')
var $alert = $el.bootstrapAlert()
assert.ok($alert instanceof $, 'returns jquery collection')
@@ -30,6 +33,7 @@ $(function () {
})
QUnit.test('should fade element out on clicking .close', function (assert) {
assert.expect(1)
var alertHTML = '<div class="alert alert-danger fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
@@ -42,6 +46,7 @@ $(function () {
})
QUnit.test('should remove element when clicking .close', function (assert) {
assert.expect(2)
var alertHTML = '<div class="alert alert-danger fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
@@ -56,6 +61,7 @@ $(function () {
})
QUnit.test('should not fire closed when close is prevented', function (assert) {
assert.expect(1)
var done = assert.async()
$('<div class="alert"/>')
.on('close.bs.alert', function (e) {