Skip to content

Commit

Permalink
Merge branch '2.2.2-wip' of github.com:twitter/bootstrap into 2.2.2-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Dec 7, 2012
2 parents 91fbada + c362e72 commit 10e72e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
19 changes: 18 additions & 1 deletion js/tests/unit/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")

Expand Down Expand Up @@ -202,4 +219,4 @@ $(function () {

typeahead.$menu.remove()
})
})
})

0 comments on commit 10e72e1

Please sign in to comment.