mirror of
https://github.com/twbs/bootstrap.git
synced 2025-07-31 19:00:23 +02:00
Merge branch '2.2.2-wip' of github.com:twitter/bootstrap into 2.2.2-wip
This commit is contained in:
2
js/bootstrap-typeahead.js
vendored
2
js/bootstrap-typeahead.js
vendored
@@ -217,7 +217,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, keydown: function (e) {
|
, 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)
|
this.move(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
js/tests/unit/bootstrap-typeahead.js
vendored
17
js/tests/unit/bootstrap-typeahead.js
vendored
@@ -143,10 +143,19 @@ $(function () {
|
|||||||
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
|
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
|
||||||
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
|
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
|
||||||
|
|
||||||
|
// simulate entire key pressing event
|
||||||
$input.trigger({
|
$input.trigger({
|
||||||
type: 'keydown'
|
type: 'keydown'
|
||||||
, keyCode: 40
|
, 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")
|
ok(typeahead.$menu.find('li').first().next().hasClass('active'), "second item is active")
|
||||||
|
|
||||||
@@ -155,6 +164,14 @@ $(function () {
|
|||||||
type: 'keydown'
|
type: 'keydown'
|
||||||
, keyCode: 38
|
, keyCode: 38
|
||||||
})
|
})
|
||||||
|
.trigger({
|
||||||
|
type: 'keypress'
|
||||||
|
, keyCode: 38
|
||||||
|
})
|
||||||
|
.trigger({
|
||||||
|
type: 'keyup'
|
||||||
|
, keyCode: 38
|
||||||
|
})
|
||||||
|
|
||||||
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
|
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user