From ec56940c511df165784a2a203be8e05644661c46 Mon Sep 17 00:00:00 2001 From: Anirvan Chatterjee Date: Fri, 27 Apr 2012 10:48:59 -0700 Subject: several spelling corrections --- js/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/README.md b/js/README.md index c7b71e70f..b7927ba6b 100644 --- a/js/README.md +++ b/js/README.md @@ -5,9 +5,9 @@ These are the high-level design rules which guide the development of Bootstrap's ### DATA-ATTRIBUTE API -We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript. This is bootstraps first class api. +We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first class API. -We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this: +We acknowledge that this isn't always the most performant and it may sometimes be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this: $('body').off('.data-api') @@ -19,7 +19,7 @@ To target a specific plugin, just include the plugins name as a namespace along ### PROGRAMATIC API -We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API. +We also believe you should be able to use all plugins provided by Bootstrap purely through the JavaScript API. All public APIs should be single, chainable methods, and return the collection acted upon. @@ -45,7 +45,7 @@ An options definition should take the following form: *noun*: *adjective* - describes or modifies a quality of an instance -examples: +Examples: backdrop: true keyboard: false @@ -93,7 +93,7 @@ Data attributes should take the following form: - data-target || href^=# - defined on "control" element (if element controls an element other than self) - data-{{noun}} - defines class instance options -examples: +Examples: // control other targets data-toggle="modal" data-target="#foo" -- cgit v1.2.3 From e9a7d26d0636445fb20def22db54fe703164031b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Borgesen?= Date: Mon, 14 May 2012 14:03:36 +0200 Subject: Cancel running timer for tooltips with delayed show, but instant hide. This prevents delayed tooltips from appearing if the mouse leaves the elements before tooltip is showed and the hiding delay is 0. --- js/bootstrap-tooltip.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 577ead48b..4c2a2a328 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -84,6 +84,7 @@ , leave: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) + if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() clearTimeout(this.timeout) @@ -272,4 +273,4 @@ , delay: 0 } -}(window.jQuery); \ No newline at end of file +}(window.jQuery); -- cgit v1.2.3 From e388a5e475867cd266d58caf83b614aafe06cc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Borgesen?= Date: Sun, 20 May 2012 19:59:53 +0200 Subject: Added unit test to check that tooltips is not showed when leave event is triggered before show delay has expired AND the hide delay is set to 0 --- js/bootstrap-tooltip.js | 1 - js/tests/unit/bootstrap-tooltip.js | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 4c2a2a328..6ff2b4708 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -87,7 +87,6 @@ if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() - clearTimeout(this.timeout) self.hoverState = 'out' this.timeout = setTimeout(function() { if (self.hoverState == 'out') self.hide() diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 63f4f0b07..c25093420 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -78,6 +78,25 @@ $(function () { }, 100) }) + test("should not show tooltip if leave event occurs before delay expires, even if hide delay is 0", function () { + var tooltip = $('') + .appendTo('#qunit-fixture') + .tooltip({ delay: { show: 200, hide: 0} }) + + stop() + + tooltip.trigger('mouseenter') + + setTimeout(function () { + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') + tooltip.trigger('mouseout') + setTimeout(function () { + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') + start() + }, 200) + }, 100) + }) + test("should not show tooltip if leave event occurs before delay expires", function () { var tooltip = $('') .appendTo('#qunit-fixture') @@ -133,4 +152,4 @@ $(function () { ok($.fn.tooltip.Constructor.prototype.isHTML($('
')), 'correctly detected html') }) -}) \ No newline at end of file +}) -- cgit v1.2.3 From 8dda83906d72ade81ecf9b21d55b5a2922589d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Borgesen?= Date: Sun, 20 May 2012 20:10:21 +0200 Subject: Swapped out .hasClass() with .is() when checking for multiple classes --- js/tests/unit/bootstrap-tooltip.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index c25093420..63a42b0d4 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -33,7 +33,7 @@ $(function () { .tooltip({placement: 'bottom'}) .tooltip('show') - ok($(".tooltip").hasClass('fade bottom in'), 'has correct classes applied') + ok($(".tooltip").is('.fade.bottom.in'), 'has correct classes applied') tooltip.tooltip('hide') }) @@ -69,10 +69,10 @@ $(function () { tooltip.trigger('mouseenter') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') tooltip.trigger('mouseout') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') start() }, 200) }, 100) @@ -104,10 +104,10 @@ $(function () { stop() tooltip.trigger('mouseenter') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') tooltip.trigger('mouseout') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') start() }, 100) }, 50) @@ -120,9 +120,9 @@ $(function () { stop() tooltip.trigger('mouseenter') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip has faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip has faded in') start() }, 200) }, 100) -- cgit v1.2.3 From 4eaeea81fd909e6711f57049fc4372f4045fa5aa Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 31 May 2012 10:24:23 -0700 Subject: rebuild and fix test --- js/tests/unit/bootstrap-tooltip.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 63a42b0d4..7b0c10de0 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -116,16 +116,16 @@ $(function () { test("should show tooltip if leave event hasn't occured before delay expires", function () { var tooltip = $('') .appendTo('#qunit-fixture') - .tooltip({ delay: 200 }) + .tooltip({ delay: 150 }) stop() tooltip.trigger('mouseenter') setTimeout(function () { ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in') - setTimeout(function () { - ok(!$(".tooltip").is('.fade.in'), 'tooltip has faded in') - start() - }, 200) }, 100) + setTimeout(function () { + ok($(".tooltip").is('.fade.in'), 'tooltip has faded in') + start() + }, 200) }) test("should detect if title string is html or text: foo", function () { -- cgit v1.2.3