From 527fb87dadd1e677f132ca3db0b02825d5bd57e5 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 17 Mar 2012 21:29:56 -0700 Subject: add /head --- js/tests/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tests') diff --git a/js/tests/index.html b/js/tests/index.html index 8c710de36..2d59ab032 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -36,7 +36,7 @@ - +

Bootstrap Plugin Test Suite

-- cgit v1.2.3 From 83a7a698939b5b4cba3c04a86befc12b9005df3d Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Mon, 19 Mar 2012 15:33:28 -0700 Subject: typeahead should escape regexp special chars --- js/tests/unit/bootstrap-typeahead.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js index 96ea7c45f..25d313c85 100644 --- a/js/tests/unit/bootstrap-typeahead.js +++ b/js/tests/unit/bootstrap-typeahead.js @@ -52,6 +52,22 @@ $(function () { typeahead.$menu.remove() }) + test("should not explode when regex chars are entered", function () { + var $input = $('').typeahead({ + source: ['aa', 'ab', 'ac', 'mdo*', 'fat+'] + }) + , typeahead = $input.data('typeahead') + + $input.val('+') + typeahead.lookup() + + ok(typeahead.$menu.is(":visible"), 'typeahead is visible') + equals(typeahead.$menu.find('li').length, 1, 'has 1 item in menu') + equals(typeahead.$menu.find('.active').length, 1, 'one item is active') + + typeahead.$menu.remove() + }) + test("should hide menu when query entered", function () { stop() var $input = $('').typeahead({ -- cgit v1.2.3 From ef5ac02b698ffab3a42d21f20859b70df85543c0 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 24 Mar 2012 17:50:21 -0700 Subject: allow prevent default for show and hide event in modal --- js/tests/unit/bootstrap-modal.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/bootstrap-modal.js index 22f5781ea..0851f64a7 100644 --- a/js/tests/unit/bootstrap-modal.js +++ b/js/tests/unit/bootstrap-modal.js @@ -29,6 +29,35 @@ $(function () { .modal("show") }) + test("should fire show event", function () { + stop() + $.support.transition = false + $("") + .bind("show", function () { + ok(true, "show was called") + }) + .bind("shown", function () { + $(this).remove() + start() + }) + .modal("show") + }) + + test("should not fire shown when default prevented", function () { + stop() + $.support.transition = false + $("") + .bind("show", function (e) { + e.preventDefault() + ok(true, "show was called") + start() + }) + .bind("shown", function () { + ok(false, "shown was called") + }) + .modal("show") + }) + test("should hide modal when hide is called", function () { stop() $.support.transition = false -- cgit v1.2.3 From bccc2cb7191eb54a4d67563625a748d7ecd381d4 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 24 Mar 2012 18:20:09 -0700 Subject: add preventDefault support for all inital event types (show, close, hide, etc.) + fix small bug with scrollspy.last --- js/tests/index.html | 2 ++ js/tests/unit/bootstrap-alert.js | 15 +++++++++++++++ js/tests/unit/bootstrap-carousel.js | 28 ++++++++++++++++++++++++++++ js/tests/unit/bootstrap-collapse.js | 15 +++++++++++++++ js/tests/unit/bootstrap-tab.js | 16 ++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 js/tests/unit/bootstrap-carousel.js (limited to 'js/tests') diff --git a/js/tests/index.html b/js/tests/index.html index 2d59ab032..3e6cb9777 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -15,6 +15,7 @@ + @@ -28,6 +29,7 @@ + diff --git a/js/tests/unit/bootstrap-alert.js b/js/tests/unit/bootstrap-alert.js index e607f4340..7f24e0e6b 100644 --- a/js/tests/unit/bootstrap-alert.js +++ b/js/tests/unit/bootstrap-alert.js @@ -38,4 +38,19 @@ $(function () { ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom') }) + test("should not fire closed when close is prevented", function () { + $.support.transition = false + stop(); + $('
') + .bind('close', function (e) { + e.preventDefault(); + ok(true); + start(); + }) + .bind('closed', function () { + ok(false); + }) + .alert('close') + }) + }) \ No newline at end of file diff --git a/js/tests/unit/bootstrap-carousel.js b/js/tests/unit/bootstrap-carousel.js new file mode 100644 index 000000000..92c23e227 --- /dev/null +++ b/js/tests/unit/bootstrap-carousel.js @@ -0,0 +1,28 @@ +$(function () { + + module("bootstrap-carousel") + + test("should be defined on jquery object", function () { + ok($(document.body).carousel, 'carousel method is defined') + }) + + test("should return element", function () { + ok($(document.body).carousel()[0] == document.body, 'document.body returned') + }) + + test("should not fire sliden when slide is prevented", function () { + $.support.transition = false + stop(); + $('