twigg-app 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/data/quips.yml +45 -0
  3. data/lib/twigg-app/app/quips.rb +13 -0
  4. data/lib/twigg-app/app/routes.rb +43 -0
  5. data/lib/twigg-app/app/server.rb +146 -0
  6. data/lib/twigg-app/app/version.rb +5 -0
  7. data/lib/twigg-app/app.rb +14 -0
  8. data/lib/twigg-app.rb +5 -0
  9. data/public/application.js +106 -0
  10. data/public/favicon.ico +0 -0
  11. data/public/favicon.png +0 -0
  12. data/public/vendor/bootstrap/CNAME +1 -0
  13. data/public/vendor/bootstrap/CONTRIBUTING.md +66 -0
  14. data/public/vendor/bootstrap/Gruntfile.js +195 -0
  15. data/public/vendor/bootstrap/LICENSE +176 -0
  16. data/public/vendor/bootstrap/README.md +139 -0
  17. data/public/vendor/bootstrap/_config.yml +28 -0
  18. data/public/vendor/bootstrap/_includes/ads.html +1 -0
  19. data/public/vendor/bootstrap/_includes/footer.html +33 -0
  20. data/public/vendor/bootstrap/_includes/header.html +43 -0
  21. data/public/vendor/bootstrap/_includes/nav-components.html +135 -0
  22. data/public/vendor/bootstrap/_includes/nav-css.html +77 -0
  23. data/public/vendor/bootstrap/_includes/nav-customize.html +40 -0
  24. data/public/vendor/bootstrap/_includes/nav-getting-started.html +28 -0
  25. data/public/vendor/bootstrap/_includes/nav-javascript.html +88 -0
  26. data/public/vendor/bootstrap/_includes/nav-main.html +32 -0
  27. data/public/vendor/bootstrap/_includes/old-bs-docs.html +8 -0
  28. data/public/vendor/bootstrap/_includes/social-buttons.html +16 -0
  29. data/public/vendor/bootstrap/_layouts/customize.html +52 -0
  30. data/public/vendor/bootstrap/_layouts/default.html +72 -0
  31. data/public/vendor/bootstrap/_layouts/home.html +43 -0
  32. data/public/vendor/bootstrap/assets/css/docs.css +896 -0
  33. data/public/vendor/bootstrap/assets/css/pygments-manni.css +66 -0
  34. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  35. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  36. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  37. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  38. data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
  39. data/public/vendor/bootstrap/assets/js/application.js +82 -0
  40. data/public/vendor/bootstrap/assets/js/customizer.js +175 -0
  41. data/public/vendor/bootstrap/assets/js/holder.js +419 -0
  42. data/public/vendor/bootstrap/assets/js/html5shiv.js +8 -0
  43. data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +1287 -0
  44. data/public/vendor/bootstrap/assets/js/jquery.js +5 -0
  45. data/public/vendor/bootstrap/assets/js/jszip.js +1425 -0
  46. data/public/vendor/bootstrap/assets/js/less.js +9 -0
  47. data/public/vendor/bootstrap/assets/js/respond.min.js +6 -0
  48. data/public/vendor/bootstrap/assets/js/uglify.js +14 -0
  49. data/public/vendor/bootstrap/bower.json +11 -0
  50. data/public/vendor/bootstrap/browserstack.json +37 -0
  51. data/public/vendor/bootstrap/components.html +2555 -0
  52. data/public/vendor/bootstrap/composer.json +20 -0
  53. data/public/vendor/bootstrap/css.html +2276 -0
  54. data/public/vendor/bootstrap/customize.html +1480 -0
  55. data/public/vendor/bootstrap/dist/css/bootstrap.css +5579 -0
  56. data/public/vendor/bootstrap/dist/css/bootstrap.min.css +9 -0
  57. data/public/vendor/bootstrap/dist/js/bootstrap.js +1993 -0
  58. data/public/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
  59. data/public/vendor/bootstrap/getting-started.html +375 -0
  60. data/public/vendor/bootstrap/index.html +16 -0
  61. data/public/vendor/bootstrap/javascript.html +1904 -0
  62. data/public/vendor/bootstrap/js/affix.js +126 -0
  63. data/public/vendor/bootstrap/js/alert.js +98 -0
  64. data/public/vendor/bootstrap/js/button.js +109 -0
  65. data/public/vendor/bootstrap/js/carousel.js +217 -0
  66. data/public/vendor/bootstrap/js/collapse.js +179 -0
  67. data/public/vendor/bootstrap/js/dropdown.js +154 -0
  68. data/public/vendor/bootstrap/js/modal.js +244 -0
  69. data/public/vendor/bootstrap/js/popover.js +117 -0
  70. data/public/vendor/bootstrap/js/scrollspy.js +158 -0
  71. data/public/vendor/bootstrap/js/tab.js +135 -0
  72. data/public/vendor/bootstrap/js/tests/index.html +52 -0
  73. data/public/vendor/bootstrap/js/tests/phantom.js +63 -0
  74. data/public/vendor/bootstrap/js/tests/server.js +14 -0
  75. data/public/vendor/bootstrap/js/tests/unit/affix.js +25 -0
  76. data/public/vendor/bootstrap/js/tests/unit/alert.js +62 -0
  77. data/public/vendor/bootstrap/js/tests/unit/button.js +116 -0
  78. data/public/vendor/bootstrap/js/tests/unit/carousel.js +87 -0
  79. data/public/vendor/bootstrap/js/tests/unit/collapse.js +164 -0
  80. data/public/vendor/bootstrap/js/tests/unit/dropdown.js +219 -0
  81. data/public/vendor/bootstrap/js/tests/unit/modal.js +177 -0
  82. data/public/vendor/bootstrap/js/tests/unit/phantom.js +69 -0
  83. data/public/vendor/bootstrap/js/tests/unit/popover.js +133 -0
  84. data/public/vendor/bootstrap/js/tests/unit/scrollspy.js +37 -0
  85. data/public/vendor/bootstrap/js/tests/unit/tab.js +86 -0
  86. data/public/vendor/bootstrap/js/tests/unit/tooltip.js +437 -0
  87. data/public/vendor/bootstrap/js/tests/unit/transition.js +13 -0
  88. data/public/vendor/bootstrap/js/tests/vendor/jquery.js +5 -0
  89. data/public/vendor/bootstrap/js/tests/vendor/qunit.css +232 -0
  90. data/public/vendor/bootstrap/js/tests/vendor/qunit.js +1510 -0
  91. data/public/vendor/bootstrap/js/tooltip.js +382 -0
  92. data/public/vendor/bootstrap/js/transition.js +56 -0
  93. data/public/vendor/bootstrap/less/alerts.less +71 -0
  94. data/public/vendor/bootstrap/less/badges.less +51 -0
  95. data/public/vendor/bootstrap/less/bootstrap.less +63 -0
  96. data/public/vendor/bootstrap/less/breadcrumbs.less +23 -0
  97. data/public/vendor/bootstrap/less/button-groups.less +244 -0
  98. data/public/vendor/bootstrap/less/buttons.less +159 -0
  99. data/public/vendor/bootstrap/less/carousel.less +204 -0
  100. data/public/vendor/bootstrap/less/close.less +33 -0
  101. data/public/vendor/bootstrap/less/code.less +56 -0
  102. data/public/vendor/bootstrap/less/component-animations.less +29 -0
  103. data/public/vendor/bootstrap/less/dropdowns.less +176 -0
  104. data/public/vendor/bootstrap/less/forms.less +332 -0
  105. data/public/vendor/bootstrap/less/grid.less +340 -0
  106. data/public/vendor/bootstrap/less/input-groups.less +127 -0
  107. data/public/vendor/bootstrap/less/jumbotron.less +29 -0
  108. data/public/vendor/bootstrap/less/labels.less +54 -0
  109. data/public/vendor/bootstrap/less/list-group.less +88 -0
  110. data/public/vendor/bootstrap/less/media.less +56 -0
  111. data/public/vendor/bootstrap/less/mixins.less +693 -0
  112. data/public/vendor/bootstrap/less/modals.less +133 -0
  113. data/public/vendor/bootstrap/less/navbar.less +559 -0
  114. data/public/vendor/bootstrap/less/navs.less +228 -0
  115. data/public/vendor/bootstrap/less/normalize.less +396 -0
  116. data/public/vendor/bootstrap/less/pager.less +55 -0
  117. data/public/vendor/bootstrap/less/pagination.less +72 -0
  118. data/public/vendor/bootstrap/less/panels.less +128 -0
  119. data/public/vendor/bootstrap/less/popovers.less +133 -0
  120. data/public/vendor/bootstrap/less/print.less +100 -0
  121. data/public/vendor/bootstrap/less/progress-bars.less +99 -0
  122. data/public/vendor/bootstrap/less/responsive-utilities.less +149 -0
  123. data/public/vendor/bootstrap/less/scaffolding.less +111 -0
  124. data/public/vendor/bootstrap/less/tables.less +211 -0
  125. data/public/vendor/bootstrap/less/thumbnails.less +42 -0
  126. data/public/vendor/bootstrap/less/tooltip.less +95 -0
  127. data/public/vendor/bootstrap/less/type.less +238 -0
  128. data/public/vendor/bootstrap/less/utilities.less +42 -0
  129. data/public/vendor/bootstrap/less/variables.less +607 -0
  130. data/public/vendor/bootstrap/less/wells.less +29 -0
  131. data/public/vendor/bootstrap/package.json +33 -0
  132. data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +3 -0
  133. data/public/vendor/bootstrap-glyphicons/CNAME +1 -0
  134. data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +54 -0
  135. data/public/vendor/bootstrap-glyphicons/LICENSE +19 -0
  136. data/public/vendor/bootstrap-glyphicons/README.md +61 -0
  137. data/public/vendor/bootstrap-glyphicons/_config.yml +12 -0
  138. data/public/vendor/bootstrap-glyphicons/composer.json +9 -0
  139. data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +2 -0
  140. data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +9 -0
  141. data/public/vendor/bootstrap-glyphicons/css/docs.css +160 -0
  142. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
  143. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
  144. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +175 -0
  145. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
  146. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
  147. data/public/vendor/bootstrap-glyphicons/index.html +255 -0
  148. data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +201 -0
  149. data/public/vendor/bootstrap-glyphicons/package.json +18 -0
  150. data/public/vendor/d3/LICENSE +26 -0
  151. data/public/vendor/d3/README.md +7 -0
  152. data/public/vendor/d3/bower.json +25 -0
  153. data/public/vendor/d3/d3.js +8810 -0
  154. data/public/vendor/d3/d3.min.js +5 -0
  155. data/public/vendor/jquery/README.md +11 -0
  156. data/public/vendor/jquery/bower.json +11 -0
  157. data/public/vendor/jquery/component.json +15 -0
  158. data/public/vendor/jquery/composer.json +35 -0
  159. data/public/vendor/jquery/jquery-migrate.js +511 -0
  160. data/public/vendor/jquery/jquery-migrate.min.js +3 -0
  161. data/public/vendor/jquery/jquery.js +8829 -0
  162. data/public/vendor/jquery/jquery.min.js +6 -0
  163. data/public/vendor/jquery/jquery.min.map +1 -0
  164. data/public/vendor/jquery/package.json +7 -0
  165. data/public/vendor/replacejs/CHANGELOG.md +3 -0
  166. data/public/vendor/replacejs/MIT-LICENSE.txt +20 -0
  167. data/public/vendor/replacejs/README.md +123 -0
  168. data/public/vendor/replacejs/bower.json +24 -0
  169. data/public/vendor/replacejs/primer.js +17 -0
  170. data/public/vendor/replacejs/primer.min.js +1 -0
  171. data/public/vendor/replacejs/replace.js +182 -0
  172. data/public/vendor/stupidtable.js +158 -0
  173. data/views/dashboard.haml +17 -0
  174. data/views/layout.haml +60 -0
  175. metadata +330 -0
