aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfat <[email protected]>2012-12-07 17:50:34 -0500
committerfat <[email protected]>2012-12-07 17:50:34 -0500
commit10e72e158d5d85b1373375a5230fe2b9865c8bba (patch)
tree9b02cea0358edba68fb7e2ae244f97dc3ecadfc3
parent91fbadad5b058f160eb3b5eb8e88432e0088efee (diff)
parentc362e726608388141d7c0fb420f98bac8ea3a4b1 (diff)
downloadbootstrap-10e72e158d5d85b1373375a5230fe2b9865c8bba.tar.xz
bootstrap-10e72e158d5d85b1373375a5230fe2b9865c8bba.zip
Merge branch '2.2.2-wip' of github.com:twitter/bootstrap into 2.2.2-wip
-rw-r--r--js/bootstrap-typeahead.js2
-rw-r--r--js/tests/unit/bootstrap-typeahead.js19
2 files changed, 19 insertions, 2 deletions
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js
index 9b123fb3f..387fd2a6d 100644
--- a/js/bootstrap-typeahead.js
+++ b/js/bootstrap-typeahead.js
@@ -217,7 +217,7 @@
}
, keydown: function (e) {
- this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
+ this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js
index 0f7aed27d..0cf26b315 100644
--- a/js/tests/unit/bootstrap-typeahead.js
+++ b/js/tests/unit/bootstrap-typeahead.js
@@ -143,10 +143,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")
@@ -155,6 +164,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")
@@ -202,4 +219,4 @@ $(function () {
typeahead.$menu.remove()
})
-}) \ No newline at end of file
+})