~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to openstack-dashboard/dashboard/static/dashboard/js/bootstrap/tests/unit/bootstrap-alert.js

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-24 10:49:27 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120224104927-0v71grkyxtu106l4
Tags: 2012.1~e4~20120224.1386-0ubuntu1
New upstream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
$(function () {
2
 
 
3
 
    module("bootstrap-alerts")
4
 
 
5
 
      test("should be defined on jquery object", function () {
6
 
        ok($(document.body).alert, 'alert method is defined')
7
 
      })
8
 
 
9
 
      test("should return element", function () {
10
 
        ok($(document.body).alert()[0] == document.body, 'document.body returned')
11
 
      })
12
 
 
13
 
      test("should fade element out on clicking .close", function () {
14
 
        var alertHTML = '<div class="alert-message warning fade in">'
15
 
          + '<a class="close" href="#" data-dismiss="alert">×</a>'
16
 
          + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
17
 
          + '</div>'
18
 
          , alert = $(alertHTML).alert()
19
 
 
20
 
        alert.find('.close').click()
21
 
 
22
 
        ok(!alert.hasClass('in'), 'remove .in class on .close click')
23
 
      })
24
 
 
25
 
      test("should remove element when clicking .close", function () {
26
 
        $.support.transition = false
27
 
 
28
 
        var alertHTML = '<div class="alert-message warning fade in">'
29
 
          + '<a class="close" href="#" data-dismiss="alert">×</a>'
30
 
          + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
31
 
          + '</div>'
32
 
          , alert = $(alertHTML).appendTo('#qunit-fixture').alert()
33
 
 
34
 
        ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
35
 
 
36
 
        alert.find('.close').click()
37
 
 
38
 
        ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
39
 
      })
40
 
 
41
 
})
 
 
b'\\ No newline at end of file'