@@ -0,0 +1,87 @@
1
+ $(function () {
2
+
3
+ module("carousel")
4
+
5
+ test("should provide no conflict", function () {
6
+ var carousel = $.fn.carousel.noConflict()
7
+ ok(!$.fn.carousel, 'carousel was set back to undefined (org value)')
8
+ $.fn.carousel = carousel
9
+ })
10
+
11
+ test("should be defined on jquery object", function () {
12
+ ok($(document.body).carousel, 'carousel method is defined')
13
+ })
14
+
15
+ test("should return element", function () {
16
+ ok($(document.body).carousel()[0] == document.body, 'document.body returned')
17
+ })
18
+
19
+ test("should not fire sliden when slide is prevented", function () {
20
+ $.support.transition = false
21
+ stop()
22
+ $('<div class="carousel"/>')
23
+ .on('slide.bs.carousel', function (e) {
24
+ e.preventDefault();
25
+ ok(true);
26
+ start();
27
+ })
28
+ .on('slid.bs.carousel', function () {
29
+ ok(false);
30
+ })
31
+ .carousel('next')
32
+ })
33
+
34
+ test("should fire slide event with direction", function () {
35
+ var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
36
+ $.support.transition = false
37
+ stop()
38
+ $(template).on('slide.bs.carousel', function (e) {
39
+ e.preventDefault()
40
+ ok(e.direction)
41
+ ok(e.direction === 'right' || e.direction === 'left')
42
+ start()
43
+ }).carousel('next')
44
+ })
45
+
46
+ test("should fire slide event with relatedTarget", function () {
47
+ var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
48
+ $.support.transition = false
49
+ stop()
50
+ $(template)
51
+ .on('slide.bs.carousel', function (e) {
52
+ e.preventDefault();
53
+ ok(e.relatedTarget);
54
+ ok($(e.relatedTarget).hasClass('item'));
55
+ start();
56
+ })
57
+ .carousel('next')
58
+ })
59
+
60
+ test("should set interval from data attribute", 4, function () {
61
+ var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>');
62
+ template.attr("data-interval", 1814);
63
+
64
+ template.appendTo("body");
65
+ $('[data-slide]').first().click();
66
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814);
67
+ $('#myCarousel').remove();
68
+
69
+ template.appendTo("body").attr("data-modal", "foobar");
70
+ $('[data-slide]').first().click();
71
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "even if there is an data-modal attribute set");
72
+ $('#myCarousel').remove();
73
+
74
+ template.appendTo("body");
75
+ $('[data-slide]').first().click();
76
+ $('#myCarousel').attr('data-interval', 1860);
77
+ $('[data-slide]').first().click();
78
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "attributes should be read only on intitialization");
79
+ $('#myCarousel').remove();
80
+
81
+ template.attr("data-interval", false);
82
+ template.appendTo("body");
83
+ $('#myCarousel').carousel(1);
84
+ ok($('#myCarousel').data('bs.carousel').options.interval === false, "data attribute has higher priority than default options");
85
+ $('#myCarousel').remove();
86
+ })
87
+ })
@@ -0,0 +1,164 @@
1
+ $(function () {
2
+
3
+ module("collapse")
4
+
5
+ test("should provide no conflict", function () {
6
+ var collapse = $.fn.collapse.noConflict()
7
+ ok(!$.fn.collapse, 'collapse was set back to undefined (org value)')
8
+ $.fn.collapse = collapse
9
+ })
10
+
11
+ test("should be defined on jquery object", function () {
12
+ ok($(document.body).collapse, 'collapse method is defined')
13
+ })
14
+
15
+ test("should return element", function () {
16
+ ok($(document.body).collapse()[0] == document.body, 'document.body returned')
17
+ })
18
+
19
+ test("should show a collapsed element", function () {
20
+ var el = $('<div class="collapse"></div>').collapse('show')
21
+ ok(el.hasClass('in'), 'has class in')
22
+ ok(/height/.test(el.attr('style')), 'has height set')
23
+ })
24
+
25
+ test("should hide a collapsed element", function () {
26
+ var el = $('<div class="collapse"></div>').collapse('hide')
27
+ ok(!el.hasClass('in'), 'does not have class in')
28
+ ok(/height/.test(el.attr('style')), 'has height set')
29
+ })
30
+
31
+ test("should not fire shown when show is prevented", function () {
32
+ $.support.transition = false
33
+ stop()
34
+ $('<div class="collapse"/>')
35
+ .on('show.bs.collapse', function (e) {
36
+ e.preventDefault();
37
+ ok(true);
38
+ start();
39
+ })
40
+ .on('shown.bs.collapse', function () {
41
+ ok(false);
42
+ })
43
+ .collapse('show')
44
+ })
45
+
46
+ test("should reset style to auto after finishing opening collapse", function () {
47
+ $.support.transition = false
48
+ stop()
49
+ $('<div class="collapse" style="height: 0px"/>')
50
+ .on('show.bs.collapse', function () {
51
+ ok(this.style.height == '0px')
52
+ })
53
+ .on('shown.bs.collapse', function () {
54
+ ok(this.style.height == 'auto')
55
+ start()
56
+ })
57
+ .collapse('show')
58
+ })
59
+
60
+ test("should add active class to target when collapse shown", function () {
61
+ $.support.transition = false
62
+ stop()
63
+
64
+ var target = $('<a data-toggle="collapse" href="#test1"></a>')
65
+ .appendTo($('#qunit-fixture'))
66
+
67
+ var collapsible = $('<div id="test1"></div>')
68
+ .appendTo($('#qunit-fixture'))
69
+ .on('show.bs.collapse', function () {
70
+ ok(!target.hasClass('collapsed'))
71
+ start()
72
+ })
73
+
74
+ target.click()
75
+ })
76
+
77
+ test("should remove active class to target when collapse hidden", function () {
78
+ $.support.transition = false
79
+ stop()
80
+
81
+ var target = $('<a data-toggle="collapse" href="#test1"></a>')
82
+ .appendTo($('#qunit-fixture'))
83
+
84
+ var collapsible = $('<div id="test1" class="in"></div>')
85
+ .appendTo($('#qunit-fixture'))
86
+ .on('hide.bs.collapse', function () {
87
+ ok(target.hasClass('collapsed'))
88
+ start()
89
+ })
90
+
91
+ target.click()
92
+ })
93
+
94
+ test("should remove active class from inactive accordion targets", function () {
95
+ $.support.transition = false
96
+ stop()
97
+
98
+ var accordion = $('<div id="accordion"><div class="accordion-group"></div><div class="accordion-group"></div><div class="accordion-group"></div></div>')
99
+ .appendTo($('#qunit-fixture'))
100
+
101
+ var target1 = $('<a data-toggle="collapse" href="#body1" data-parent="#accordion"></a>')
102
+ .appendTo(accordion.find('.accordion-group').eq(0))
103
+
104
+ var collapsible1 = $('<div id="body1" class="in"></div>')
105
+ .appendTo(accordion.find('.accordion-group').eq(0))
106
+
107
+ var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent="#accordion"></a>')
108
+ .appendTo(accordion.find('.accordion-group').eq(1))
109
+
110
+ var collapsible2 = $('<div id="body2"></div>')
111
+ .appendTo(accordion.find('.accordion-group').eq(1))
112
+
113
+ var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent="#accordion"></a>')
114
+ .appendTo(accordion.find('.accordion-group').eq(2))
115
+
116
+ var collapsible3 = $('<div id="body3"></div>')
117
+ .appendTo(accordion.find('.accordion-group').eq(2))
118
+ .on('show.bs.collapse', function () {
119
+ ok(target1.hasClass('collapsed'))
120
+ ok(target2.hasClass('collapsed'))
121
+ ok(!target3.hasClass('collapsed'))
122
+
123
+ start()
124
+ })
125
+
126
+ target3.click()
127
+ })
128
+
129
+ test("should allow dots in data-parent", function () {
130
+ $.support.transition = false
131
+ stop()
132
+
133
+ var accordion = $('<div class="accordion"><div class="accordion-group"></div><div class="accordion-group"></div><div class="accordion-group"></div></div>')
134
+ .appendTo($('#qunit-fixture'))
135
+
136
+ var target1 = $('<a data-toggle="collapse" href="#body1" data-parent=".accordion"></a>')
137
+ .appendTo(accordion.find('.accordion-group').eq(0))
138
+
139
+ var collapsible1 = $('<div id="body1" class="in"></div>')
140
+ .appendTo(accordion.find('.accordion-group').eq(0))
141
+
142
+ var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent=".accordion"></a>')
143
+ .appendTo(accordion.find('.accordion-group').eq(1))
144
+
145
+ var collapsible2 = $('<div id="body2"></div>')
146
+ .appendTo(accordion.find('.accordion-group').eq(1))
147
+
148
+ var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent=".accordion"></a>')
149
+ .appendTo(accordion.find('.accordion-group').eq(2))
150
+
151
+ var collapsible3 = $('<div id="body3"></div>')
152
+ .appendTo(accordion.find('.accordion-group').eq(2))
153
+ .on('show.bs.collapse', function () {
154
+ ok(target1.hasClass('collapsed'))
155
+ ok(target2.hasClass('collapsed'))
156
+ ok(!target3.hasClass('collapsed'))
157
+
158
+ start()
159
+ })
160
+
161
+ target3.click()
162
+ })
163
+
164
+ })
@@ -0,0 +1,219 @@
1
+ $(function () {
2
+
3
+ module("dropdowns")
4
+
5
+ test("should provide no conflict", function () {
6
+ var dropdown = $.fn.dropdown.noConflict()
7
+ ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)')
8
+ $.fn.dropdown = dropdown
9
+ })
10
+
11
+ test("should be defined on jquery object", function () {
12
+ ok($(document.body).dropdown, 'dropdown method is defined')
13
+ })
14
+
15
+ test("should return element", function () {
16
+ var el = $("<div />")
17
+ ok(el.dropdown()[0] === el[0], 'same element returned')
18
+ })
19
+
20
+ test("should not open dropdown if target is disabled", function () {
21
+ var dropdownHTML = '<ul class="tabs">'
22
+ + '<li class="dropdown">'
23
+ + '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>'
24
+ + '<ul class="dropdown-menu">'
25
+ + '<li><a href="#">Secondary link</a></li>'
26
+ + '<li><a href="#">Something else here</a></li>'
27
+ + '<li class="divider"></li>'
28
+ + '<li><a href="#">Another link</a></li>'
29
+ + '</ul>'
30
+ + '</li>'
31
+ + '</ul>'
32
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
33
+
34
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
35
+ })
36
+
37
+ test("should not open dropdown if target is disabled", function () {
38
+ var dropdownHTML = '<ul class="tabs">'
39
+ + '<li class="dropdown">'
40
+ + '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>'
41
+ + '<ul class="dropdown-menu">'
42
+ + '<li><a href="#">Secondary link</a></li>'
43
+ + '<li><a href="#">Something else here</a></li>'
44
+ + '<li class="divider"></li>'
45
+ + '<li><a href="#">Another link</a></li>'
46
+ + '</ul>'
47
+ + '</li>'
48
+ + '</ul>'
49
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
50
+
51
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
52
+ })
53
+
54
+ test("should add class open to menu if clicked", function () {
55
+ var dropdownHTML = '<ul class="tabs">'
56
+ + '<li class="dropdown">'
57
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
58
+ + '<ul class="dropdown-menu">'
59
+ + '<li><a href="#">Secondary link</a></li>'
60
+ + '<li><a href="#">Something else here</a></li>'
61
+ + '<li class="divider"></li>'
62
+ + '<li><a href="#">Another link</a></li>'
63
+ + '</ul>'
64
+ + '</li>'
65
+ + '</ul>'
66
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
67
+
68
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
69
+ })
70
+
71
+ test("should test if element has a # before assuming it's a selector", function () {
72
+ var dropdownHTML = '<ul class="tabs">'
73
+ + '<li class="dropdown">'
74
+ + '<a href="/foo/" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
75
+ + '<ul class="dropdown-menu">'
76
+ + '<li><a href="#">Secondary link</a></li>'
77
+ + '<li><a href="#">Something else here</a></li>'
78
+ + '<li class="divider"></li>'
79
+ + '<li><a href="#">Another link</a></li>'
80
+ + '</ul>'
81
+ + '</li>'
82
+ + '</ul>'
83
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
84
+
85
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
86
+ })
87
+
88
+
89
+ test("should remove open class if body clicked", function () {
90
+ var dropdownHTML = '<ul class="tabs">'
91
+ + '<li class="dropdown">'
92
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
93
+ + '<ul class="dropdown-menu">'
94
+ + '<li><a href="#">Secondary link</a></li>'
95
+ + '<li><a href="#">Something else here</a></li>'
96
+ + '<li class="divider"></li>'
97
+ + '<li><a href="#">Another link</a></li>'
98
+ + '</ul>'
99
+ + '</li>'
100
+ + '</ul>'
101
+ , dropdown = $(dropdownHTML)
102
+ .appendTo('#qunit-fixture')
103
+ .find('[data-toggle="dropdown"]')
104
+ .dropdown()
105
+ .click()
106
+
107
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
108
+ $('body').click()
109
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
110
+ dropdown.remove()
111
+ })
112
+
113
+ test("should remove open class if body clicked, with multiple drop downs", function () {
114
+ var dropdownHTML =
115
+ '<ul class="nav">'
116
+ + ' <li><a href="#menu1">Menu 1</a></li>'
117
+ + ' <li class="dropdown" id="testmenu">'
118
+ + ' <a class="dropdown-toggle" data-toggle="dropdown" href="#testmenu">Test menu <b class="caret"></b></a>'
119
+ + ' <ul class="dropdown-menu" role="menu">'
120
+ + ' <li><a href="#sub1">Submenu 1</a></li>'
121
+ + ' </ul>'
122
+ + ' </li>'
123
+ + '</ul>'
124
+ + '<div class="btn-group">'
125
+ + ' <button class="btn">Actions</button>'
126
+ + ' <button class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>'
127
+ + ' <ul class="dropdown-menu">'
128
+ + ' <li><a href="#">Action 1</a></li>'
129
+ + ' </ul>'
130
+ + '</div>'
131
+ , dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]')
132
+ , first = dropdowns.first()
133
+ , last = dropdowns.last()
134
+
135
+ ok(dropdowns.length == 2, "Should be two dropdowns")
136
+
137
+ first.click()
138
+ ok(first.parents('.open').length == 1, 'open class added on click')
139
+ ok($('#qunit-fixture .open').length == 1, 'only one object is open')
140
+ $('body').click()
141
+ ok($("#qunit-fixture .open").length === 0, 'open class removed')
142
+
143
+ last.click()
144
+ ok(last.parent('.open').length == 1, 'open class added on click')
145
+ ok($('#qunit-fixture .open').length == 1, 'only one object is open')
146
+ $('body').click()
147
+ ok($("#qunit-fixture .open").length === 0, 'open class removed')
148
+
149
+ $("#qunit-fixture").html("")
150
+ })
151
+
152
+ test("should fire show and hide event", function () {
153
+ var dropdownHTML = '<ul class="tabs">'
154
+ + '<li class="dropdown">'
155
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
156
+ + '<ul class="dropdown-menu">'
157
+ + '<li><a href="#">Secondary link</a></li>'
158
+ + '<li><a href="#">Something else here</a></li>'
159
+ + '<li class="divider"></li>'
160
+ + '<li><a href="#">Another link</a></li>'
161
+ + '</ul>'
162
+ + '</li>'
163
+ + '</ul>'
164
+ , dropdown = $(dropdownHTML)
165
+ .appendTo('#qunit-fixture')
166
+ .find('[data-toggle="dropdown"]')
167
+ .dropdown()
168
+
169
+ stop()
170
+
171
+ dropdown
172
+ .parent('.dropdown')
173
+ .bind('show.bs.dropdown', function () {
174
+ ok(true, 'show was called')
175
+ })
176
+ .bind('hide.bs.dropdown', function () {
177
+ ok(true, 'hide was called')
178
+ start()
179
+ })
180
+
181
+ dropdown.click()
182
+ $(document.body).click()
183
+ })
184
+
185
+
186
+ test("should fire shown and hiden event", function () {
187
+ var dropdownHTML = '<ul class="tabs">'
188
+ + '<li class="dropdown">'
189
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
190
+ + '<ul class="dropdown-menu">'
191
+ + '<li><a href="#">Secondary link</a></li>'
192
+ + '<li><a href="#">Something else here</a></li>'
193
+ + '<li class="divider"></li>'
194
+ + '<li><a href="#">Another link</a></li>'
195
+ + '</ul>'
196
+ + '</li>'
197
+ + '</ul>'
198
+ , dropdown = $(dropdownHTML)
199
+ .appendTo('#qunit-fixture')
200
+ .find('[data-toggle="dropdown"]')
201
+ .dropdown()
202
+
203
+ stop()
204
+
205
+ dropdown
206
+ .parent('.dropdown')
207
+ .bind('shown.bs.dropdown', function () {
208
+ ok(true, 'show was called')
209
+ })
210
+ .bind('hidden.bs.dropdown', function () {
211
+ ok(true, 'hide was called')
212
+ start()
213
+ })
214
+
215
+ dropdown.click()
216
+ $(document.body).click()
217
+ })
218
+
219
+ })
@@ -0,0 +1,177 @@
1
+ $(function () {
2
+
3
+ module("modal")
4
+
5
+ test("should provide no conflict", function () {
6
+ var modal = $.fn.modal.noConflict()
7
+ ok(!$.fn.modal, 'modal was set back to undefined (org value)')
8
+ $.fn.modal = modal
9
+ })
10
+
11
+ test("should be defined on jquery object", function () {
12
+ var div = $("<div id='modal-test'></div>")
13
+ ok(div.modal, 'modal method is defined')
14
+ })
15
+
16
+ test("should return element", function () {
17
+ var div = $("<div id='modal-test'></div>")
18
+ ok(div.modal() == div, 'document.body returned')
19
+ $('#modal-test').remove()
20
+ })
21
+
22
+ test("should expose defaults var for settings", function () {
23
+ ok($.fn.modal.Constructor.DEFAULTS, 'default object exposed')
24
+ })
25
+
26
+ test("should insert into dom when show method is called", function () {
27
+ stop()
28
+ $.support.transition = false
29
+ $("<div id='modal-test'></div>")
30
+ .on("shown.bs.modal", function () {
31
+ ok($('#modal-test').length, 'modal inserted into dom')
32
+ $(this).remove()
33
+ start()
34
+ })
35
+ .modal("show")
36
+ })
37
+
38
+ test("should fire show event", function () {
39
+ stop()
40
+ $.support.transition = false
41
+ $("<div id='modal-test'></div>")
42
+ .on("show.bs.modal", function () {
43
+ ok(true, "show was called")
44
+ })
45
+ .on("shown.bs.modal", function () {
46
+ $(this).remove()
47
+ start()
48
+ })
49
+ .modal("show")
50
+ })
51
+
52
+ test("should not fire shown when default prevented", function () {
53
+ stop()
54
+ $.support.transition = false
55
+ $("<div id='modal-test'></div>")
56
+ .on("show.bs.modal", function (e) {
57
+ e.preventDefault()
58
+ ok(true, "show was called")
59
+ start()
60
+ })
61
+ .on("shown.bs.modal", function () {
62
+ ok(false, "shown was called")
63
+ })
64
+ .modal("show")
65
+ })
66
+
67
+ test("should hide modal when hide is called", function () {
68
+ stop()
69
+ $.support.transition = false
70
+
71
+ $("<div id='modal-test'></div>")
72
+ .on("shown.bs.modal", function () {
73
+ ok($('#modal-test').is(":visible"), 'modal visible')
74
+ ok($('#modal-test').length, 'modal inserted into dom')
75
+ $(this).modal("hide")
76
+ })
77
+ .on("hidden.bs.modal", function() {
78
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
79
+ $('#modal-test').remove()
80
+ start()
81
+ })
82
+ .modal("show")
83
+ })
84
+
85
+ test("should toggle when toggle is called", function () {
86
+ stop()
87
+ $.support.transition = false
88
+ var div = $("<div id='modal-test'></div>")
89
+ div
90
+ .on("shown.bs.modal", function () {
91
+ ok($('#modal-test').is(":visible"), 'modal visible')
92
+ ok($('#modal-test').length, 'modal inserted into dom')
93
+ div.modal("toggle")
94
+ })
95
+ .on("hidden.bs.modal", function() {
96
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
97
+ div.remove()
98
+ start()
99
+ })
100
+ .modal("toggle")
101
+ })
102
+
103
+ test("should remove from dom when click [data-dismiss=modal]", function () {
104
+ stop()
105
+ $.support.transition = false
106
+ var div = $("<div id='modal-test'><span class='close' data-dismiss='modal'></span></div>")
107
+ div
108
+ .on("shown.bs.modal", function () {
109
+ ok($('#modal-test').is(":visible"), 'modal visible')
110
+ ok($('#modal-test').length, 'modal inserted into dom')
111
+ div.find('.close').click()
112
+ })
113
+ .on("hidden.bs.modal", function() {
114
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
115
+ div.remove()
116
+ start()
117
+ })
118
+ .modal("toggle")
119
+ })
120
+
121
+ test("should allow modal close with 'backdrop:false'", function () {
122
+ stop()
123
+ $.support.transition = false
124
+ var div = $("<div>", { id: 'modal-test', "data-backdrop": false })
125
+ div
126
+ .on("shown.bs.modal", function () {
127
+ ok($('#modal-test').is(":visible"), 'modal visible')
128
+ div.modal("hide")
129
+ })
130
+ .on("hidden.bs.modal", function() {
131
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
132
+ div.remove()
133
+ start()
134
+ })
135
+ .modal("show")
136
+ })
137
+
138
+ test("should close modal when clicking outside of modal-content", function () {
139
+ stop()
140
+ $.support.transition = false
141
+ var div = $("<div id='modal-test'><div class='contents'></div></div>")
142
+ div
143
+ .bind("shown.bs.modal", function () {
144
+ ok($('#modal-test').length, 'modal insterted into dom')
145
+ $('.contents').click()
146
+ ok($('#modal-test').is(":visible"), 'modal visible')
147
+ $('#modal-test').click()
148
+ })
149
+ .bind("hidden.bs.modal", function() {
150
+ ok(!$('#modal-test').is(":visible"), 'modal hidden')
151
+ div.remove()
152
+ start()
153
+ })
154
+ .modal("show")
155
+ })
156
+
157
+ test("should trigger hide event once when clicking outside of modal-content", function () {
158
+ stop()
159
+ $.support.transition = false
160
+ var div = $("<div id='modal-test'><div class='contents'></div></div>")
161
+ var triggered
162
+ div
163
+ .bind("shown.bs.modal", function () {
164
+ triggered = 0
165
+ $('#modal-test').click()
166
+ })
167
+ .one("hidden.bs.modal", function() {
168
+ div.modal("show")
169
+ })
170
+ .bind("hide.bs.modal", function () {
171
+ triggered += 1
172
+ ok(triggered === 1, 'modal hide triggered once')
173
+ start()
174
+ })
175
+ .modal("show")
176
+ })
177
+ })