aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorbilly gates <[email protected]>2012-12-07 14:16:51 -0800
committerbilly gates <[email protected]>2012-12-07 14:16:51 -0800
commitc362e726608388141d7c0fb420f98bac8ea3a4b1 (patch)
tree5be5fde06ec9c816a0cb8c8697a29bfa8ddf1da8 /js/tests
parent66b70016d0f083098c32ad051173e6f52a6b2084 (diff)
parent6ec7c72e5b5152afb676c43ea57a51fb625f9ba2 (diff)
downloadbootstrap-c362e726608388141d7c0fb420f98bac8ea3a4b1.tar.xz
bootstrap-c362e726608388141d7c0fb420f98bac8ea3a4b1.zip
Merge pull request #5862 from pmclanahan/issue-5806-typeahead-keyboard-nav
Fix issue with double move event firing in typeahead.
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/bootstrap-typeahead.js19
1 files changed, 18 insertions, 1 deletions
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
+})