From 6ec7c72e5b5152afb676c43ea57a51fb625f9ba2 Mon Sep 17 00:00:00 2001 From: Paul McLanahan Date: Fri, 9 Nov 2012 11:48:21 -0500 Subject: Fix issue with double move event firing in typeahead. Fix test to catch issue. Fix #5806. --- js/tests/unit/bootstrap-typeahead.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'js/tests') diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js index 16bdb9194..b796a33b3 100644 --- a/js/tests/unit/bootstrap-typeahead.js +++ b/js/tests/unit/bootstrap-typeahead.js @@ -137,10 +137,19 @@ $(function () { equals(typeahead.$menu.find('.active').length, 1, 'one item is active') ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active") + // simulate entire key pressing event $input.trigger({ type: 'keydown' , keyCode: 40 }) + .trigger({ + type: 'keypress' + , keyCode: 40 + }) + .trigger({ + type: 'keyup' + , keyCode: 40 + }) ok(typeahead.$menu.find('li').first().next().hasClass('active'), "second item is active") @@ -149,6 +158,14 @@ $(function () { type: 'keydown' , keyCode: 38 }) + .trigger({ + type: 'keypress' + , keyCode: 38 + }) + .trigger({ + type: 'keyup' + , keyCode: 38 + }) ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active") @@ -196,4 +213,4 @@ $(function () { typeahead.$menu.remove() }) -}) \ No newline at end of file +}) -- cgit v1.2.3 From a7eb9c294a575b5471ddec45ae75e1d09f7ace4c Mon Sep 17 00:00:00 2001 From: fat Date: Fri, 7 Dec 2012 17:06:01 -0500 Subject: add noConflict functionality to all bootstrap plugins --- js/tests/unit/bootstrap-affix.js | 6 ++++++ js/tests/unit/bootstrap-alert.js | 6 ++++++ js/tests/unit/bootstrap-button.js | 6 ++++++ js/tests/unit/bootstrap-carousel.js | 6 ++++++ js/tests/unit/bootstrap-collapse.js | 6 ++++++ js/tests/unit/bootstrap-dropdown.js | 10 ++++++++-- js/tests/unit/bootstrap-modal.js | 6 ++++++ js/tests/unit/bootstrap-popover.js | 12 +++++++++--- js/tests/unit/bootstrap-scrollspy.js | 6 ++++++ js/tests/unit/bootstrap-tab.js | 6 ++++++ js/tests/unit/bootstrap-tooltip.js | 6 ++++++ js/tests/unit/bootstrap-typeahead.js | 6 ++++++ 12 files changed, 77 insertions(+), 5 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/bootstrap-affix.js b/js/tests/unit/bootstrap-affix.js index bc25df991..c97887890 100644 --- a/js/tests/unit/bootstrap-affix.js +++ b/js/tests/unit/bootstrap-affix.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-affix") + test("should provide no conflict", function () { + var affix = $.fn.affix.noConflict() + ok(!$.fn.affix, 'affix was set back to undefined (org value)') + $.fn.affix = affix + }) + test("should be defined on jquery object", function () { ok($(document.body).affix, 'affix method is defined') }) diff --git a/js/tests/unit/bootstrap-alert.js b/js/tests/unit/bootstrap-alert.js index 7f24e0e6b..9a6b514c4 100644 --- a/js/tests/unit/bootstrap-alert.js +++ b/js/tests/unit/bootstrap-alert.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-alerts") + test("should provide no conflict", function () { + var alert = $.fn.alert.noConflict() + ok(!$.fn.alert, 'alert was set back to undefined (org value)') + $.fn.alert = alert + }) + test("should be defined on jquery object", function () { ok($(document.body).alert, 'alert method is defined') }) diff --git a/js/tests/unit/bootstrap-button.js b/js/tests/unit/bootstrap-button.js index b5d083499..e23ff9e30 100644 --- a/js/tests/unit/bootstrap-button.js +++ b/js/tests/unit/bootstrap-button.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-buttons") + test("should provide no conflict", function () { + var button = $.fn.button.noConflict() + ok(!$.fn.button, 'button was set back to undefined (org value)') + $.fn.button = button + }) + test("should be defined on jquery object", function () { ok($(document.body).button, 'button method is defined') }) diff --git a/js/tests/unit/bootstrap-carousel.js b/js/tests/unit/bootstrap-carousel.js index 8bd1b62ba..13b8f721f 100644 --- a/js/tests/unit/bootstrap-carousel.js +++ b/js/tests/unit/bootstrap-carousel.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-carousel") + test("should provide no conflict", function () { + var carousel = $.fn.carousel.noConflict() + ok(!$.fn.carousel, 'carousel was set back to undefined (org value)') + $.fn.carousel = carousel + }) + test("should be defined on jquery object", function () { ok($(document.body).carousel, 'carousel method is defined') }) diff --git a/js/tests/unit/bootstrap-collapse.js b/js/tests/unit/bootstrap-collapse.js index 6cc7ac7a4..4c5916ecd 100644 --- a/js/tests/unit/bootstrap-collapse.js +++ b/js/tests/unit/bootstrap-collapse.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-collapse") + test("should provide no conflict", function () { + var collapse = $.fn.collapse.noConflict() + ok(!$.fn.collapse, 'collapse was set back to undefined (org value)') + $.fn.collapse = collapse + }) + test("should be defined on jquery object", function () { ok($(document.body).collapse, 'collapse method is defined') }) diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/bootstrap-dropdown.js index 3788209ec..2f0d2d29e 100644 --- a/js/tests/unit/bootstrap-dropdown.js +++ b/js/tests/unit/bootstrap-dropdown.js @@ -2,6 +2,12 @@ $(function () { module("bootstrap-dropdowns") + test("should provide no conflict", function () { + var dropdown = $.fn.dropdown.noConflict() + ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)') + $.fn.dropdown = dropdown + }) + test("should be defined on jquery object", function () { ok($(document.body).dropdown, 'dropdown method is defined') }) @@ -104,7 +110,7 @@ $(function () { }) test("should remove open class if body clicked, with multiple drop downs", function () { - var dropdownHTML = + var dropdownHTML = '