mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-20 20:31:26 +02:00
Merge pull request #5862 from pmclanahan/issue-5806-typeahead-keyboard-nav
Fix issue with double move event firing in typeahead.
This commit is contained in:
19
js/tests/unit/bootstrap-typeahead.js
vendored
19
js/tests/unit/bootstrap-typeahead.js
vendored
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user