0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-19 16:54:24 +01:00

Merge branch '2.0.2-wip' of github.com:twitter/bootstrap into 2.0.2-wip

This commit is contained in:
Jacob Thornton 2012-03-08 11:39:33 -08:00
commit d3721c504e
2 changed files with 11 additions and 7 deletions

View File

@ -40,6 +40,7 @@
, select: function () {
var val = this.$menu.find('.active').attr('data-value')
this.$element.val(val)
this.$element.change();
return this.hide()
}
@ -165,9 +166,6 @@
}
, keyup: function (e) {
e.stopPropagation()
e.preventDefault()
switch(e.keyCode) {
case 40: // down arrow
case 38: // up arrow
@ -180,6 +178,7 @@
break
case 27: // escape
if (!this.shown) return
this.hide()
break
@ -187,10 +186,11 @@
this.lookup()
}
e.stopPropagation()
e.preventDefault()
}
, keypress: function (e) {
e.stopPropagation()
if (!this.shown) return
switch(e.keyCode) {
@ -210,12 +210,12 @@
this.next()
break
}
e.stopPropagation()
}
, blur: function (e) {
var that = this
e.stopPropagation()
e.preventDefault()
setTimeout(function () { that.hide() }, 150)
}

View File

@ -114,15 +114,19 @@ $(function () {
source: ['aa', 'ab', 'ac']
})
, typeahead = $input.data('typeahead')
, changed = false
$input.val('a')
typeahead.lookup()
$input.change(function() { changed = true });
$(typeahead.$menu.find('li')[2]).mouseover().click()
equals($input.val(), 'ac', 'input value was correctly set')
ok(!typeahead.$menu.is(':visible'), 'the menu was hidden')
ok(changed, 'a change event was fired')
typeahead.$menu.remove()
})
})
})