[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 $(function () { 2 3 module("bootstrap-modal") 4 5 test("should be defined on jquery object", function () { 6 var div = $("<div id='modal-test'></div>") 7 ok(div.modal, 'modal method is defined') 8 }) 9 10 test("should return element", function () { 11 var div = $("<div id='modal-test'></div>") 12 ok(div.modal() == div, 'document.body returned') 13 $('#modal-test').remove() 14 }) 15 16 test("should expose defaults var for settings", function () { 17 ok($.fn.modal.defaults, 'default object exposed') 18 }) 19 20 test("should insert into dom when show method is called", function () { 21 stop() 22 $.support.transition = false 23 $("<div id='modal-test'></div>") 24 .bind("shown", function () { 25 ok($('#modal-test').length, 'modal insterted into dom') 26 $(this).remove() 27 start() 28 }) 29 .modal("show") 30 }) 31 32 test("should hide modal when hide is called", function () { 33 stop() 34 $.support.transition = false 35 36 $("<div id='modal-test'></div>") 37 .bind("shown", function () { 38 ok($('#modal-test').is(":visible"), 'modal visible') 39 ok($('#modal-test').length, 'modal insterted into dom') 40 $(this).modal("hide") 41 }) 42 .bind("hidden", function() { 43 ok(!$('#modal-test').is(":visible"), 'modal hidden') 44 $('#modal-test').remove() 45 start() 46 }) 47 .modal("show") 48 }) 49 50 test("should toggle when toggle is called", function () { 51 stop() 52 $.support.transition = false 53 var div = $("<div id='modal-test'></div>") 54 div 55 .bind("shown", function () { 56 ok($('#modal-test').is(":visible"), 'modal visible') 57 ok($('#modal-test').length, 'modal insterted into dom') 58 div.modal("toggle") 59 }) 60 .bind("hidden", function() { 61 ok(!$('#modal-test').is(":visible"), 'modal hidden') 62 div.remove() 63 start() 64 }) 65 .modal("toggle") 66 }) 67 68 test("should remove from dom when click [data-dismiss=modal]", function () { 69 stop() 70 $.support.transition = false 71 var div = $("<div id='modal-test'><span class='close' data-dismiss='modal'></span></div>") 72 div 73 .bind("shown", function () { 74 ok($('#modal-test').is(":visible"), 'modal visible') 75 ok($('#modal-test').length, 'modal insterted into dom') 76 div.find('.close').click() 77 }) 78 .bind("hidden", function() { 79 ok(!$('#modal-test').is(":visible"), 'modal hidden') 80 div.remove() 81 start() 82 }) 83 .modal("toggle") 84 }) 85 })
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |