fennec 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. data/lib/fennec/version.rb +1 -1
  2. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  3. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  4. data/vendor/assets/javascripts/README.md +106 -0
  5. data/vendor/assets/javascripts/bootstrap-alert.js +91 -0
  6. data/vendor/assets/javascripts/bootstrap-button.js +98 -0
  7. data/vendor/assets/javascripts/bootstrap-carousel.js +154 -0
  8. data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
  9. data/vendor/assets/javascripts/bootstrap-dropdown.js +92 -0
  10. data/vendor/assets/javascripts/bootstrap-modal.js +210 -0
  11. data/vendor/assets/javascripts/bootstrap-popover.js +95 -0
  12. data/vendor/assets/javascripts/bootstrap-scrollspy.js +125 -0
  13. data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
  14. data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
  15. data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
  16. data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
  17. data/vendor/assets/javascripts/tests/index.html +49 -0
  18. data/vendor/assets/javascripts/tests/unit/bootstrap-alert.js +41 -0
  19. data/vendor/assets/javascripts/tests/unit/bootstrap-button.js +54 -0
  20. data/vendor/assets/javascripts/tests/unit/bootstrap-collapse.js +25 -0
  21. data/vendor/assets/javascripts/tests/unit/bootstrap-dropdown.js +53 -0
  22. data/vendor/assets/javascripts/tests/unit/bootstrap-modal.js +85 -0
  23. data/vendor/assets/javascripts/tests/unit/bootstrap-popover.js +93 -0
  24. data/vendor/assets/javascripts/tests/unit/bootstrap-scrollspy.js +31 -0
  25. data/vendor/assets/javascripts/tests/unit/bootstrap-tab.js +45 -0
  26. data/vendor/assets/javascripts/tests/unit/bootstrap-tooltip.js +62 -0
  27. data/vendor/assets/javascripts/tests/unit/bootstrap-transition.js +13 -0
  28. data/vendor/assets/javascripts/tests/unit/bootstrap-typeahead.js +128 -0
  29. data/vendor/assets/javascripts/tests/vendor/jquery.js +9252 -0
  30. data/vendor/assets/javascripts/tests/vendor/qunit.css +232 -0
  31. data/vendor/assets/javascripts/tests/vendor/qunit.js +1510 -0
  32. data/vendor/assets/stylesheets/bootstrap/accordion.less +28 -0
  33. data/vendor/assets/stylesheets/bootstrap/alerts.less +70 -0
  34. data/vendor/assets/stylesheets/bootstrap/bootstrap.less +41 -5
  35. data/vendor/assets/stylesheets/bootstrap/breadcrumbs.less +22 -0
  36. data/vendor/assets/stylesheets/bootstrap/button-groups.less +147 -0
  37. data/vendor/assets/stylesheets/bootstrap/buttons.less +165 -0
  38. data/vendor/assets/stylesheets/bootstrap/carousel.less +121 -0
  39. data/vendor/assets/stylesheets/bootstrap/close.less +18 -0
  40. data/vendor/assets/stylesheets/bootstrap/code.less +44 -0
  41. data/vendor/assets/stylesheets/bootstrap/component-animations.less +18 -0
  42. data/vendor/assets/stylesheets/bootstrap/dropdowns.less +131 -0
  43. data/vendor/assets/stylesheets/bootstrap/forms.less +355 -305
  44. data/vendor/assets/stylesheets/bootstrap/grid.less +8 -0
  45. data/vendor/assets/stylesheets/bootstrap/hero-unit.less +20 -0
  46. data/vendor/assets/stylesheets/bootstrap/labels.less +16 -0
  47. data/vendor/assets/stylesheets/bootstrap/layouts.less +17 -0
  48. data/vendor/assets/stylesheets/bootstrap/mixins.less +410 -90
  49. data/vendor/assets/stylesheets/bootstrap/modals.less +72 -0
  50. data/vendor/assets/stylesheets/bootstrap/navbar.less +292 -0
  51. data/vendor/assets/stylesheets/bootstrap/navs.less +344 -0
  52. data/vendor/assets/stylesheets/bootstrap/pager.less +30 -0
  53. data/vendor/assets/stylesheets/bootstrap/pagination.less +55 -0
  54. data/vendor/assets/stylesheets/bootstrap/popovers.less +49 -0
  55. data/vendor/assets/stylesheets/bootstrap/progress-bars.less +95 -0
  56. data/vendor/assets/stylesheets/bootstrap/reset.less +37 -52
  57. data/vendor/assets/stylesheets/bootstrap/responsive.less +323 -0
  58. data/vendor/assets/stylesheets/bootstrap/scaffolding.less +13 -119
  59. data/vendor/assets/stylesheets/bootstrap/sprites.less +156 -0
  60. data/vendor/assets/stylesheets/bootstrap/tables.less +99 -131
  61. data/vendor/assets/stylesheets/bootstrap/thumbnails.less +35 -0
  62. data/vendor/assets/stylesheets/bootstrap/tooltip.less +35 -0
  63. data/vendor/assets/stylesheets/bootstrap/type.less +100 -70
  64. data/vendor/assets/stylesheets/bootstrap/utilities.less +23 -0
  65. data/vendor/assets/stylesheets/bootstrap/variables.less +94 -55
  66. data/vendor/assets/stylesheets/bootstrap/wells.less +17 -0
  67. data/vendor/assets/stylesheets/bootstrap-responsive.css +567 -0
  68. data/vendor/assets/stylesheets/bootstrap.css +3365 -0
  69. data/vendor/assets/stylesheets/docs.css +646 -173
  70. metadata +70 -23
  71. data/vendor/assets/javascripts/bootstrap/alerts.js +0 -104
  72. data/vendor/assets/javascripts/bootstrap/dropdown.js +0 -50
  73. data/vendor/assets/javascripts/bootstrap/jquery.tablesorter.min.js +0 -4
  74. data/vendor/assets/javascripts/bootstrap/modal.js +0 -231
  75. data/vendor/assets/javascripts/bootstrap/popover.js +0 -77
  76. data/vendor/assets/javascripts/bootstrap/scrollspy.js +0 -105
  77. data/vendor/assets/javascripts/bootstrap/tabs.js +0 -62
  78. data/vendor/assets/javascripts/bootstrap/twipsy.js +0 -307
  79. data/vendor/assets/javascripts/bootstrap.config.js +0 -52
  80. data/vendor/assets/stylesheets/bootstrap/patterns.less +0 -1005
  81. data/vendor/assets/stylesheets/bootstrap-1.3.0.css +0 -2362
  82. data/vendor/assets/stylesheets/bootstrap-1.3.0.min.css +0 -330
@@ -0,0 +1,54 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-buttons")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).button, 'tabs method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).button()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should return set state to loading", function () {
14
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
15
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
16
+ btn.button('loading')
17
+ equals(btn.html(), 'fat', 'btn text equals fat')
18
+ stop()
19
+ setTimeout(function () {
20
+ ok(btn.attr('disabled'), 'btn is disabled')
21
+ ok(btn.hasClass('disabled'), 'btn has disabled class')
22
+ start()
23
+ }, 0)
24
+ })
25
+
26
+ test("should return reset state", function () {
27
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
28
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
29
+ btn.button('loading')
30
+ equals(btn.html(), 'fat', 'btn text equals fat')
31
+ stop()
32
+ setTimeout(function () {
33
+ ok(btn.attr('disabled'), 'btn is disabled')
34
+ ok(btn.hasClass('disabled'), 'btn has disabled class')
35
+ start()
36
+ stop()
37
+ }, 0)
38
+ btn.button('reset')
39
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
40
+ setTimeout(function () {
41
+ ok(!btn.attr('disabled'), 'btn is not disabled')
42
+ ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
43
+ start()
44
+ }, 0)
45
+ })
46
+
47
+ test("should toggle active", function () {
48
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
49
+ ok(!btn.hasClass('active'), 'btn does not have active class')
50
+ btn.button('toggle')
51
+ ok(btn.hasClass('active'), 'btn has class active')
52
+ })
53
+
54
+ })
@@ -0,0 +1,25 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-collapse")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).collapse, 'collapse method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).collapse()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should show a collapsed element", function () {
14
+ var el = $('<div class="collapse"></div>').collapse('show')
15
+ ok(el.hasClass('in'), 'has class in')
16
+ ok(/height/.test(el.attr('style')), 'has height set')
17
+ })
18
+
19
+ test("should hide a collapsed element", function () {
20
+ var el = $('<div class="collapse"></div>').collapse('hide')
21
+ ok(!el.hasClass('in'), 'does not have class in')
22
+ ok(/height/.test(el.attr('style')), 'has height set')
23
+ })
24
+
25
+ })
@@ -0,0 +1,53 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-dropdowns")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).dropdown, 'dropdown method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).dropdown()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should add class open to menu if clicked", function () {
14
+ var dropdownHTML = '<ul class="tabs">'
15
+ + '<li class="dropdown">'
16
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
17
+ + '<ul class="dropdown-menu">'
18
+ + '<li><a href="#">Secondary link</a></li>'
19
+ + '<li><a href="#">Something else here</a></li>'
20
+ + '<li class="divider"></li>'
21
+ + '<li><a href="#">Another link</a></li>'
22
+ + '</ul>'
23
+ + '</li>'
24
+ + '</ul>'
25
+ , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
26
+
27
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
28
+ })
29
+
30
+ test("should remove open class if body clicked", function () {
31
+ var dropdownHTML = '<ul class="tabs">'
32
+ + '<li class="dropdown">'
33
+ + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
34
+ + '<ul class="dropdown-menu">'
35
+ + '<li><a href="#">Secondary link</a></li>'
36
+ + '<li><a href="#">Something else here</a></li>'
37
+ + '<li class="divider"></li>'
38
+ + '<li><a href="#">Another link</a></li>'
39
+ + '</ul>'
40
+ + '</li>'
41
+ + '</ul>'
42
+ , dropdown = $(dropdownHTML)
43
+ .appendTo('#qunit-fixture')
44
+ .find('[data-toggle="dropdown"]')
45
+ .dropdown()
46
+ .click()
47
+ ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
48
+ $('body').click()
49
+ ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
50
+ dropdown.remove()
51
+ })
52
+
53
+ })
@@ -0,0 +1,85 @@
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
+ })
@@ -0,0 +1,93 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-popover")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ var div = $('<div></div>')
7
+ ok(div.popover, 'popover method is defined')
8
+ })
9
+
10
+ test("should return element", function () {
11
+ var div = $('<div></div>')
12
+ ok(div.popover() == div, 'document.body returned')
13
+ })
14
+
15
+ test("should render popover element", function () {
16
+ $.support.transition = false
17
+ var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
18
+ .appendTo('#qunit-fixture')
19
+ .popover('show')
20
+
21
+ ok($('.popover').length, 'popover was inserted')
22
+ popover.popover('hide')
23
+ ok(!$(".popover").length, 'popover removed')
24
+ })
25
+
26
+ test("should store popover instance in popover data object", function () {
27
+ $.support.transition = false
28
+ var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
29
+ .popover()
30
+
31
+ ok(!!popover.data('popover'), 'popover instance exists')
32
+ })
33
+
34
+ test("should get title and content from options", function () {
35
+ $.support.transition = false
36
+ var popover = $('<a href="#">@fat</a>')
37
+ .appendTo('#qunit-fixture')
38
+ .popover({
39
+ title: function () {
40
+ return '@fat'
41
+ }
42
+ , content: function () {
43
+ return 'loves writing tests (╯°□°)╯︵ ┻━┻'
44
+ }
45
+ })
46
+
47
+ popover.popover('show')
48
+
49
+ ok($('.popover').length, 'popover was inserted')
50
+ equals($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
51
+ equals($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
52
+
53
+ popover.popover('hide')
54
+ ok(!$('.popover').length, 'popover was removed')
55
+ $('#qunit-fixture').empty()
56
+ })
57
+
58
+ test("should get title and content from attributes", function () {
59
+ $.support.transition = false
60
+ var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
61
+ .appendTo('#qunit-fixture')
62
+ .popover()
63
+ .popover('show')
64
+
65
+ ok($('.popover').length, 'popover was inserted')
66
+ equals($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
67
+ equals($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted')
68
+
69
+ popover.popover('hide')
70
+ ok(!$('.popover').length, 'popover was removed')
71
+ $('#qunit-fixture').empty()
72
+ })
73
+
74
+ test("should respect custom classes", function() {
75
+ $.support.transition = false
76
+ var popover = $('<a href="#">@fat</a>')
77
+ .appendTo('#qunit-fixture')
78
+ .popover({
79
+ title: 'Test'
80
+ , content: 'Test'
81
+ , template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
82
+ })
83
+
84
+ popover.popover('show')
85
+
86
+ ok($('.popover').length, 'popover was inserted')
87
+ ok($('.popover').hasClass('foobar'), 'custom class is present')
88
+
89
+ popover.popover('hide')
90
+ ok(!$('.popover').length, 'popover was removed')
91
+ $('#qunit-fixture').empty()
92
+ })
93
+ })
@@ -0,0 +1,31 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-scrollspy")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).scrollspy, 'scrollspy method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should switch active class on scroll", function () {
14
+ var sectionHTML = '<div id="masthead"></div>'
15
+ , $section = $(sectionHTML).append('#qunit-fixture')
16
+ , topbarHTML ='<div class="topbar">'
17
+ + '<div class="topbar-inner">'
18
+ + '<div class="container">'
19
+ + '<h3><a href="#">Bootstrap</a></h3>'
20
+ + '<ul class="nav">'
21
+ + '<li><a href="#masthead">Overview</a></li>'
22
+ + '</ul>'
23
+ + '</div>'
24
+ + '</div>'
25
+ + '</div>'
26
+ , $topbar = $(topbarHTML).scrollspy()
27
+
28
+ ok($topbar.find('.active', true))
29
+ })
30
+
31
+ })
@@ -0,0 +1,45 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-tabs")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).tab, 'tabs method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).tab()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should activate element by tab id", function () {
14
+ var tabsHTML =
15
+ '<ul class="tabs">'
16
+ + '<li><a href="#home">Home</a></li>'
17
+ + '<li><a href="#profile">Profile</a></li>'
18
+ + '</ul>'
19
+
20
+ $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
21
+
22
+ $(tabsHTML).find('li:last a').tab('show')
23
+ equals($("#qunit-fixture").find('.active').attr('id'), "profile")
24
+
25
+ $(tabsHTML).find('li:first a').tab('show')
26
+ equals($("#qunit-fixture").find('.active').attr('id'), "home")
27
+ })
28
+
29
+ test("should activate element by tab id", function () {
30
+ var pillsHTML =
31
+ '<ul class="pills">'
32
+ + '<li><a href="#home">Home</a></li>'
33
+ + '<li><a href="#profile">Profile</a></li>'
34
+ + '</ul>'
35
+
36
+ $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
37
+
38
+ $(pillsHTML).find('li:last a').tab('show')
39
+ equals($("#qunit-fixture").find('.active').attr('id'), "profile")
40
+
41
+ $(pillsHTML).find('li:first a').tab('show')
42
+ equals($("#qunit-fixture").find('.active').attr('id'), "home")
43
+ })
44
+
45
+ })
@@ -0,0 +1,62 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-tooltip")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ var div = $("<div></div>")
7
+ ok(div.tooltip, 'popover method is defined')
8
+ })
9
+
10
+ test("should return element", function () {
11
+ var div = $("<div></div>")
12
+ ok(div.tooltip() == div, 'document.body returned')
13
+ })
14
+
15
+ test("should expose default settings", function () {
16
+ ok(!!$.fn.tooltip.defaults, 'defaults is defined')
17
+ })
18
+
19
+ test("should remove title attribute", function () {
20
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
21
+ ok(!tooltip.attr('title'), 'title tag was removed')
22
+ })
23
+
24
+ test("should add data attribute for referencing original title", function () {
25
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
26
+ equals(tooltip.attr('data-original-title'), 'Another tooltip', 'original title preserved in data attribute')
27
+ })
28
+
29
+ test("should place tooltips relative to placement option", function () {
30
+ $.support.transition = false
31
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
32
+ .appendTo('#qunit-fixture')
33
+ .tooltip({placement: 'bottom'})
34
+ .tooltip('show')
35
+
36
+ ok($(".tooltip").hasClass('fade bottom in'), 'has correct classes applied')
37
+ tooltip.tooltip('hide')
38
+ })
39
+
40
+ test("should always allow html entities", function () {
41
+ $.support.transition = false
42
+ var tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"></a>')
43
+ .appendTo('#qunit-fixture')
44
+ .tooltip('show')
45
+
46
+ ok($('.tooltip b').length, 'b tag was inserted')
47
+ tooltip.tooltip('hide')
48
+ ok(!$(".tooltip").length, 'tooltip removed')
49
+ })
50
+
51
+ test("should respect custom classes", function () {
52
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
53
+ .appendTo('#qunit-fixture')
54
+ .tooltip({ template: '<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>'})
55
+ .tooltip('show')
56
+
57
+ ok($('.tooltip').hasClass('some-class'), 'custom class is present')
58
+ tooltip.tooltip('hide')
59
+ ok(!$(".tooltip").length, 'tooltip removed')
60
+ })
61
+
62
+ })
@@ -0,0 +1,13 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-transition")
4
+
5
+ test("should be defined on jquery support object", function () {
6
+ ok($.support.transition != undefined, 'transition object is defined')
7
+ })
8
+
9
+ test("should provide an end object", function () {
10
+ ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
11
+ })
12
+
13
+ })
@@ -0,0 +1,128 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-typeahead")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).typeahead, 'alert method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).typeahead()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should listen to an input", function () {
14
+ var $input = $('<input />')
15
+ $input.typeahead()
16
+ ok($input.data('events').blur, 'has a blur event')
17
+ ok($input.data('events').keypress, 'has a keypress event')
18
+ ok($input.data('events').keyup, 'has a keyup event')
19
+ if ($.browser.webkit || $.browser.msie) {
20
+ ok($input.data('events').keydown, 'has a keydown event')
21
+ } else {
22
+ ok($input.data('events').keydown, 'does not have a keydown event')
23
+ }
24
+ })
25
+
26
+ test("should create a menu", function () {
27
+ var $input = $('<input />')
28
+ ok($input.typeahead().data('typeahead').$menu, 'has a menu')
29
+ })
30
+
31
+ test("should listen to the menu", function () {
32
+ var $input = $('<input />')
33
+ , $menu = $input.typeahead().data('typeahead').$menu
34
+
35
+ ok($menu.data('events').mouseover, 'has a mouseover(pseudo: mouseenter)')
36
+ ok($menu.data('events').click, 'has a click')
37
+ })
38
+
39
+ test("should show menu when query entered", function () {
40
+ var $input = $('<input />').typeahead({
41
+ source: ['aa', 'ab', 'ac']
42
+ })
43
+ , typeahead = $input.data('typeahead')
44
+
45
+ $input.val('a')
46
+ typeahead.lookup()
47
+
48
+ ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
49
+ equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
50
+ equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
51
+
52
+ typeahead.$menu.remove()
53
+ })
54
+
55
+ test("should hide menu when query entered", function () {
56
+ stop()
57
+ var $input = $('<input />').typeahead({
58
+ source: ['aa', 'ab', 'ac']
59
+ })
60
+ , typeahead = $input.data('typeahead')
61
+
62
+ $input.val('a')
63
+ typeahead.lookup()
64
+
65
+ ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
66
+ equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
67
+ equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
68
+
69
+ $input.blur()
70
+
71
+ setTimeout(function () {
72
+ ok(!typeahead.$menu.is(":visible"), "typeahead is no longer visible")
73
+ start()
74
+ }, 200)
75
+
76
+ typeahead.$menu.remove()
77
+ })
78
+
79
+ test("should set next item when down arrow is pressed", function () {
80
+ var $input = $('<input />').typeahead({
81
+ source: ['aa', 'ab', 'ac']
82
+ })
83
+ , typeahead = $input.data('typeahead')
84
+
85
+ $input.val('a')
86
+ typeahead.lookup()
87
+
88
+ ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
89
+ equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
90
+ equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
91
+ ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
92
+
93
+ $input.trigger({
94
+ type: 'keypress'
95
+ , keyCode: 40
96
+ })
97
+
98
+ ok(typeahead.$menu.find('li').first().next().hasClass('active'), "second item is active")
99
+
100
+
101
+ $input.trigger({
102
+ type: 'keypress'
103
+ , keyCode: 38
104
+ })
105
+
106
+ ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
107
+
108
+ typeahead.$menu.remove()
109
+ })
110
+
111
+
112
+ test("should set input value to selected item", function () {
113
+ var $input = $('<input />').typeahead({
114
+ source: ['aa', 'ab', 'ac']
115
+ })
116
+ , typeahead = $input.data('typeahead')
117
+
118
+ $input.val('a')
119
+ typeahead.lookup()
120
+
121
+ $(typeahead.$menu.find('li')[2]).mouseover().click()
122
+
123
+ equals($input.val(), 'ac', 'input value was correctly set')
124
+ ok(!typeahead.$menu.is(':visible'), 'the menu was hidden')
125
+
126
+ typeahead.$menu.remove()
127
+ })
128
+ })