aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/alert.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/alert.js')
-rw-r--r--js/tests/unit/alert.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js
index 140a14838..75ae2d2ef 100644
--- a/js/tests/unit/alert.js
+++ b/js/tests/unit/alert.js
@@ -1,35 +1,35 @@
$(function () {
'use strict';
- module('alert plugin')
+ QUnit.module('alert plugin')
- test('should be defined on jquery object', function () {
- ok($(document.body).alert, 'alert method is defined')
+ QUnit.test('should be defined on jquery object', function (assert) {
+ assert.ok($(document.body).alert, 'alert method is defined')
})
- module('alert', {
- setup: function () {
+ QUnit.module('alert', {
+ beforeEach: function () {
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$.fn.bootstrapAlert = $.fn.alert.noConflict()
},
- teardown: function () {
+ afterEach: function () {
$.fn.alert = $.fn.bootstrapAlert
delete $.fn.bootstrapAlert
}
})
- test('should provide no conflict', function () {
- strictEqual($.fn.alert, undefined, 'alert was set back to undefined (org value)')
+ QUnit.test('should provide no conflict', function (assert) {
+ assert.strictEqual($.fn.alert, undefined, 'alert was set back to undefined (org value)')
})
- test('should return jquery collection containing the element', function () {
+ QUnit.test('should return jquery collection containing the element', function (assert) {
var $el = $('<div/>')
var $alert = $el.bootstrapAlert()
- ok($alert instanceof $, 'returns jquery collection')
- strictEqual($alert[0], $el[0], 'collection contains element')
+ assert.ok($alert instanceof $, 'returns jquery collection')
+ assert.strictEqual($alert[0], $el[0], 'collection contains element')
})
- test('should fade element out on clicking .close', function () {
+ QUnit.test('should fade element out on clicking .close', function (assert) {
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>'
@@ -38,33 +38,33 @@ $(function () {
$alert.find('.close').click()
- equal($alert.hasClass('in'), false, 'remove .in class on .close click')
+ assert.strictEqual($alert.hasClass('in'), false, 'remove .in class on .close click')
})
- test('should remove element when clicking .close', function () {
+ QUnit.test('should remove element when clicking .close', function (assert) {
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>'
+ '</div>'
var $alert = $(alertHTML).appendTo('#qunit-fixture').bootstrapAlert()
- notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
+ assert.notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
$alert.find('.close').click()
- equal($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
+ assert.strictEqual($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
})
- test('should not fire closed when close is prevented', function (assert) {
+ QUnit.test('should not fire closed when close is prevented', function (assert) {
var done = assert.async()
$('<div class="alert"/>')
.on('close.bs.alert', function (e) {
e.preventDefault()
- ok(true, 'close event fired')
+ assert.ok(true, 'close event fired')
done()
})
.on('closed.bs.alert', function () {
- ok(false, 'closed event fired')
+ assert.ok(false, 'closed event fired')
})
.bootstrapAlert('close')
})